我有一个已编译的 AppleScript 应用程序,已将其移至我的 Windows 服务器。然后我想在应用程序中插入一个文本文件(它在 Windows 上看起来像一个 zip 文件):
myapplescript.app/Contents/Resources/MyNewDir/MyTxtFile.txt
所以,我已经预编译了 AppleScript 以尝试从这个文本文件中读取并将内容作为字符串获取。这就是我所做的:
set theFolder to POSIX path of (the path to me)
set theFile to theFolder & "Contents/Resources/MyNewDir/MyTxtFile.txt"
open for access theFile
set fileContents to (read theFile)
close access theFile
但这是我得到的错误:
Can't make "/Users/mike/Desktop/myapplescript.app/Contents/Resources/MyNewDir/MyTxtFile.txt" into type file
最佳答案
好吧,我想通了,我把第二行改成了这样:
set theFile to (POSIX file (theFolder & "Contents/Resources/MyNewDir/MyTxtFile.txt"))
关于file-io - 从文件中读取的 Applescript 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/281108/