向Bash脚本添加AppleScript
我有下面的Bash脚本向Bash脚本添加AppleScript,bash,applescript,Bash,Applescript,我有下面的Bash脚本 !#/bin/bash fscanx --pdf /scandata/Trust_Report if [ "$?" = "0" ]; then 我想运行以下AppleScript tell application "FileMaker Pro Advanced" activate show window "Trust Reports" do script "Scan Trust Report" end tell else s
!#/bin/bash
fscanx --pdf /scandata/Trust_Report
if [ "$?" = "0" ]; then
我想运行以下AppleScript
tell application "FileMaker Pro Advanced"
activate
show window "Trust Reports"
do script "Scan Trust Report"
end tell
else
say “It did not scan”
fi
调用此AppleScript的正确语法是什么
谢谢使用
osascript
命令。您可以使用-e
标志将脚本作为参数传递,如下所示(注意,没有必要将其分成多行,我只是这样做以使其更具可读性):
或者将其作为here文档传递,如下所示:
osascript <<'EOF'
tell application "FileMaker Pro Advanced"
activate
show window "Trust Reports"
do script "Scan Trust Report"
end tell
EOF
如果您搜索“从bash运行applescript”,会有大量链接。下面是.55:61:语法错误:应为行尾等,但找到了类名。(-2741)
osascript <<'EOF'
tell application "FileMaker Pro Advanced"
activate
show window "Trust Reports"
do script "Scan Trust Report"
end tell
EOF
if fscanx --pdf /scandata/Trust_Report; then
osascript ...
else
say “It did not scan”
fi