我試圖根據當前的應用程序"open"
應用程序嘗試不同的事件 - 這是屏幕最重要的一個。我設法使用變量保存應用程序的名稱。使用此代碼。如果使用AppleScript的國家/地區
tell application "System Events"
item 1 of (get name of processes whose frontmost is true)
set openWindow to (get name of processes whose frontmost is true)
do shell script "echo " & openWindow & " > /Users/name/temp/currentWindow.txt"
end tell
我又試圖使用此代碼爲每個打開的應用程序做不同的事件
tell application "System Events"
if openWindow = "AppleScript Editor" then
display dialog "my variable: " & openWindow
end if
end tell
但是這個代碼不衝擊片雷管做任何事情,我沒有任何錯誤信息或任何然而,代碼不顯示對話框。如果我將對話框的代碼放在代碼的第一部分中,它將顯示打開的應用程序的名稱。
如何得到這個工作,那將是非常有益的
謝謝大家,這非常有幫助。 – user1973521