Blaze Posted February 27, 2008 Posted February 27, 2008 I'm trying to script a command to open a folder on the Mac My PC solution just uses a send event which works just fine, but does nothing on the mac. I'm setting a variable that is the $Filepath and passing that to the send event open document script command but nothing happens. Any ideas - maybe an apple script (something I'm not competent in at all) Thanks
Fenton Posted February 27, 2008 Posted February 27, 2008 (edited) Well, the AppleScript can be as simple as: tell application "Finder" activate open "Macintosh HD:Users:fej:Desktop:Registrations xml:" end tell The "activate" above brings the folder to the front; otherwise it opens behind FileMaker's window. You would need to put this in a Perform AppleScript step, by calculation, with the path produced from a field (I suppose, I don't know whether your folder path is static or dynamic). You have to escape the quote marks, by preceding with a backslash; i.e., the result must look like the above. Notice a folder path ends in ":". You can see that the AppleScript file path syntax is not the same as FileMaker's (nor Unix, nor Windows). But it's pretty easy to convert a FileMaker syntax path to AppleScript's syntax. Just take off the "filemac:/" and Substitute "/" with ":". The drive name, "Macintosh HD", may differ on different machines, as it is user-editable. You can use one of FileMaker's functions to get it, like Get ( DriveName ), Get ( DocumentsPath ) or Get ( DesktopPath ). Alternatively, you can use OpenURL, with a path like this (yes, 3 "///"): "file:///Users/fej/Desktop/Registrations xml/" Edited February 27, 2008 by Guest
Blaze Posted February 27, 2008 Author Posted February 27, 2008 I just knew the venerable Fenton (maybe it should be "fountain" considering the widsom you pour out on this forum) would arrive with the solution. Ah yes, the /// is what did me in on the open url approach I tried opening the finder as a script command but not in the apple script. That went nowhere also. As always, thanks a million Fenton.
Fenton Posted February 27, 2008 Posted February 27, 2008 Yes, I think it's 2 slashes on Windows. I read somewhere that according to the "rules", it should really be 3 for a local file.
Brett W Posted April 7, 2008 Posted April 7, 2008 Is there a simple way to simply open the file path in a finder window. I don't want the actual file to open, just take the user to the location in a new finder window. Something like this: set test to alias "Macintosh HD:Users:brett:Documents:Mileage:2007.10.3 TDS Mileage.xls" tell application "Finder" activate open (path to test) end tell
Fenton Posted April 7, 2008 Posted April 7, 2008 The cutest way is to use the "reveal" command. If you have the file path, it will open the folder, then highlight the file. set test to alias "Macintosh HD:Users:brett:Documents: Mileage:2007.10.3 TDS Mileage.xls" tell application "Finder" activate reveal test end tell
Brett W Posted April 7, 2008 Posted April 7, 2008 I knew it was something simple like that. Thank you, much appreciated.
Recommended Posts
This topic is 6072 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