本文介绍了如何从一个的AppleScript可可,AppleScript的应用程序中访问一个捆绑的文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在AppleScript的,我习惯叫:
In AppleScript I'm used to call:
set audio_file to (path to me as string) & "Contents:Resources:Audio:Music.mp3"
display dialog "Path: " & (quoted form of POSIX path of audio_file)
我现在有X code进行可可的AppleScript项目这里面code。它编译好,但剧本完全不运行。该对话框一直没有出现。
I have now this code inside a Cocoa-AppleScript project in Xcode. It compiles well, but the script is not running at all. The dialog never shows.
如果没有(路径,我作为字符串)
它的工作原理,但没有路径。
Without the (path to me as string)
it works, but without the path.
推荐答案
和答案是,在可可的AppleScript应用程序,正确的sintaxis是不是:
And the answer is that, in a Cocoa-AppleScript Application, the right sintaxis is NOT:
(path to me as text)
但是:
(path to current application as text)
我
不是自我引用有效。正确的是当前应用程序
。
me
is not valid as self-reference. The correct one is current application
.
希望这会帮助别人:)
这篇关于如何从一个的AppleScript可可,AppleScript的应用程序中访问一个捆绑的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!