Today we are making bBox, our toolbox of external functions for FileMaker, freely available to all FileMaker developers. Use it to extend the reach of your FileMaker solutions to resources outside of FileMaker by launching and communicating with other programs, utilizing the powerful commands built-in to Mac OS X, and easily creating, processing, and managing files.
What functions does it provide?
- execute shell scripts, with the output returned as the function’s result
- execute AppleScripts within a calculation, with parameters and the return value as the function’s result
- filter text through grep, the powerful pattern matching command
- return the current time with milliseconds
- sort lines of text (optionally allowing you to specify a column or character range)
- find out what types of data are currently in the clipboard
- get path type (file or directory), file size, creation, modification and last date opened, POSIX permissions
What can I do with it?
- extract emails or phone numbers from text
- run perl, php, python, or ruby based scripts
- check if a file is present
- strip duplicate values from a return-delimited list
- present a dialog asking user to select a file or choose from a list of values
- determine if a needed type of data is in the clipboard
- execute a command requiring admin authentication
- time execution of scripts down to the millisecond
Requirements
- Mac OS X 10.4 or higher
- FileMaker 8 or higher
Download
bBox_0.3c [no longer available]
Functions & Usage
bBox_Applescript (mode; script {; handler; param1; param2 } )
Compile and run an Applescript script, using the script’s return value as the the function’s result.
- parameters
- mode: currently not used
- script: a string that will evaluate to a valid Applescript script
- handler: optional handler (subroutine) name that should be called
- param1: optional string parameter to be passed to handler
- param2: second optional string parameter to be passed to handler
- result
- data returned by the Applescript script
bBox_ApplescriptLastError()
Get the error code returned from the last executed Applescript script.
- parameters
- none
- result
- error code returned from execution of last Applescript script
bBox_CurrentTime( {format} )
Return the current time as a string, with up to a millisecond of precision.
- parameters
- format = optional printf format string. The default format string is “%d:%02d:%02d.%06d”
- result
- the formatted time string
bBox_DoScript (filename; scriptname ( {parameter} )
Run the given FileMaker script
- parameters
- FileMaker file containing the script
- name of script to run
- parameter to pass to script (not yet implemented)
- result
- none — but you may use Get (ScriptResult)
bBox_FileStatus (filepath)
Get information about a file or folder.
- parameters
- filepath: Unix file or directory path
- result
- file size, type, POSIX permissions, and access information as given by the command stat.
bBox_Grep ( mode; text; param1 {; param2; param3}; )
Execute a grep command to search text for one or more patterns. Patterns may be in a form similar to Unix glob patterns (basic regular expressions), or using extended regular expressions.
- parameters
- mode:
- 0 = convert both input and output line endings
- 1 = skip conversion of carriage returns (the FileMaker end-of-line marker) to new lines
- 2 = skip translation of new lines in shell output to carriage returns
- 3 = don’t translate input or ouput line endings
- text = input text to be processed (this may be set to “” if passing a file path as one of the parameters)
- param1 = normally the search string, but can also contain command option(s) or file path
- param2 = optional command option(s) or file path
- param3 = optional command option(s) or file path
- mode:
- result
- output returned by grep
bBox_PasteboardGet ( item; flavor )
Return the clipboard contents from the given pasteboard item and given pasteboard flavor. The flavor is only available if it is already present or has been promised to the Pasteboard Manager, so you may need to use bBox_PasteboardFlavors first to determine if the flavor you want is available.
- parameters
- item: which item to get data from (typically 1)
- flavor: the UTI code (such as public.rtf
- result
- ? if the flavor is unavailable, or the given clipboard item as text
bBox_PasteboardFlavors ( {itemIndex} )
Get current types of data in the clipboard.
- parameters
- itemIndex: optional parameter, used when more than one item is in clipboard
- result
- UTI codes for the available flavors. See http://developer.apple.com/qa/qa2005/qa1406.html for some commonly used codes.
bBox_Shell (mode; script)
Execute the given script text with the Unix shell.
- parameters
- mode:
- 0 = convert both input and output line endings
- 1 = skip conversion of carriage returns (the FileMaker end-of-line marker) to new lines
- 2 = skip translation of new lines in shell output to carriage returns
- 3 = don’t translate input or ouput line endings
- script: string to be evaluated by the shell
- mode:
- result
- string returned after executing the shell command
bBox_ShellExitStatus()
Returns the exit status from the last shell command
- parameters
- none
- result
- exit status returned from execution of last shell script
bBox_Sort (mode; input, param1 {; param2; param3}; )
Sort the new line (n) delimited values using the sort command.
- parameters
- mode:
- 0 = convert both input and output line endings
- 1 = skip conversion of carriage returns (the FileMaker end-of-line marker) to new lines
- 2 = skip translation of new lines in shell output to carriage returns
- 3 = don’t translate input or ouput line endings
- param1: sort command option or file path, or “”
- param2: 2nd sort parameter or file path (optional)
- param3: 3rd sort parameter or file path (optional)
- mode:
- result
- string returned after executing command
License & Support
This plug-in is provided free of charge to the FileMaker community. See the license information included in the disk image for further details.
Since this is a free product, we only provide support or customization for an hourly fee. But you are welcome to send your comments and suggestions to us using the contact us page or info@beezwax.net, and we may be able to work these in to our later releases.
If you use this in your FileMaker solution, please let us know. We’d love to hear how it’s being used.
Note: changed download link to point to current download page