Brian Dunning's FileMaker Custom Functions

cf_MacPath_AppleScriptPath ( _path )

Formatting from Mac path to AppleScript path

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

Edward Souza   Edward Souza
Duana A. S. Designs
http://none

Share on Facebook Share on Twitter

  Sample input:
_path = PowerBook/Users/Music/Audios/44kHz_by_24bit/I Love You.mp3
  Sample output:
"I Love You.mp3" of folder "44kHz_by_24bit" of folder "Audios" of folder "Music" of folder "Users" of "PowerBook"

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

My challenges:
- I am rather new to FileMaker;
- I'm developing a solution that requires AppleScript scripting to access external files and data (each record has an unique path embedded, and so far the solution has about 43030 records)
- Needed to change the Mac formatted path into Applescript format;
- Was doing it via loop script steps, but knew it could be done with a recursive custom function

Some time ago, I left in here a FM script (quite asinine, I know), hoping someone would spend some time into it and perhaps turn it into a recursive custom function. No one seemed interested, hence I decided to try it myself.
The cf is quite straightforward; the variable "_path" is a Mac or Unix formatted path, and the result is something an AppleScript will understand. Please feel free to improve it, if you wish.

 

Comments

unix   unix, Japan
Feb 22, 2015
You don't need to convert it, use unix path in Applescript like as
posix file "/PowerBook/Users/Music/Audios/44kHz_by_24bit/I Love You.mp3"
 

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: