如何建立和放大器;运行X code。与AppleScript的? [英] How to build & run Xcode with Applescript?

查看:123
本文介绍了如何建立和放大器;运行X code。与AppleScript的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图仿效X code'S⌘-R按键在另一个编辑器(即VIM);我以为我能与一些shell脚本和放大器来做到这一点; AppleScript的,但它似乎并不能正常工作:

I'm trying to emulate Xcode's ⌘-R keystroke in another editor (namely, Vim); I thought I would be able to do this with some shell scripting & applescript, but it doesn't seem to be working correctly:

open -a Xcode "MyProj.xcodeproj"
osascript -e 'tell app "Xcode"' -e 'build' -e 'launch' -e 'end tell'

这里的问题是,无论X code是否报告错误是启动应用程序。有什么办法解决这一问题?

The problem with this is it launches the app regardless of whether Xcode reports errors. Is there any way to fix this?

推荐答案

我使用的:

osascript -e 'tell application "Xcode"
    activate

    set targetProject to project of active project document
    if (build targetProject) is equal to "Build succeeded" then
    	launch targetProject
    end if
end tell'

当然,该项目已在X code打开这个工作。 (我宁愿不硬code当前项目到我的脚本)

Of course, the project has to already be open in Xcode for this to work. (I'd rather not hard code the current project into my script)

这篇关于如何建立和放大器;运行X code。与AppleScript的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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