为什么以下 applescript 不能模拟按键?
Why won't the following applescript simulate the key presses?
我不明白为什么下面的代码不会启动按键 q 或 space。它们在 if 语句之外工作。请帮助我理解,我对此很陌生。
if x is "705011" then
say "Yes"
return x
tell application "System Events" to keystroke "q"
else
say "No"
return x
tell application "System Events" to keystroke " "
end if
A return
语句退出当前作用域。在 run
处理程序中,它中止脚本,在自定义处理程序中,它 returns 给调用者。
不执行 return
语句后的任何代码。
我不明白为什么下面的代码不会启动按键 q 或 space。它们在 if 语句之外工作。请帮助我理解,我对此很陌生。
if x is "705011" then
say "Yes"
return x
tell application "System Events" to keystroke "q"
else
say "No"
return x
tell application "System Events" to keystroke " "
end if
A return
语句退出当前作用域。在 run
处理程序中,它中止脚本,在自定义处理程序中,它 returns 给调用者。
不执行 return
语句后的任何代码。