这个小例子展示了如何在Mac OS X系统上,从Unix shell script运行某些AppleScript/osascript的语法:
#!/bin/sh osascript <<EOF tell application"Safari" close window 1 end tell EOF
只需将你的AppleScript放在EOF
部件之间,保存文件,使文件可执行,这样就可以运行多行AppleScript脚本了。
下面是这个例子的另一个例子:
#!/bin/sh osascript <<EOF tell application"Safari" to activate tell application"Safari" set bounds of front window to {300, 30, 1600, 1100} end tell EOF