【发布时间】:2013-11-05 17:24:00
【问题描述】:
我已尝试按照 this post 上的说明进行操作,但我无法理解某些海报说明的工作原理。
我希望能够使用预先编写的 bash 脚本打包应用程序,然后执行它,但不要从 步骤 4 开始。
帖子写道:
4.同样在您的 AppleScriptObjC 脚本中,在适当的地方添加以下内容:
property pathToResources : "NSString" -- works if added before script command
5.在适当的情况下,还在您的 AppleScriptObjC 脚本中添加以下内容:
set yourScript to pathToResources & "/yourScriptFile.sh"
-- gives the complete unix path
-- if needed, you can convert this to the Apple style path:
set yourScriptPath to (((yourScript as text) as POSIX file) as alias)`
6.顺便说一句,您可以使用
打开文件进行读取 tell application "Finder"
open yourScriptPath
end tell
问题:
-
我在哪里添加行:
property pathToResources : "NSString" -
我要添加以下哪一项,在哪里添加?
set yourScript to pathToResources & "/yourScriptFile.sh"或
set yourScriptPath to (((yourScript as text) as POSIX file) as alias) 如何执行脚本本身?提及
As an aside, you could then open the file for read using仅涵盖Apple样式路径,不涵盖使用上述样式。
谁能帮我解释一下,或者发布一个AppDelegate.applescript 文件的静态副本,显示原始海报如何要求使用基本代码?我已经尝试了他的方法,并在过去 3 周内浏览了互联网,但无济于事。我不想将特定工具的所有代码从 bash 脚本转换为 AppleScript,因为这需要大量工作。
我只需要知道如何在我的应用程序中引用脚本文件(例如myBashScript.sh),该脚本文件将驻留在应用程序中并在编译时被 Xcode 包含。
【问题讨论】:
标签: xcode bash applescript applescript-objc