Automator not working inside xcode

假装没事ソ 提交于 2019-12-25 09:15:25

问题


I am running an automator with an applescript, and while it works inside automator, it fails when run from xcode. Here's my code:

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

I am trying to trigger save and return me the path of the active workspace to do some work later. I just started on it few days back, so pardon me if it's something really stupid.


回答1:


It was really simple. All I needed was to give xcode access to be able to modify accessibility settings. The code is working perfectly fine.



来源:https://stackoverflow.com/questions/39711871/automator-not-working-inside-xcode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!