Brian Dunning's FileMaker Custom Functions

EscapeForOsascriptShell ( escapeThis )

Escapes a value so that it can be used in a nested AppleScript/shell/AppleScript command

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

Daniel A. Shockley   Daniel A. Shockley
NYHTC
http://www.nyhtc.org

Share on Facebook Share on Twitter

  Sample input:
EscapeForOsascriptShell ( "single-quote: 'Today is the day' - done" )


EscapeForOsascriptShell ( "double-quote: \"Hello World\" - done" )
  Sample output:
single-quote: '\\''Today is the day'\\'' - done
double-quote: \\\"Hello World\\\" - done"

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

Escapes a string or number so that it can be used in a Perform AppleScript that runs a "do shell script" that uses the osascript command to then run the AppleScript.
Reason? It means that you can send an AppleScript command to an external applet that does not wait for a response, which means the FileMaker script will no longer be locking up FileMaker, preventing that external script from working with FileMaker.
For more, see the following: http://forums.filemaker.com/posts/df3f5b2f9e

Basically, this aids in using a work-around for the fact that "Send Event" is broken in recent Mac OS X versions and that you can't have "Perform AppleScript" ignore the results and continue the script without waiting for the AppleScript to finish.

 

Comments

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: