起動スクリプト内でAppleScriptを実行しようとしていますが、なんらかの理由で起動しません。それは私のコンピュータである可能性がありますが、それ以外の何かが間違っているかもしれないと私は考えています。誰かがこの投稿を見てコメントすることができたら、本当にありがとう!PLISTが起動していません
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.pf.Testing</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/osascript</string>
<string>-e</string>
<string>'tell application "Finder"' -e 'set didQuit to (path to home folder as string) & ".myApp"' -e 'if (exists file didQuit) then' -e 'tell application "TestApp"' -e 'activate' -e 'end tell' -e 'end if' -e 'end tell'</string>
</array>
<key>StartInterval</key>
<integer>20</integer>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
ありがとうございました!
LATEST PLIST:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.pf.Testing</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/osascript</string>
<string>-e</string>
<string>'tell application "Finder"'</string>
<string>-e</string>
<string>'set didQuit to (path to home folder as string) & ".myApp"'</string>
<string>-e</string>
<string>'if (exists file didQuit) then'</string>
<string>-e</string>
<string>'tell application "TestApp"'</string>
<string>-e</string>
<string>'activate'</string>
<string>-e</string>
<string>'end tell'</string>
<string>-e</string>
<string>'end if'</string>
<string>-e</string>
<string>'end tell'</string>
</array>
<key>StandardErrorPath</key>
<string>/Users/pf/Desktop/Problem.log</string>
<key>StartInterval</key>
<integer>20</integer>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
こんにちはニック: お返事ありがとうございます。残念ながら、LimitLoadToSessionTypeコードを使用してパスにファイルが存在するかどうかを再確認した後も、それはまだ実行されません。本当に奇妙です。特にTerminalで同じコードを実行するとうまくいきます。何か考えていますか? – PF1
もう1つのアイデア:引数としてAppleScriptコマンドを渡すのではなく、別のスクリプトファイルに入れて、そのパスをosascriptに渡してみてください。 –