What can I do with it?
Use the Do Script event to trigger a script in the FileMaker Pro Scripts menu.
To use the Do Script event you need to provide an object specifier for a script, like FileMaker script 1, or last FileMaker script, or FileMaker script "Print Sales Report". (You must always refer to a script object as FileMaker script <x>; the word "FileMaker" is part of the name of the object.)
You may find it useful to write a script that restores complex finds, sorts, import orders, and page setups, and then call the script to do the work for you, particularly if printing is involved. For example, FileMaker Pro scripts have the ability to restore page setups a feature that is not available to Apple events.
Note: the Do Script event is successfully completed when the FileMaker Pro script begins. Because FileMaker Pro is unable to process Apple events while a ScriptMaker script is running, it is possible to receive a timeout error when sending events to FileMaker Pro after sending a Do Script event. Here are some suggestions to help avoid timeouts:
1) lengthen the timeout period (the default is 60 seconds) using a statement such as with timeout of 600 seconds
2) implement a flow control mechanism by using ScriptMaker to send an event to the applet to continue with the next Apple event to FileMaker Pro.
3) use a routine to continuously send events to FileMaker Pro and continue only when FileMaker Pro is ready. Call the WaitUntilReady routine after sending the Do Script event and before sending another event to FileMaker Pro. Here is an example of such a routine:
on WaitUntilReady()
with timeout of 5 seconds
repeat
try
tell application "FileMaker Pro" to get version
return
on error number errnum
end try
end repeat
end timeout
end WaitUntilReady
Note: Since only one ScriptMaker script can be run at a time, any scripts called using the Do Script event when running your AppleScript using the Perform AppleScript ScriptMaker step will get executed after the ScriptMaker script has completed.
Examples
You can say: If you want to perform:
tell application "FileMaker Pro"
do script FileMaker script 1 -- the first script
do script last FileMaker script -- the last script
do script FileMaker script ¬
"Print Sales Report" -- a script by its name
do script FileMaker script after ¬
FileMaker script 1 -- the second script
do script FileMaker script before ¬
FileMaker script 3 -- the second script
do script (every FileMaker script ¬
whose name begins with "aName") -- all scripts meeting a test
end tell