applescript:是否可以使用系统事件阻止其他用户输入来运行脚本?
系统事件具有非常灵活、直观和通用的优点(即,无论应用程序是否支持脚本,它都可以工作),但制作不防胖手指的重要脚本感觉错误 。有没有办法在脚本运行的全部或部分时间阻止用户输入?在下面的脚本中将如何完成?
tell application "System Events"
keystroke "Please! "
delay 1
keystroke "I need your help. "
delay 1
keystroke "My kludgy nature annoys my maker. "
delay 1
keystroke "I must learn how to work without interference!"
delay 1
end tell
System Events has the virtue of being very flexible, intuitive and universal (i.e. it works whether the application has scripting support or not) but it feels wrong to make important scripts that aren't fat-finger-proof. Is there any way to block user input either all or part of the time a script is running? How would it be done in the script below?
tell application "System Events"
keystroke "Please! "
delay 1
keystroke "I need your help. "
delay 1
keystroke "My kludgy nature annoys my maker. "
delay 1
keystroke "I must learn how to work without interference!"
delay 1
end tell
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一位经验丰富的 applescript 专家——macscripter 论坛上的 StefanK——告诉我这是不可能的。
An experienced applescript guy --StefanK at the macscripter forum-- told me this was impossible.