如何启用关于Applescript的菜单栏项目

时间:2013-11-23 05:45:18

标签: applescript

我想知道如何在AppleScript上启用关于MyApplication菜单栏项目。我试过这个

 tell application "System Events"
    tell process "MyApp"
        set AboutApplication to {}
        repeat with AboutApplication in AboutApplication
            try
                set frontmost to true
                set AboutApplication to enabled of menu item "About MyApp" of menu "Object" of menu bar item "Object" of menu bar 1
                if activeMenuItem is true then
                end if
            end try
        end repeat
    end tell
end tell

但我很确定它的错误。

有人可以告诉我如何启用它吗?

1 个答案:

答案 0 :(得分:0)

我认为你不能用AppleScript做到这一点。

如果您要创建AppleScriptObjC应用程序,则需要将相应的脚本添加到“关于”菜单项并使用XCode GUI启用。

如果您正在使用脚本编辑器编写一个简单的脚本,并且想要在另一个应用程序中启用菜单项,那么它就没有意义,因为该应用程序在该菜单项后面没有任何代码。即使您能够自己启用菜单项,如果您点击它或发生崩溃,也不会发生任何事情。

尝试这个是没有意义的。