script to open file

Hi,

I have this script which used to work prior to the latest Monterey and still does to some extent. I have a mounted .dmg and trying to get a file to open. Pretty simple, right?


Here's the rub.


I used to be able to open the following script when Excel was closed and it would open Excel and the file no problem.

Now, in order for it to run and open the file, Excel needs to be running, otherwise Excel will open and the file will not open.


On big sur, no problem. This also happens with Adobe files that I have scripted to open, and once again Adobe needs to be running for the script to run.


Appreciate your help as always !


tell application "Finder"

activate

open document file "MASTERS.xlsx" of disk "STUFF"

end tell

iMac Line (2012 and Later)

Posted on Mar 23, 2022 6:51 PM

Reply
Question marked as Top-ranking reply

Posted on Mar 28, 2022 11:30 AM

It may not directly address the question, but why are you asking the Finder to open the file, rather than directing the command at the target application?


tell application "Microsoft Excel"
   open file "STUFF:MASTERS.xlsx"
end tell

Similar questions

3 replies

Mar 28, 2022 1:02 PM in response to Camelot

I don't remember how I initially did it, but it worked for years. Then, I started having encrypted .dmg problems and created a new encrypted.dmg and it stopped working. I did a number of things recopied the script and resaved, and I recorded it (which used Finder when recording) and used the recorder output which did not work, which made no sense.


Just wonder why when the script runs, it says "missing value" under result ?

It works perfectly, and thanks for your expert help.


All the best

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

script to open file

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.