Fun with fortune and FileMaker Pro

Feb 22, '02 09:09:02AM

Contributed by: tochoa

Went to a conference this last week, and ran the registration booth. It was a small conference so I only needed to make badges for about 30 late registrants - over three days. That left a lot of time fiddling about. So, as most bored users will do, I fired up fortune in terminal.

But whenever I was interrupted (ahem) for actual work, I was switching back to Filemaker. Realizing that I could probably send output to Filemaker and eliminate the switching, I womped up the following.

In Filemaker, made a global text field, named fortune. Then added a FileMaker Pro script with this AppleScript:

set textResult to [do shell script "/sw/bin/fortune"]
tell application "Filemaker Pro"
set cell "fortune" of current record to textResult
end tell
I've got a fink installation, so your path to fortune may vary. I set a button on the FileMaker layout to trigger the script and added the fortune field on the screen with a monotype font and a scrollbar (for longer fortunes). It was a great conversation starter; people were actually hanging out just to read them, and we had a lot of fun when I changed the switch to fortune -o. ;)

I know this sounds like a completely useless geegaw, but just think about how much more powerful FileMaker can be reading results from grep with this simple AppleScript syntax. More fun to follow.

Comments (3)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20020222090902550