Hi
I have a FMP db where I collected various files infos.
One field has the full path of the file
Is there a way to add an Applescript to a FMP script an open it with the finder?
Do I need to copy the text field content to the clipboard and then tell the Finder app to open the file path as it is in the clipboard’
One way, meant to be run from a button on the same layout (eg, “Main”) as the field (eg, “fd”) containing the path of the folder (eg, “Macintosh HD:FolderName:”):
tell application “Filemaker Pro Advanced” – this line is not necessary when run within FMP
tell window 1 – the button is in this window so it is #1
tell layout “Main” – example layout name
set fd to (get data cell “fd” of current record) – field must be on this layout
end tell
end tell
end tell – this matching line is not necessary when run within FMP
tell application “Finder”
activate
open folder fd
end tell
The Filemaker script step “Perform Applescript” with the above Applescript in it should activate the Finder and open the folder when the button is clicked.
Edit: I thought at first you wanted to open a folder. If you give it a file path instead then change the word “folder” to “file” in the next-to-last line.
I can’t remember how I used to do this in AppleWorks spreadsheet or database, but I think I used to use a local file url or maybe a mailto (probably not this though). With the url you can open location.
Edited: think I remember now. Used to add a link I think with the local file url.
Thanks a lot
I changed the script as such as the finder gave me an object not found error
Now it works just fine as FMP script (without the tell FMP line in the FMP script)
tell application "FileMaker Pro Advanced" -- this line is not necessary when run within FMP
tell window 1 -- the button is in this window so it is #1
tell layout "Paths" -- example layout name
set fd to (get data cell "Path" of current record) -- field must be on this layout
end tell
end tell
end tell -- this matching line is not necessary when run within FMP
tell application "Finder"
activate
open fd as POSIX file
end tell