与链接的问题类似,我试图自动打开Xcode项目,构建它,然后在iPhone模拟器(v4.3)中运行应用程序.该项目是Selenium项目的iPhoneDriver(详见这里:http://code.google.com/p/selenium/wiki/IPhoneDriver)
根据另一个问题的答案,我写了以下脚本:
tell application "Xcode" open "/Users/<username>/documents/Code/Selenium/iphone/iWebDriver.xcodeproj" tell project "iWebDriver" clean build try deBUG end try end tellend tell
不幸的是,当我运行这个我得到以下内容:
tell application "Xcode"open "/Users/ben.adderson/documents/Code/Selenium/iphone/iWebDriver.xcodeproj" --> project document "iWebDriver.xcodeproj"clean project "iWebDriver" --> missing valuebuild project "iWebDriver" --> missing valuedeBUG project "iWebDriver" --> error number -1708end tell
如果我只运行打开的命令,Xcode打开项目没有问题.但是,一旦我包含脚本的其余部分,Dock中的Xcode图标就会d出,但是除了AppleScript编辑器之外,还有这一点.
有人建议我做错了什么?这是我第一次使用AppleScript或Xcode,所以我很努力地诊断问题.
我试过看Xcode AppleScript字典,但没有工作的例子,我无法确定我需要的语法.
提前感谢任何帮助!
解决方法 使用AppleScript和命令行工具(xcodebuild)的混合,我想出了这一点:-- This script will clean,build then run the project at the path below.-- You will need to slightly modify this script if you have more than one xcodeproject at this pathset pathOfXcodeProject to "/Users/<username>/documents/Code/Selenium/iphone/iWebDriver.xcodeproj"-- End of configurationdo shell script "cd " & pathOfXcodeProject & " && /usr/bin/xcodebuild clean build "tell application "Xcode" open pathOfXcodeProject activateend telltell application "System Events" get system attribute "sysv" if result is greater than or equal to 4144 then -- Mac OS X 10.3.0 if UI elements enabled then tell application process "Xcode" click menu item "Run" of menu 1 of menu bar item "Product" of menu bar 1 end tell else beep display dialog "GUI Scripting is not enabled" & return & return & "Open System Preferences and check Enable Access for Assistive Devices in the Universal Access preference pane,then run this script again." with icon stop if button returned of result is "OK" then tell application "System Preferences" activate set current pane to pane "com.apple.preference.universalaccess" end tell end if end if else beep display dialog "This computer cannot run this script" & return & return & "The script uses GUI Scripting technology,which requires an upgrade to Mac OS X 10.3 Panther or newer." with icon caution buttons {"Quit"} default button "Quit" end ifend tell
让我知道,如果这适用于你.我在lion的Xcode 4.2.1测试了一个iPhone项目.
总结以上是内存溢出为你收集整理的自动化Xcode 4.1的AppleScript语法清理,构建然后运行全部内容,希望文章能够帮你解决自动化Xcode 4.1的AppleScript语法清理,构建然后运行所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)