使用AppleScript启动Xcode项目

时间:2013-04-23 10:03:32

标签: xcode applescript xcode4.5

我开始关注AppleScript。我尝试使用Xcode打开xcode项目。我已经成功打开了包含xcode项目的文件夹,但还没有,使用Xcode启动项目。请帮忙吗?!

tell application "Finder" to open folder "workpace" of folder "Documents" of folder "user1" of folder "Users" of disk "Macintosh HD"

3 个答案:

答案 0 :(得分:3)

你想要做这样的事......

tell application "Xcode"
    open file "path:to:my:file.xcodeproj"
end tell

答案 1 :(得分:2)

您可以使用POSIX file

从普通路径获取文件对象
tell application "Finder"
    open POSIX file "/Users/username/Documents/workspace/workspace.xcodeproj"
end tell

这稍慢,但即使Finder没有响应它也能正常工作:

do shell script "open ~/Documents/workspace/workspace.xcodeproj"

答案 2 :(得分:0)

    tell application "Xcode"
        open file "Macintosh HD:Users:YourUserName:YourFolder:YourFolder:YourFileProject.xcodeproj"
    end tell