私がやろうとしていること:
テキスト エディタ (TextEdit、Byword、FoldingText) を使用しているときに、この AppleScript にファイル パスを表示させたいと考えています。
最前面のウィンドウ アプリを要求すると、アプリ名がわかりやすく簡単に取得できるので、次のステップで POSIX パスを要求できると考えました。
問題:
スクリプトは既に 99% 完成していますが、何かが欠けています。変数を使用しようとするactiveApp
と機能せず、次のエラーが発生します。
Error Number:System Events got an error: Can’t get application {"TextEdit"}.
-1728
スクリプトは次のとおりです。
tell application "System Events"
set activeApp to name of application processes whose frontmost is true
--This doesn't work either:
--do shell script "php -r 'echo urldecode(\"" & activeApp & "\");'"
tell application activeApp
set myPath to POSIX path of (get file of front document)
end tell
display dialog myPath
end tell
activeApp
私が"TextEdit"
すべての作品と交換すれば。助けていただければ幸いです。
Applescriptを使用して、アプリケーション名からプロセス名を取得し、その逆も同様です。