2013-04-23 66 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/他已經深入探討了這一點。