开发者

Applescript MSoft Word open doc

I am trying to simply open a document with Applescript in Microsoft Word, here's my script:

tell application "Microsoft Word"
    open document 开发者_运维百科"Macintosh HD:test.docx"
end tell

But it keeps telling me the object I am trying to access doesn't exist. But the file is there...!!

Please help, thanks.


document refers to an open file in applescript

so what you want to do is open the file

tell application "Microsoft Word"
    open file "Macintosh HD:test.docx"
end tell


According to this, which I've just tested, you don't need document nor Macintosh HD but include activate

so, it will be:

tell application "Microsoft Word"
    activate
    open "test.docx"
end tell


It's been several millenia since I've used AppleScript, but aren't you supposed to refer to a file in the HD folder as ":Macintosh HS:test.docx" (note leading colon)?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜