2 Replies Latest reply on Apr 21, 2013 1:31 PM by patrick

    Simple Calculated AppleScript to Open File is Not Working



      Simple Calculated AppleScript to Open File is Not Working



           I am using Mac OS 10.8.3 and FileMaker Pro 12.0v3.

           I have a database with an image in a container field in each record. The image is stored as a reference only and all are kept in a single folder.

           The database is not on the boot volume, in fact it and the folder with the images are all on a Drobo connected to the Mac by FireWire.

           I wish to be able to open each image in Preview (which is the default image viewer on my Mac) using a button beside the image container field.

           I have set this up before on other databases on other Macs, but now it is not working even though it is so simple.

           I get the path to the image from GetAsText ( the container field ) then I put that into an AppleScript which is run from a FileMaker Pro script, and of course that FileMaker Pro script is triggered by the button beside the container field in the record.

           In this case to get the path I have simply created a calculation field which uses a calculation to create a path from the container field. This way I can see that the path is calculated correctly. The path is in this format:


           So here is the calculation to create the AppleScript.

           "tell application \"Finder\"" & ¶ &
           "open file " & "\""
           "\"" & ¶ &
           "end tell"

           When I run this script I get an error dialogue box which says:

           Finder got an error: Can't get file "Volume:folder:folder:image.jpg".

           I have created the script in the AppleScript Editor and it runs just fine from there.

      tellapplication "Finder"

      openfile "Volume:folder:folder:image.jpg"



           It does not make any difference if I use "open file" or "open", except the wording of the error dialogue changes.


           It is so simple, but it is not working.


           I am hoping that I have not seen something very obvious and this will be pointed out to me.


           It would not be the first time :)


           Thank you.