使用“AXMenuItemMarkChar”的检查,以检测属性得到检查的菜单项。
tell application "System Events"
tell process "Safari"
tell menu item "Private Browsing" of menu 1 of menu bar item "Safari" of menu bar 1
if value of attribute "AXMenuItemMarkChar" is "✓" then click -- disabling
end tell
end tell
end tell
更新时间:
要不要打开一个应用程序(小程序的AppleScript或液滴)的前景:利用这个脚本可以在包的的Info.plist添加属性LSBackgroundOnly
(小程序) 。
set tApp to choose file with prompt "Select your application (applet AppleScript)"
set tPlist to quoted form of ((POSIX path of tApp) & "Contents/Info")
do shell script "/usr/bin/defaults write " & tPlist & " LSBackgroundOnly -bool TRUE"
do shell script "/usr/bin/defaults write " & tPlist & " LSUIElement -bool TRUE"
一个简单的问题:每当脚本运行的应用程序。应用程序来到前台.i.e当我在Safari浏览器上浏览和这个脚本是由我的应用程序运行Safari浏览器去背景和应用程序来到前台。我不希望我的应用程序来到前台 – 2014-10-08 13:21:10
我编辑了我的答案。 – jackjr300 2014-10-08 20:21:17
这不是我的问题。我不想让应用程序运行背景。我每隔15秒就从应用程序定时器调用这个脚本。当我在safari中浏览时,脚本被称为我的应用程序出现在前面,所以我需要每次点击safari图标返回到safari – 2014-10-13 10:51:25