Perform Script and script parameter examples
Perform Script performs a script that is defined in the current file or in another FileMaker Pro file.
Optional script parameters can pass text into a script. For example, you can use a script parameter to store the active record number when a script is initiated, making it easy to return to that record at the end of the script. Or you can call the same script from different buttons on the same layout, and easily determine which button called the script by using a different script parameter for each button.
When you specify a parameter, you can access it within a script or pass it to other scripts using the Get(ScriptParameter) function.
Complex parameters, such as a list of names or other values, can also be used. Complex parameters that are separated by carriage returns can be parsed using the LeftValues function, MiddleValues function, and RightValues function. These functions return the beginning, middle, and ending values from lists that are separated by carriage returns. Complex parameters separated by other characters can be parsed as text using functions such as Left function, Middle function, and Right function.
Example 1 
Runs the "Print Invoice Report" script with no parameters.
Go to Layout ["Invoice Report"]
Perform Script ["Print Invoice Report"]
Example 2 
Uses a field, Customer Name, as the parameter. Invoices for the current customer are returned in a new window with the Invoice Report layout.
Main script: Current Customer Invoices
Find Matching Records [Replace; Invoices::Customer ID]
#Calls the "View Customer Invoices" sub-script defined below
Perform Script ["View Customer Invoices"; Parameter: Invoices::Customer Name]
Sub-script: View Customer Invoices
New Window [Name: "Customer: " & Get ( ScriptParameter ); Style: Document]
Go to Layout ["Invoice Report"]
Sort Records [Restore; No dialog]