Brian Dunning's FileMaker Custom Functions

AS_ChooseFolder ( _resultTOGlobalCellName ; _prompt ; _defaultLocation )

MAC ONLY. Generates applescript to choose folder & returns result

  Average rating: 4.5 (35 votes) Log in to vote

ThomasSeidler   ThomasSeidler - Show more from this author
The Good Book Company Ltd
http://www.thegoodbook.co.uk

Share on Facebook Share on Twitter

  Sample input:
Perform Applescript ( AS_ChooseFolder ( "TO::GlobalCell" ; "Choose a folder:" ; "path to desktop folder" ) )

OR

Perform Applescript ( AS_ChooseFolder("" ; "" ; "Macintosh HD/Users/Shared/") )
  Sample output:
After choosing folder dialog, TO::GlobalCell will be set to
"Macintosh HD:User:Shared:tmp:"

Alternatively, if no cell name provided, the clipboard will be set to the result. So a simple paste will allow access to data.

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

_resultTOGlobalCellName must be the full reference (i.e. including TO) for a global field. [Thanks to Bruce Roberston for tip to use global fields, it's much better: doesn't have to be on layout as other fields do.]

Uses Applescript Choose Folder dialog to allow this functionality in FileMaker.

29 Sept 2011: updated to include prompt string and default location.
24 April 2012: updated to fix filepath result (cf update to AS_ChooseFile

 

Comments

Sali   Sali, Hamburg
Feb 25, 2012
thanks a a lot! it works great
 
Conrad   Conrad, Sydney
Jan 25, 2013
Works well... until the user cancels the action in the finder dialogue box. Needs some extras to account for a cancel.
 
Dominique   Dominique, Ottawa, Canada
Apr 8, 2014
Great function!!! I love when I have client that are Mac only and I can use AppleScript!

To trap for user pressing cancel. Add the ScriptStep "Set Error Capture(On)" before running the applescript than if the return path is empty , stop everything because the user cancel.

If you don't add the Set error capture(On) FileMaker will return 2 msgbox.

Cheers
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 20 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: