Open MS Office file with AppleScript
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.
精彩评论