2012-03-20 80 views
0

我想编写一个AppleScript以在某个预定时间在模拟器上启动我的项目。我正在使用下面的苹果脚本,但它不会在我的模拟器上运行该项目。它退出模拟器,启动XCODE,但不要在模拟器上运行项目,尽管目标已正确设置为模拟器。我该怎么办?使用苹果脚本运行模拟器构建

application "iPhone Simulator" quit 
tell application "Xcode" 
    open "Users:abhinav:myProject:Code:client:src:test.xcodeproj" 
    tell project "test" 
     clean 
     build 
     run 
    end tell 
end tell 
application "iPhone Simulator" activate 

回答

0

不幸的是,Xcode中的AppleScript支持非常坏,并且不支持运行动词。但是,如果您使用AppleScript,则可以通过使用以下代码中的系统事件来运行它:

tell application "Xcode" 
    tell project "test" 
     activate 
    end tell 
end tell 


tell application "System Events" 
    tell process "Xcode" 
     click menu item "Run Without Building" of menu 1 of menu item "Perform Action" of menu "Product" of menu bar item "Product" of menu bar 1 
    end tell 
end tell 
相关问题