从文件中读取的 Applescript 应用程序 [英] Applescript application read from file

查看:21
本文介绍了从文件中读取的 Applescript 应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个已编译的 AppleScript 应用程序,已将其移至我的 Windows 服务器.然后我想在应用程序中插入一个文本文件(在 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

因此,我预编译了 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆