Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How to Script an "Open Folder" On Mac

Featured Replies

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

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 by Guest

  • Author

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.

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.

  • 1 month later...

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

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

I knew it was something simple like that. Thank you, much appreciated.

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.