我用這樣的代碼做一些菜單自動點擊,而不是再次每次做他們自己:有沒有辦法使用AppleScript在不訪問「系統事件」的情況下點擊osx菜單項?
tell application "System Events" to tell process "myApp"
click something and so on
end tell
現在,爲了使這項工作在OSX獅子沙箱,我的權利文件看起來像這樣(做了大量的研究摸不着頭腦):
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.temporary-exception.apple-events</key>
<array>
<string>com.apple.systemevents</string>
<string>com.apple.iphonesimulator</string>
</array>
</dict>
</plist>
而現在,上帝希望,因爲我訪問com.apple.systemevents
蘋果拒絕這個程序。有沒有什麼辦法可以使用System Events
來點擊指定應用程序菜單中的指定菜單項?