Newbies Operaghost1 Posted September 12, 2007 Newbies Posted September 12, 2007 I have a container field which contains a file reference, and another field that displays the path to that external file. I'd like to make a script (button) which simply reveals the original external file in the OS X Finder. A calculated Applescript may be the answer but I have no idea as to syntax. Suggestions??
Fenton Posted September 12, 2007 Posted September 12, 2007 (edited) Once you have a Mac syntax file path (which you can calculate if needed), then it's fairly simple. You have to get the quotes and returns right in the calculation. If the Mac path is in a field called "Filepath": "tell application "Finder"¶ reveal file "" & Filepath & ""¶ activate¶ end tell" A Mac path looks like: "Macintosh HD:Users:fej:Documents:some file.txt" I imagine there's a Unix command for this also, but I can't remember offhand; I always use the above. Maybe the Unix command would be to just open the folder, which works. But the above also scrolls to and highlights the file, which is a nice touch. Edited September 12, 2007 by Guest
Newbies Operaghost1 Posted September 15, 2007 Author Newbies Posted September 15, 2007 That's great. Thank you very much. But I'm really struggling to turn a FM path into an HFS path. I found a custom function online called FilePathToHFS but I can't get it to work and it doesn't seem to deal with the fact that FM gives you BOTH windoze and mac filepaths. So any suggestions as to a formula or algorithm that can convert FM paths to HFS paths?
Søren Dyhr Posted September 15, 2007 Posted September 15, 2007 http://www.satimage.fr/software/en/file_paths.html http://www.briandunning.com/cf/743 --sd
Fenton Posted September 15, 2007 Posted September 15, 2007 I worked out some calculations for this. They are kind of long, so I'm just going to upload an example file, which I built for displaying images via a calculation, no matter which platform inserted them. It may not work in all situations, but the calculations are in there. The _cOS_FilePath is the relevant one. But it depends on 2 others, for the Drive and the Volume name. RemoteImage_MacPC_calc.fp7.zip
Newbies Operaghost1 Posted September 15, 2007 Author Newbies Posted September 15, 2007 Thanks Fenton!!! That file will be invaluable. In the meantime I came up with this formula to translate FM paths into Applescript-friendly paths: Substitute ( Right ( Location_path ; (Length ( Location_path )-(Position ( Location_path ;"filemac" ; 1 ; 1 )+8) )) ; "/" ; ":" ) It finds the string "filemac" and deletes it and everything before it, then substitutes colons for slashes. Fancy huh? At least it works...for my mac users anyway... Many thanks again.
Recommended Posts
This topic is 6279 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now