开发者

Open MS Office file with AppleScript

开发者 https://www.devze.com 2023-01-25 07:18 出处:网络
I have a vbscript file that will open a document with the correct program using SharePoint.OpenDocuments, which is present if Microsoft Office is installed. It\'s basically: CreateObject(\"SharePoint.

I have a vbscript file that will open a document with the correct program using SharePoint.OpenDocuments, which is present if Microsoft Office is installed. It's basically: CreateObject("SharePoint.OpenDocuments.2").EditDocument("MyDocument.docx") where MyDocument.docx can be anything and the correct program will open.

Is there a way of achieving the same thing in AppleScript on a Mac if Microsoft Office is installed (or even otherwise)?

Thanks,

Adam.

UPDATE: The location of the file will be something like "http://myserver/myfile.doc" and this will be hard code开发者_运维问答d into the script.


set chosenFile to choose file
tell application "Finder"
    open chosenFile
end tell

The open command can be further expanded to accept a reference to an application and other arguments related to opening the file, but the above is all you really need if you don't need to specify the application.

0

精彩评论

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

关注公众号