October 22, 200916 yr Hi, I have a database where I imported a list containing various several files from different applications I use. I am tring to create a script which will allow me to open one of these file with its corresponding application. However I am unable to do so from FMP I think I need to create an applescript where using the parameters I have in different fields of the db will tell the finder to open the file I choose. I have the file name in my first field and the complete path in another, so I think in my script I need to tell applescript to open something like /Volume/Pathfiled/Filename is this a correct? ( I never used applescript so I don't know how) Thanks a lot Edited October 22, 200916 yr by Guest
October 22, 200916 yr Maybe the easiest way, since you've already got the file path in a Unix-like syntax, is to use the FileMaker Perform AppleScript step, using a calculation, using the do shell script "" command. The FileMaker calculation would look like this (weird stuff is to add quotes where needed, and escape spaces in the path (which Unix does not like). "set unix_path to quoted form of "/volumes" & FilePath & """ & ¶ & "do shell script "open " & unix_path" You could create a calculation field, so you could see the result. Or you can just attach it directly to a button, as it's a single step script (but then you need the table occurrence with the field name; don't worry, it'll tell you). Unix paths are case sensitive (unless it has options otherwise, and this one doesn't seem to). It will open with the default program, according to LaunchServices; much the same as telling the Finder to open the file. If you want to open files with specific applications (different from the default), then you have 2 choices. 1. Use the above using the "-b" option with the "bundle_identifier" of the application,* or, 2. Rewrite the AppleScript calculation to tell the application to open it. You would need to recalculate the file path to be "Mac" style, ie.: volume name:folder paths:file.ext Let ( mac_path = Right ( Substitute ( FilePath; "/"; ":"); Length (FilePath) - 1); "tell application "Preview"" & ¶ & "activate" & ¶ & "open " & Quote ( mac_path ) & ¶ & "end tell" ) The above is kind of pointless, as Preview is the default, but you get the idea; tell the application to open it; could be the Finder (but in that case the Unix is sorter). *The bundle identifier of Preview is "com.apple.Preview", FileMaker's (10 Advanced) is "com.filemaker.client.advanced" Open_wAS.fp7.zip Edited October 22, 200916 yr by Guest Added file
Create an account or sign in to comment