このようなAppleScriptスニペットがある場合
tell application "Finder"
set thePath to (POSIX path of (path to application "MyApp"))
end tell
それは私に戻ってきます
"/Applications/MyApp.app"
今、私が理解できないように見えるのは、リテラルではなく変数を介して「MyApp」を指定する方法です。
私のapplescriptはいくつかのXML値を読み込みます.そのうちの1つは、私が興味を持っているアプリケーションの名前です.私はこれを試しました:
tell application "Finder"
set thePath to (POSIX path of (path to application someVariable))
end tell
しかし、これは単にエラーを教えてくれます
「Finder でエラーが発生しました: アプリケーション "MyApp" を型定数にできません。」
どうすればこれを行うことができますか?