Applescript のごく一部を使用するシェル スクリプトで問題が発生しています。Applescriptエディターでコンパイルすると動作します。ただし、シェルスクリプト内ではそうではありません。
44:49: 構文エラー: 行末が必要ですが、コマンド名が見つかりました。(-2741) 23:28: 構文エラー: 行末が予期されていましたが、「後」に見つかりました。(-2741)
シェルコードは次のとおりです。
osascript -e 'tell application "System Events" -e 'activate'
osascript -e 'tell process "Application 10.5" -e 'set frontmost to true' -e 'end tell'
osascript -e 'delay 1' -e 'keystroke return' -e 'delay 1' -e 'keystroke return'
end tell
Applescript (動作します):
tell application "System Events"
activate
tell process "Application 10.5"
set frontmost to true
end tell
delay 1
keystroke return
delay 1
keystroke return
end tell
[更新] / [解決済み]
これにより、アップルスクリプトを変更してシェルスクリプト内で動作するようにしようとしていたあらゆる種類の問題が処理されました。
## shell script code
echo "shell script code"
echo "shell script code"
## applescript code
osascript <<EOF
tell application "Scriptable Text Editor"
make new window
activate
set contents of window 1 to "Hello World!" & return
end tell
EOF
## resume shell script...
純粋な AppleScript を直接シェル スクリプトに入れることができるのは非常に素晴らしいことです。;-)