Automating tasks with scripts > Creating and editing scripts
 
Creating and editing scripts
Note  For information on each script step, its options, and examples, see Script steps reference (alphabetical list) and Script steps reference (category list). For more example scripts and further help, see Script examples and the FileMaker Community.
To create or edit a script:
1. Choose Scripts menu > Script Workspace.
Or, choose File menu > Manage > Scripts.
The Script Workspace opens. You create and edit scripts using the three panes in this window—the scripts pane (left), the script editing pane (center), and the script steps pane (right).
2. Create or open a script:
To create a script, click New Script button. In the script editing pane, type a name for the new script and press Enter or Return.
To preview a script, click the script name in the scripts pane. Click Switch to Edit button to switch from previewing to editing the script.
To edit a script, double-click the script name in the scripts pane. If the script is already open in the script editing pane, click the script’s tab to make it active.
3. Begin typing a script step name, then choose the script step from the list that appears.
Or, double-click the script step in the script steps pane.
4. If the script step has options—indicated by text enclosed in brackets ([ ]) or by Action menu next to the script step—do one of the following:
Click the text in the brackets, then specify options that appear.
Click Action menu, then specify options that appear.
Click between the brackets and edit the calculation, or click Calculation button to open the Specify Calculation dialog box. Only some calculations are editable inline.
Note  As you edit a script step, you may see the Restore option. Restore indicates that the criteria you specified when the script step was last edited will be used when the script step is executed.
5. Do any of the following as you work in the script editing pane:
 
To
Do this
Add a line to the script
Do one of the following:
Press Ctrl+Enter (Windows) or Command-Return (OS X).
If no script step options are in focus, press Enter or Return.
If the last line of the script is not blank, select the last line and press Down Arrow.
Add a line above the selected line
Do one of the following:
Press Ctrl+Shift+Enter (Windows) or Command-Shift-Return (OS X).
If no script step options are in focus, press Shift+Enter (Windows) or Shift-Return (OS X).
Move between lines in the script
Press Up Arrow or Down Arrow.
Add a comment to a script
On a blank line, type # or choose Comment from the script steps pane. Using the Comment script step in your script helps others who view or modify it.
Add a script step to the Favorites category
In the script steps pane, select the script step and click Gray star button. To remove a script step from the Favorites category, select the script step and click Blue star button.
Note  You can’t add a script step to the Favorites category if the script steps pane is sorted alphabetically.
View information about a script step
In the script steps pane, select the script step. A brief description of the script step appears in the Help pane. To view more information about the script step, click Help button.
View script steps alphabetically or by category
In the script steps pane, click Alphabetical sort button to display script steps alphabetically, or click Category sort button to list by category.
See which FileMaker products support a script step
Click Compatibility button and choose a product. All scripts steps that are compatible with the product are displayed.
Copy and paste a script step
Duplicate a script step
Select the script step, then choose Edit menu > Duplicate (Windows) or Duplicate Step (OS X).
Delete a script step
Select the script step, then press Delete.
Reorder the script steps in the script
Drag the script step in the script editing pane to a new location in the script.
Select multiple script steps
Press Ctrl-click (Windows) or Command-click (OS X). You can add, duplicate, or delete multiple steps.
Run the script
Click Run Script button.
Note  An asterisk (*) next to a script name means that the script has been changed but not saved.
6. Close the tab, then click Save.
Or, choose File menu > Save Script in the Script Workspace (Windows), or choose Scripts menu > Save Script in the FileMaker Pro menu bar (OS X).
7. Create additional scripts, or close the Script Workspace.
To manage scripts:
 
To
Do this
Rename a script
Do one of the following:
Right-click the script name and choose Rename.
In the script editing pane, double-click the script name.
Duplicate a script
Right-click the script name and choose Duplicate.
Delete a script
Right-click the script name and choose Delete.
Reorder the scripts
Drag the script name to a new location in the list.
Print a script
Windows: In the Script Workspace, choose File menu > Print Script.
OS X: In the FileMaker Pro menu bar, choose File menu > Print.
In the Print dialog box, select your options, then click OK (Windows) or Print (OS X).
Perform a script with full access privileges
Right-click the script and choose Grant Full Access Privileges. See "Running scripts with full access privileges," below.
Manage folders in the scripts pane
Running scripts with full access privileges
Setting a script to run with the full access privileges enables users with limited access and privileges to perform scripted tasks that they would otherwise be unable to perform, such as exporting or deleting records. Keep the following points in mind:
The access privileges do not change, but the script is allowed more privileges than the user is. Furthermore, full access does not carry over to any subsequent sub-script, unless this feature has been enabled in that script as well.
Scripts can be set to run with full access privileges only by users with the full access privilege set. Only users with full access privileges can edit or delete scripts for which this feature has been enabled.
A script can run with full access privileges only in the file in which the script is defined. Scripts cannot override access restrictions on external files. For example, a script that is set to run with full access privileges cannot delete records in an access-restricted external file.
Users without full access privileges can be given permission to edit scripts that are marked as modifiable in their assigned privilege set. Full access privileges are required to create, duplicate, import, and/or delete scripts.
Notes
To check for problems as you build a script, right-click the tab in the script editing pane and choose Check for Problems. FileMaker Pro checks the script and highlights lines with problems, such as missing parameters. (Not every problem can be detected.) Lines are highlighted in the default Problem color in the Syntax Coloring tab of the Script Workspace preferences.
To edit the color coding of script steps and conditions such as problems, in the Script Workspace, choose View menu > Preferences (Windows) or View menu > Script Workspace Preferences (OS X) and click the Syntax Coloring tab.
To edit a script in a new window, right-click a tab in the script editing pane and choose Move Tab to New Window, or press Alt (Windows) or Option (OS X) and double-click a script in the scripts pane. The script opens in the Edit Script dialog box.
To allow the script to do things that normally may not be allowed by the user’s assigned privileges, choose File menu > Grant Full Access Privileges (Windows) or Scripts menu > Grant Full Access Privileges (OS X).
If you accessed the Edit Script dialog box by converting a button action to a script, you can press Ctrl+R (Windows) or Command-R (OS X) to rename the script.
Related topics 
Copying and pasting scripts
Using operators in formulas
Script steps reference (category list)
Script steps reference (alphabetical list)
Working with buttons and button bars on layouts
Working with the Scripts menu
Editing scripts privileges
Publishing databases on the web
Debugging scripts (FileMaker Pro Advanced)
Disabling script steps (FileMaker Pro Advanced)