New version of bBox FileMaker plugin

One of my work/personal projects has been a FileMaker external plug-in for the Mac OS called bBox. The main push with this recently has was to include access to the Python scripting language. Previously, using bBox’s existing bBox_Shell function I could’ve called a Python script this way:

Set Variable [ $script; Value:”xs = ‘He’ + ‘llo’; print xs # Complicated way to say hello” ]

Set Variable [ $res; Value:bBox_Shell( 0; “python -c \”” & $script & “\””) ]

Show Custom Dialog [ Title: “Python”; Message: $res; Buttons: “OK” ]

That’s definitely do-able. But you’ll likely have to reformat your scripts, and be careful about quoting or escaping characters. Alternatively, you could first ensure that your script had first been saved out to a file, perhaps by using FileMaker’s Export Records command.

But instead, I can now write something like the following from a FileMaker script:

Set Variable [ $script; Value:”# Complicated way to say hello. xs = ‘He’ + ‘llo’

print xs “]

Set Variable [ $res; Value:bBox_PythonCompile( 0; $script ) ]

If [ $res = “” ]

Set Variable [ $res; Value:bBox_PythonExecute( 0 ) ]

Set Variable [ $ig; Value:bBox_PythonFinalize ]

End If

You may be wondering why it takes three function calls to execute such a simple script. There are three reasons for this. Most obviously, a script can be executed multiple times but only needs to be executed once. A related, but less obvious reason is the need to setup and then teardown the Python environment, which is significant for a short script like this. Finally, it allows the option of setting or retrieving Python variables from FileMaker, which can now be done with the bBox_PythonSetVar and bBox_PythonGetVar functions.

bBox FileMaker plug-in for AppleScript, shell, grep, etc.

Finally got a new version of my FileMaker plug-in going with a feature that I’ve been waiting for a long time — the ability to pass parameters to AppleScript without having to resort passing data through FileMaker globals or other craziness. The best place to find it right now is:

http://buzz.beezwax.net/2009/03/19/bbox-filemaker-plug-in-easily-add-applescript-shell-grep-and-more-to-your-filemaker-projects

Since it’s already described there I won’t be going into great detail about it. But I do plan on posting some comments on how to make good (or unexpected) use of it .

Here’s my first easter-egg. In the shell section of the demo file, I’ve put in some of the Safari preference snippets that I mentioned in Hidden preferences, files, and URLs in Safari. Eventually I may get them all in.