0

I have console app named "MyApp" it is running and I see it in the activity monitor.

I'm writing in AppleScript Editor the script:

tell application "MyApp"

display dialog "Hello World"

end tell

When running the script the editor asks me where is MyApp? And it doesn't appear in the list it shows. When I'm trying to brows it's location, I can't select MyApp's bundle. How can I deal with it? Thanks!

4

2 回答 2

0

您需要添加NSAppleScriptEnabledInfo.plist. 该条目如下所示:

<key>NSAppleScriptEnabled</key>
<true/>

您可以在所有可编写脚本的应用程序中找到此条目,例如:

open /Applications/Preview.app/Contents/Info.plist 

因为它是手动添加的,所以如果您重新编译应用程序,您可能需要重新添加代码。

于 2015-05-11T09:32:24.863 回答
0

我找到的解决方案是解决捆绑标识符而不是应用程序名称。

tell application id "com.MyApp.app"
    display dialog "Hello World"
end tell
于 2015-05-17T14:21:41.593 回答