SatelliteCreative
asked on
How to open PDF file with Applescript
Hi, I am trying to open a PDF on a CD with an Applescript saved in the same directory as the script.
The attached code doesn't work, and I suspect I'm not giving enough of a path to the 'open' function.
Any pointers? I want to be able to do this without buying/installing any custom scripts/components/apps.
Thanks!
The attached code doesn't work, and I suspect I'm not giving enough of a path to the 'open' function.
Any pointers? I want to be able to do this without buying/installing any custom scripts/components/apps.
Thanks!
tell application "Finder"
activate
open document file "test.pdf"
end tell
ASKER
Ok thanks, can you tell me whether I should be able to test that from a folder NOT on the CD? I've tried to run it and I get the error:
Finder got an error: Cant get file \"Macintosh HD:Users:Monolith:Desktop: Script Editor.app:test.pdf\"."
so I imagine its looking for the pdf IN the script editor?
Finder got an error: Cant get file \"Macintosh HD:Users:Monolith:Desktop:
so I imagine its looking for the pdf IN the script editor?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi, it's fine to work standalone as an application, so now I've saved as you suggest it works perfectly.
Unfortunately now I can't get flash's fscommand to run the script from a 'projector' file! Anyway, I'll probably post another question about this.
Thanks very much for your help!
Unfortunately now I can't get flash's fscommand to run the script from a 'projector' file! Anyway, I'll probably post another question about this.
Thanks very much for your help!
you might try running it as a script thru the fscommand. I'm honestly not sure what would happen in that case, but it might, and hopefully would, work as we want/expect it too.
If so give this a try.
Open in new window