Automator在Xcode中不起作用 [英] Automator not working inside xcode

查看:87
本文介绍了Automator在Xcode中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行带有applescript的自动程序,虽然它在自动程序中运行,但从xcode运行时失败. 这是我的代码:

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.

推荐答案

这真的很简单.我所需要做的就是授予xcode访问权限,以便能够修改可访问性设置.代码运行正常.

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.

这篇关于Automator在Xcode中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆