我只是试图关闭一个文件(没有退出单词),但这是行不通的。Applescript:关闭Word文档? (Office 2011)
我已经试过:
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
我会试着用tell语句中的重复例程(在activate语句之后)。可能会有影响。 – 2013-01-23 13:10:05
@DigiMonk我已经完全删除了重复,没有效果。谢谢。 – Wesley