open file with applescript

i updated to lion yesterday. everything seems to be working fine until i opened up one of my filemaker databases and ran one of the scripts that opens a pdf file located on a network drive. suddenly, i get a "The file ****.pdf couldn't be opened because you don't have permission to view it." error message. which struck me as odd seeing that i opened it two days ago with no problem. so....the scripting war began. after hours of trying to diagnose the issue...i came across that it has nothing to do with filemaker, nothing to do with the pdf, nothing to do with the permissions, nothing to do with the applescript....which puts it all on lion (and i'm assuming the new security features). so, my issue.....how do i get past that??? just trying to run a simple script:


tell application "Preview" to open "/Users/UName/Desktop/File.pdf"



what can be done?

iMac 21.5"-OTHER, Mac OS X (10.7)

Posted on Jul 22, 2011 1:16 PM

Reply
19 replies

Jul 23, 2011 11:28 AM in response to MDParker

I have the exact same problem. I've confirmed that I can open the file within Finder with no problems. Oddly enough, once I've opened it in Finder, I can then go back and execute the Applescript command from within FileMaker Pro with no problems.


I'm running FileMaker Pro 11 Advanced with the latest version (11.0v3) which is recommended for Lion.

Jul 23, 2011 11:37 AM in response to MDParker

Okay, did a little digging and found a solution that works for me.


In my AppleScript code, I have the line "open FilePath" with "FilePath" being the variable name I assigned to the calculation that FileMaker Pro returns. When it's just that line, it fails. When I add "as alias" to the end, it works.


In short, I changed "open FilePath" to "open FilePath as alias" and that worked for me.


Hope this helps anyone else having this problem.

Jul 25, 2011 6:05 AM in response to ExAstris

ok, you are correct. but i think this is more of a bandaid on the problem. i'm able to run an applescript to open the file in preview with the 'as alias' method, but it still won't work with filemaker's 'Send Event' script step. so, if i wanted to spend the hours necessary to go through all of my scripts to patch it, this method would work...but sadly, i don't. so, i'm just going to have safari open the pdf (which seems to work perfectly). thanks though. hopefully this will get fixed soon. 😟

Jul 26, 2011 11:04 AM in response to MDParker

Actually, that doesn't even work in AppleScript at all, as it gives the same error. It throws up this message


set myPath to "/Volumes/ericdano/Computer_Music_2011-08.pdf"

tell application "Finder" to open myPath as alias


If you change it to this:

set myPath to "/Volumes/ericdano/Computer_Music_2011-08.pdf"

tell application "Finder" to open file myPath as alias


It throws up this message


"Can't make file "/Volumes/ericdano/Computer_Music_2011-08.pdf" of application "Finder" into type alias


So........dang........



Jul 26, 2011 11:23 AM in response to MDParker

Yikes, no, that doesn't work at all.


Actually, I think the major problem is PREVIEW. If I use Adobe Reader then it seems to work fine in regular applescript and in FileMaker. At least on 10.6. I'll try it on 10.7 and see if it makes any difference.


But none of the tell application "Finder" things work at all using Preview but


"tell application \"Adobe Acrobat Pro\" to open \"" & Lesson Materials::FilePath & "\""


Works fine in FileMaker.

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.

open file with applescript

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