Brian Dunning's FileMaker Custom Functions

AS_FolderPathListing ( _resultTOGlobalCellName ; _folderPath ; _extensionVL )

MAC ONLY. Generates Applescript to obtain folder listing & returns result as ValueList.

  Average rating: 4.7 (31 votes) Log in to vote

Thomas Seidler   Thomas Seidler
Harmlesswise.com
http://www.harmlesswise.com/it

Share on Facebook Share on Twitter

  Sample input:
Perform Applescript ( AS_FolderPathListing ( ":Macintosh HD:User:Shared:tmp:" ; "MyTable::GlobalField" ; "jpg¶jpeg" ) )

Perform Applescript ( AS_FolderPathListing ( "/Macintosh HD/User/Shared/tmp/" ; "" ; "" ) )
  Sample output:
MyTable::GlobalField =>
File1.fp6
File2.rtf
FIle3.jpg
etc

[If _resultTOGlobalCellName blank, the result will be set to clipboard, so pasting into field is the option]

  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.

29 Sept 2011 - updated to handle file extension value list filter. By default unfiltered.

 

Comments

Bruce Robertson   Bruce Robertson
Sep 15, 2011
Regarding having the field on the layout - I strongly prefer to use global fields to receive applescript results. Global fields do NOT need to be on the layout and do not need a reference to the current record. You only need a table (table occurrence) reference. Example:

set cell "gResult" of table "Contacts" to "whatever"
 
Thomas Seidler   Thomas Seidler, London, UK
Sep 16, 2011
Nice Bruce! As ever I can always learn from you, that's much much better. Yes, so we switch to global fields and away! Thank you sir! I will make the corrections to the function shortly...
 
Ian Mazursky   Ian Mazursky, New Rochelle, NY
Sep 26, 2011
Hi Thomas!
Thanks for the CF. I was wondering if it was possible to extend it to list subfolders also?

Thanks,
Ian
 
Thomas Seidler   Thomas Seidler, London, UK
Sep 27, 2011
hi Ian, that's easily done within FM itself. Just create a loop that does it... gets listing for folderPath, then for each member of listing, requests listing with path folderPath & member. And so on...

How would you want the data ideally? Value list of strings?

It can be done, might hack it at some point if i find a need. If someone else wants to and submits code to me, i'll alter and give credit. http://macscripter.net/viewtopic.php?id=11362 That's an old way, apparently tis easier now. But no time...
 

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.

Under construction. Email me your wish list for improvements.