我试图根据当前的应用程序"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