我只是想关闭一个文档(不退出单词),但这不起作用。
我试过了 :
close documents saving no
close active document
close document 1
但这些都不起作用..
我得到的错误(在关闭线上)是:
Microsoft Word got an error: The object you are trying to access does not exist
这是一个简化的脚本。有人有想法么?网上所有的例子好像都是用这个语法,不知道mac office 2011版本有什么变化?
set input to {POSIX path of "/Users/Wesley/Desktop/test.doc"}
--ENABLE GUI SCRIPTING
tell application "System Events"
if UI elements enabled is false then set UI elements enabled to true
end tell
--RUN THE GUISCRIPT
set pdfSavePath to POSIX path of (choose folder with prompt "Set destination folder")
repeat with x in input
display dialog x
tell application "Microsoft Word"
activate
open x
set theActiveDoc to the active document
close theActiveDoc saving no
return
end tell
end repeat