Brian Dunning's FileMaker Custom Functions

AS_ChooseFile ( _resultTOGlobalCellName ; _prompt ; _defaultLocation ; _extensionVL )

MAC ONLY. Generates applescript to choose file & returns result

  Average rating: 4.8 (29 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_ChooseFile ( "TO::FieldName" ; "Choose a file please..." ; "/Macintosh HD/Users/Shared/" ; "csv¶jpeg¶jpg" )
  Sample output:
Brings up choose file dialog at default location specified (limits selection to list if specified)

Returns full file path for file:
"Macintosh HD:Users:Shared:tmp:fileOfMyChoice.csv"

Result is returned either to global field specified or to clipboard so a simple paste will do the job.

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

cousin to AS_Choosefolder

Uses Applescripts' Choose File dialog

Allows you to filter by filetype. I've not bothered implement choosing multiples/invisibles.

 

Comments

Thomas Seidler   Thomas Seidler, London
Apr 24, 2012
I've just been using this myself, and for some reason it's not working, so had to change _defaultLocation line thus:

_defaultLocation = Case ( IsEmpty(_defaultLocation) ; "" ; Position ( _defaultLocation ; ":" ; 0 ; 1) or Position ( _defaultLocation ; "/" ; 0 ; 1); "\"" & Substitute ( ":" & _defaultLocation & ":" ; ["::"; ":"] ; [":" ; "/"] ; ["//"; "/"]) & "\"" );

bit of a pain, thought i'd thoroughly tested it, but maybe i changed system since i last used it...
 

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: