Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

Reveal in Finder


Operaghost1

This topic is 6195 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies

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??

Link to comment
Share on other sites

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 by Guest
Link to comment
Share on other sites

  • Newbies

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • Newbies

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.

Link to comment
Share on other sites

This topic is 6195 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.