Perform Script
Purpose 
Performs a script that is defined in the current file or in another FileMaker Pro file.
Format 
Perform Script [“<script name>; Parameter: <parameter>]
Options 
To select a script, click Specify and choose the script from the list.
For Optional script parameter, type the text you want to use or click Edit and use the Specify Calculation dialog box to build a more complex parameter.
Compatibility 
 
Where the script step runs 
Supported 
FileMaker Pro 
Yes 
FileMaker Server scheduled script 
Yes 
FileMaker Go 
Yes 
Custom Web Publishing 
Yes 
Instant Web Publishing 
Yes 
Runtime solution 
Partial 
Originated in 
FileMaker Pro 6.0 or earlier
Description 
There is no need to open an external file when using a script in it—FileMaker Pro opens it for you.
You can use separate scripts to break complex tasks into smaller segments, which are often easier to troubleshoot. You can also save time by putting common tasks like printing or exporting records into separate scripts, which can then be accessed by more than one script. For example, you might want to use the same page setup and printing options in several scripts. By defining those steps once and saving them in separate scripts, you make it easy to access those steps many times.
Use script parameters to pass text or numbers into a script. When a parameter is specified, that parameter may be accessed within a script or passed to other script steps using the Get(ScriptParameter) function.
Script parameters:
 •
exist within the parent script only unless explicitly passed to the sub-script, as shown in examples three and four below. If your script calls another script, parameters in the called script are independent of parameters in the parent script.
 •
 •
can be used (but not modified) within a script and can be passed along to sub-scripts by using the Get(ScriptParameter) function as the parameter for the sub-script. You can also specify different parameters each time the sub-script is called using Perform Script. Changing the parameters passed to a sub-script does not modify the value of the parameters returned from Get(ScriptParameter) in the parent script.
 •
Tip  If you've performed an external script and you want to return to the original file, add an Enter Browse Mode step or Go to Layout step right after the Perform Script step in the original file, so that the script returns to the original file.
Notes
 •
If you are using FileMaker Pro Advanced to define a custom menu item that performs a script, select the script and optional script parameters. For more information, see Defining custom menus (FileMaker Pro Advanced).
 •
 •
Examples 
#Example 1: This is a simple example with no parameters
Go to Layout ["Detailed Report"]
Perform Script ["Print in Landscape"]
#Example 2: This example uses the script parameter to set the
title of the report
Go to Layout ["Detailed Report"]
Perform Script [“Sort by Date”; Parameter: “Month End Report”]
Set Field [Sales::Report Title; Get (ScriptParameter)]
Perform Script ["Print in Landscape"]
#Example 3: This example uses a field value as a parameter
Go to Layout ["Detailed Report"]
Perform Script [“Find by Salesperson”; Parameter: Sales::Salesperson]
Set Field [Sales::Report Title; “Sales by “ & Get (ScriptParameter)]
#Example 4: This script uses script parameters to pass text
entered by the user to another script, which creates a new account
Fields
account_name Text Global Storage
password Text Global Storage

Script: Get New Account Info
#Clear the Account Name and Password fields for new information
Set Field [ first_table::account_name; "" ]
Set Field [ first_table::password; "" ]
Show Custom Dialog [ Title: "Create A New Administrator Account";
Message: "Please enter an account name and password for your new user.";
Buttons: “OK”, “Cancel”; Input #1: first_table::account_name; Input #2:
first_table::password ]
Perform Script [ “Make New Account”; Parameter:
first_table::account_name & ¶ & first_table::password ]
Script: Make New Account
Add Account [Account Name: LeftValues( Get( ScriptParameter ); 1);
Password: LeftValues( Get( ScriptParameter ); 2); Privilege Set:
"[Data Entry Only]"]
Related topics 
Perform Script and script parameter example
Script steps reference (alphabetical list)
Script steps reference (category list)
Defining custom menus (FileMaker Pro Advanced)
About formulas