从文件中读取AppleScript的应用 [英] Applescript application read from file
问题描述
我有我已经搬到我的Windows Server编译AppleScript的应用程序。我想,然后插入一个文本文件到应用程序(它看起来像在Windows上一个zip文件):
I have a compiled applescript application which I have moved to my windows server. I'd like to then insert a text file into the application (which looks like a zip file on windows):
myapplescript.app/Contents/Resources/MyNewDir/MyTxtFile.txt
myapplescript.app/Contents/Resources/MyNewDir/MyTxtFile.txt
所以,我precompiled的AppleScript的尝试从这个文本文件阅读和获取的内容作为一个字符串。这是我做的:
So, i've precompiled the applescript to try to read from this text file and get the contents as a string. This is what I do:
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
这是我的错误:
不能使/Users/mike/Desktop/myapplescript.app/Contents/Resources/MyNewDir/MyTxtFile.txt到类型的文件
Can't make "/Users/mike/Desktop/myapplescript.app/Contents/Resources/MyNewDir/MyTxtFile.txt" into type file
推荐答案
好吧,我想通了,我改变了第二行是:
Ok, I figured it out, I changed the second line to this:
set theFile to (POSIX file (theFolder & "Contents/Resources/MyNewDir/MyTxtFile.txt"))
这篇关于从文件中读取AppleScript的应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!