我遇到了一个使用一小部分Applescript的shell脚本的问题.当我使用Applescript编辑器编译它时,它可以工作.它不在shell脚本中.
44:49:语法错误:预期行结束但找到命令名称.(-2741)23:28:语法错误:预期行结束但发现"之后".(-2741)
这是shell代码:
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
Run Code Online (Sandbox Code Playgroud)
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
Run Code Online (Sandbox Code Playgroud)
[更新]/[已解决]
这解决了我试图修改applescript以在shell脚本中工作的任何问题:
## shell script code
echo "shell script code"
echo "shell script code" …Run Code Online (Sandbox Code Playgroud)