Last year I was hired to automate picture taking for a badge creation Filemaker database. Thanks to a free utility by Axel Bauer, a MacOSX CLI Utility to Capture Stills From iSight Camera", this turned out to be quite easy with the following tiny applescript:
tell application "Terminal"
do script "/Applications/isightcapture myimage.jpg"
end tell
Editor’s Note: The original link for Axel Bauer’s script is not live, but the alternative source requires a login so this updated copy has been stored in ScriptBuilders.net under my name. Hopefully, Axel will not object. The link below is to the ScriptBuilders copy.
Just put Axel’s Unix Executable File, isightcapture, somewhere in your Application folder and trigger the applescript.
A jpeg file named myimage.jpg will be created in the top-most level of the active user folder (the one containing your Applications and Documents folders).
You can then either use an AppleScript to set a container field in Filemaker to the graphic:
tell application "FileMaker Pro"
set cell "mygraphic" of current record of database 1 to file "Macintosh HD:Users:youruseraccount:myimage.jpg"
end tell
Or, you can use Filemaker’s built in scripting capability (Scriptmaker under Filemaker’s Scripts menu) to import the file.
You could also trigger a Filemaker script from within an AppleScript with:
tell application "FileMaker Pro"
do script "name of script" -- In Filemaker's Scripts menu
end tell
Be sure before running the AppleScript that the database containing the Filemaker script is the frontmost database.
You could also store the original AppleScript call to Terminal within Filemaker either within the “Perform Applescript” script step of Filemaker’s Scriptmaker, or within a field. If you are using a calculation field, you can specify text to be quoted by using a backslash to escape the quotes the way you would in most languages in the latest version of Filemaker. For example, the above Terminal AppleScript would look like this in a Filemaker Pro calculation field:
tell application \"Terminal\"
do script \"/Applications/isightcapture myimage.jpg\"
end tell
Don’t forget your paragraph breaks!
If you use Filemaker’s older method of two quotes together, then:
tell application "Terminal"
do script "/Applications/isightcapture myimage.jpg"
end tell
The latest version of Filemaker (version 8 in April, 2006) will convert the double-quotes to a backslash.
Filemaker can also store AppleScripts that call itself in all but the oldest versions.
If you prefer external AppleScripts, they can be triggered with Filemaker’s send apple event command from within Scriptmaker.
Happy scripting!
Diana Simonson