2016-09-26 34 views
0

我正在运行带有applescript的automator,虽然它在automator中工作,但从xcode运行时会失败。 这里是我的代码:Automator不能在xcode中工作

tell application "Xcode" 
    set targetProjectPath to path of active workspace document 
    set targetProjectPath to POSIX file (targetProjectPath & "/..") as string 
    set targetProjectPath to POSIX path of targetProjectPath 
    tell application "System Events" 
     tell process "Xcode" 
      click menu item "Save" of menu 0 of menu bar item "File" of menu bar 0 
     end tell 
    end tell 
    return {targetProjectPath} 
end tell 

我试图触发保存并返回我的活动工作区的路径后来做了一些工作。 我刚开始几天就回来了,所以如果真的很愚蠢,请原谅我。

回答

0

这很简单。我所需要的只是让xcode访问能够修改辅助功能设置。代码工作得很好。