所以我是applecript的新手,我正在尝试创建一个可以打开微软单词的应用程序,然后每隔一段时间自动保存文档,然后在关闭Word后停止运行。到目前为止,这是我的代码:
activate application "Microsoft Word"
if application "Microsoft Word" is running then
repeat
delay 5
tell application "Microsoft Word" to save front document
end repeat
end if
直到我退出单词为止。即使我将它设置为结束如果word没有运行它仍然试图保存到word然后我收到一条错误消息。另一个值得注意的有趣的事情是,一旦我退出单词,它甚至会在剧本中告诉你。
我做错了什么?
答案 0 :(得分:2)
将此保存为保持打开的应用程序:
activate application "Microsoft Word"
on idle
say "idle"
if application "Microsoft Word" is running then tell application "Microsoft Word" to save front document
return 5 -- in seconds
end idle