如何停止执行一段时间的AppleScript?

时间:2015-08-12 16:46:05

标签: applescript automator

我在Automator中有一个小苹果:

do shell script "osascript ~/Focus-On.scpt"
delay 60
do shell script "osascript ~/Focus-Off.scpt"

基本上,我想执行第一个shell脚本,然后在一分钟之后执行第二个脚本脚本。

但Automator毫不拖延地执行这两项操作。如何解决?

2 个答案:

答案 0 :(得分:1)

尝试load script方式,这适用于我的机器:

set homeFolder to path to home folder as text
set scriptOn to load script alias (homeFolder & "Focus-On.scpt")
run scriptOn
delay 60.0
set scriptOff to load script alias (homeFolder & "Focus-Off.scpt")
run scriptOff

答案 1 :(得分:0)

我发现最简单的方法:只是将作业传递给shell:

do shell script "osascript ~/Focus-On.scpt; sleep 10; osascript ~/Focus-Off.scpt"