如何暂停执行 applescript 一段时间?

How to pause execution of applescript for some time?

我在 Automator 中有一个小的 applescript:

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

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

但是 Automator 会毫不延迟地执行这两个操作。如何解决?

尝试 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

我找到的最简单的方法:将工作传递给 shell:

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