使用AppleScript当我尝试从Scripts
文件夹中调用另一个AppleScript时,我对我的错误感到困惑。我当前的脚本保存为foo.app
,我看到了Bundle Contents
的结构,但是当我尝试从bar.app
文件夹中调用Scripts
时,我得到一个{{1}的对话框1}}。
在引用“How to access from AppleScript a bundled file within a Cocoa-AppleScript Application?”后,我尝试了:
Resource not found
当出现错误时我做了一些搜索,我引用了“How do I get the Scripts folder in the application bundle?”并尝试了:
tell application "Finder"
set thisFolder to (container of (path to me)) as string
set insideApp to thisFolder & (path to resource "bar.app")
end tell
定位tell application "Finder"
set thisFolder to (container of (path to me)) as string
set insideApp to (thisFolder as alias) & (path to resource "bar.app" in directory "Scripts")
end tell
我显示变量description.rtfd
和我得到的对话thisFolder
,但在我运行时会生成Macintosh HD:Users:darth_vader:Desktop:
:
Resource not found
我到底做错了什么以及如何在tell application "Finder"
set thisFolder to (container of (path to me)) as string
display dialog thisFolder
set insideApp to thisFolder & (path to resource "Contents:Resources:description.rtfd")
end tell
文件夹中拨打电话?
答案 0 :(得分:0)
存在一般性的误解:
container of (path to me)
指向脚本(bundle)的路径
set insideApp to path to resource "bar.app"
指向脚本(包)的封闭文件夹的路径
所以它是:
set insideApp to path to resource "bar.app" in directory "Scripts"
或:
set insideApp to alias ((path to me as text) & "Contents:Resources:description.rtfd")
或(优选)
Finder
根本不需要createInterstitialView
。