2013-04-23 65 views
0

我正在尝试将我的applescript合并到xcode中。该脚本通常与applescript一起工作,但不能在xcode中运行。我正在尝试打开文件以供阅读。这里是代码xcode 4.6 applescript读取文本文件

set Location to "US" 
set DriverFile to "/Volumes/MacPrintDrivers/" & Location & "DriverInstall.txt" 
set DriverInstallFile to POSIX file DriverFile 
open for access DriverInstallFile 

我已确认文件存在,我可以显示内容。我似乎无法在Xcode中阅读这种方式。我得到的误差是

«script» doesn’t understand the «event rdwropen» message. (error -1708) 
+0

可能重复[设置音量不能在xcode中使用applescript cocoa objc](http://stackoverflow.com/questions/15555380/set-volume-not-working-in-xcode-with-applescript-cocoa-objc ) – matt 2013-04-23 03:37:32

回答

0

ASOC(AppleScript的目的-C)有一些问题与脚本除了命令(如open for access)。有时候你可以通过说tell current application to来解决这个问题。 tell current application to open for access。但对于进一步的细节,我建议你得到肖恩斯坦利的书:http://www.macosxautomation.com/applescript/apps/他已经深入探讨了这一点。