About the Script Step Reference
The script step reference is a detailed guide to all the FileMaker Pro script steps. It is similar in layout to FileMakers online help system, but adds more detailed examples and commentary where possible. The listing for each script step also indicates its platform compatibility, any menu equivalent, and whether the script step is web compatible. A number of web-compatible steps are marked with an asterisk. This indicates that although the step as a whole is web compatible, one or more specific options of the step are not.
For further discussion of custom menus, see Special Edition Using FileMaker 8, Chapter 13, "Advanced Interface Techniques." |
Add Account
Compatibility:
Menu Equivalent: None
Syntax: | Add Account [Account Name: <account name>; Password: ; Privilege Set: " "; Expire password] |
Options:
Account Name is the account name. Literal text can be entered or Specify can be clicked to create a new account name from a calculation.
Password is the new password. Literal text can be entered or Specify can be clicked to create a new password from a calculation.
Privilege Set allows you to assign a pre-existing privilege set for the user or to create a new one. (Full Access cannot be assigned via this script step. Accounts with Full Access must be created manually.)
User Must Change Password on Next Login: When selected, this option forces users to change their password the next time they log in to the database.
Examples: |
[View full width] Add Account [Account Name: "User_Account"; |
Description:
This script step adds an account name, password, and privilege set to a databases security configuration. Account and password text may be defined in a calculation or typed into the script step itself. The account name must be unique, and full access to the file is required to execute this step.
Comments:
It might be desirable to allow access to this functionality via a script if certain users or user groups have limited access to the FileMaker menus because of security configurations. See the Change Password script step for a fuller discussion.
Note that there are circumstances where you should not set an account to force the user to change his password at next login. If the user will not have a direct means to do this, the option should not be set. The best example is an account that will be used to access a FileMaker database via Instant Web Publishing: IWP provides no means for a user to change her password, so this setting will lock the user out of the database. Similarly, if the account is externally authenticated, it may be risky to tie the account to a privilege set requiring that the password be changed at some point, or have a minimum length.
Adjust Window
Compatibility:
Menu Equivalent: None
Syntax: Adjust Window [Resize to fit/Maximize/Minimize/Restore/Hide] |
Options:
Resize to Fit shrinks a window to the minimum possible size while including all layout elements.
Maximize expands the current window to the size of the users screen or the application window in Windows. In Windows, the database window controls and scroll bar will disappear and be incorporated into the application window.
Minimize minimizes the current window to an icon or a minimized window bar at the bottom of the application window in Windows.
Restore returns the current window to the size it was before the last resize.
Hide hides the current database window.
Examples: |
Go to Layout ["Detail"] Adjust Window [Maximize] |
Description:
This script step hides or otherwise controls the size of the current database window. It is important to note that the size and position of a window cannot be relied upon unless one has explicitly set them, or users are explicitly prohibited from modifying them.
Note that in Windows, FileMaker opens all database windows within an application window. The Adjust Window script step will affect only database windows. There are no controls by which a developer can manipulate the application-level window.
Note also that in Windows if a user minimizes or resizes an existing window or opens a new window, any maximized window will be restored to its previous state. In solutions where you expect to use multiple windows, we recommend against using the maximize command.
Allow Toolbars
Compatibility:
Menu Equivalent: None
Syntax: Allow Toolbars [ |
Options:
On allows FileMakers native toolbars to be utilized.
Off hides and makes inaccessible FileMakers toolbars as well as the toolbar submenu options in the view menu.
Examples: |
Allow Toolbars [Off] |
Description:
This script step hides and shows the FileMaker Pro toolbars and menu options. This is often used to control the amount of screen space available in a given database screen. This script step takes effect only while the file that calls this script is active. This option has no effect in Kiosk mode because toolbars are always hidden in Kiosk mode.
Allow User Abort
Compatibility:
Menu Equivalent: None
Syntax: Allow User Abort [ |
Options:
On allows users to halt the execution of a script by pressing the Esc key (or
Off disables the halting of scripts by users.
Examples: |
Allow User Abort[Off] |
Description:
Allow User Abort is used to control the users ability to cancel scripts by using the Esc key (or the
Comments:
If a script involves any processes that could work with large record sets, such as sorting, looping, or running a Replace script step, the user sees a progress dialog for the duration of that operation. If Allow User Abort is on, as it is by default, users can cancel the script and disrupt those operations, leaving them partially complete. If a script contains any process that must not be interrupted before completion, it should use Allow User Abort[Off] to ensure that these processes are able to finish without user interruption.
Arrange All Windows
Compatibility:
Menu Equivalent: Windows (various choices)
Syntax: | Arrange All Windows [Tile Horizontally/Tile Vertically/Cascade Window/Bring All to Front] |
Options:
Tile Horizontally positions open windows from left to right across the screen. They are resized to avoid any overlaps.
Tile Vertically positions open windows from top to bottom down the screen. They are resized to avoid any overlaps.
Cascade Window positions windows overlapping diagonally from upper left to lower right. The idea of this arrangement is, presumably, to allow the reading of the title bar of each window. The windows are resized to fit the available screen space.
Bring All to Front (Mac OS only) brings all open windows to the front without resizing or otherwise moving or rearranging them. In the event that any open FileMaker windows have been hidden by (that is, are behind) any other applications windows, this step ensures that all FileMaker windows are above other application windows.
Examples: |
[View full width] New Window [Name: "Trees"; Height: 200; Width: |
Description:
This script step resizes and/or repositions open windows, but does not affect which window has focus. The active record also remains the same.
Beep
Compatibility:
Menu Equivalent: None
Syntax: Beep |
Options:
None
Examples: |
[View full width] Set Error Capture [On] Perform Find [Restore] If [Get (FoundCount) = 0] Beep Show Custom Dialog ["No records were found that |
Description:
This script step plays a beep noise. The beep is played at the default volume of the machine on which it is played.
Comments:
You may want to use the beep as an extra alert noise. (Weve even heard of an intrepid FileMaker developer, on the road without an alarm clock, who programmed himself an alarm clock in FileMaker with the Beep step.)
Change Password
Compatibility:
Menu Equivalent: File, Change Password
Syntax: | Change Password [Old Password: |
Options:
Old Password is the current accounts current password. It can be the result of a specified calculation or typed in.
New Password is the desired new password for the current account. It can be the result of a specified calculation or typed in.
Perform Without Dialog suppresses the Change Password dialog for this action. Rather than prompting the user for old and new passwords, the script step will use whatever values have been specified and stored with the script step.
Examples: |
The following script uses a custom Change Password dialog, rather than the standard dialog used by FileMaker. |
[View full width] Change Password [Old Password: ldpassw0rd; New |
Description:
This script step changes the password for the current account. By default, a Change Password dialog is displayed unless the Perform Without Dialog option is selected. If Error Capture has been enabled (in the Set Error Capture script step) and Perform Without Dialog is not selected, then the user is given five attempts at changing his password. If Error Capture has not been enabled and Perform Without Dialog is not selected, then the user is given only one attempt at changing the password. Run Script with Full Access Privileges enables a user to change the password for the current account even if she lacks the explicit permission to do so.
Comments:
A number of FileMaker script steps perform functions similar or identical to choices that are available in the FileMaker menus. For reasons of security or solution design, a developer might choose to limit user access to the FileMaker menus. Menu access can be configured differently for each privilege set in a file. If access to menus is limited, it may be necessary or desirable to reproduce some functionality available through menus by creating a scripted interface instead. A user without access to menus might instead then see a Change Password button or clickable link, which invokes the Change Password script step.
When programming for the Web, be sure to select Perform Without Dialog. Leaving the box unchecked is not web compatible and does not work on the Web.
Check Found Set
Compatibility:
Menu Equivalent: Edit, Spelling, Check All
Syntax: Check Found Set |
Options:
None
Examples: |
Perform Find [Restore] Check Found Set |
Description:
This script step uses FileMaker Pros spelling checker to check the spelling of the contents of text fields in all the records currently being browsed. The step checks spelling in all fields of type Text, and all calculation fields with a calculation result type of Text. It is an interactive script step that displays the familiar spelling dialog for every questionable spelling that the system finds.
Comments:
This option is normally available via the FileMaker menus. If one or more users have limited access to menu items, it may be necessary to write scripts that give them access to functionality normally available through menus, such as spell check functions. See the Change Password script step for further discussion of this point.
Check Record
Compatibility:
Menu Equivalent: Edit, Spelling, Check Record
Syntax: Check Record |
Options:
None
Examples: |
Go to Record/Request/Page [First] Loop Check Record Go to Record/Request/Page [Next; Exit after last] End Loop |
Description:
This script step uses FileMaker Pros spelling checker to check the spelling of the contents of text fields in every record in the current record. The step checks spelling in all fields of type Text, and all calculation fields with a calculation result type of Text. It is an interactive script step that displays the familiar spelling dialog for every questionable spelling that the system finds. See also the Check Found Set script step for further discussion.
Comments:
This option is normally available via the FileMaker menus. If one or more users have limited access to menu items, it may be necessary to write scripts that give them access to functionality normally available through menus, such as spell check functions. See the Change Password script step for further discussion of this point.
Check Selection
Compatibility:
Menu Equivalent: Edit, Spelling, Check Selection
Syntax: Check Selection [Select; table::field] |
Options:
Select Entire Contents checks the spelling of the entire contents of the designated field. If this option is not chosen, then only the text that has been selected (highlighted) is checked.
Go to Target Field allows for the selection of the field to spell check.
Examples: |
Check Selection [Select; Product::Description] |
Description:
This script step uses FileMaker Pros spelling checker to check the spelling of the contents of a single field. The step can check spelling in all fields of type Text, and all calculation fields with a calculation result type of Text. It is an interactive script step that displays the familiar spelling dialog for every questionable spelling that the system finds.
Comments:
This option is normally available via the FileMaker menus. If one or more users have limited access to menu items, it may be necessary to write scripts that give them access to functionality normally available through menus, such as spell check functions. See the Change Password script step for further discussion of this point.
Clear
Compatibility:
Menu Equivalent: Edit, Clear
Syntax: Clear [Select; |
Options:
Select Entire Contents allows for the deletion of the entire contents of a field, regardless of what portion of its contents have been selected (highlighted) by the user.
Go to Target Field specifies which field is to have its contents or selected contents deleted.
Examples: |
[View full width] #The following example clears the values in a |
Description:
This script step removes either the entire contents of a field (if the Select Entire Contents option has been designated) or the selected portion of a field (if the Select Entire Contents option has not been designated). It is important to note that Clear is distinct from the Cut operation in that it does not place the deleted content on the clipboard. In a web-published database, it is necessary to use a Commit Record/Request script step to update the record that had one (or more) of its fields cleared.
Comments:
Clear is one of a number of script steps that depend on the presence of specific fields on the current layout. For these steps to take effect, the targeted field must be present on the current layout and the current mode must be Browse mode. Note, however, that these script steps take effect even if the field has been marked as not enterable in Browse mode. Other script steps with the same limitations include Cut, Copy, Paste, and Set Selection.
Close File
Compatibility:
Menu Equivalent: File, Close
Syntax: Close File [Current File/" |
Options:
Specify allows you to select a FileMaker Pro file to close from among the list of existing predefined file references.
Add File Reference allows the selection of a file to close while at the same time adding it to the list of defined file references.
Define File References allows for existing file references to be modified or deleted.
Examples: |
Close ["Line_Items"] |
Description:
This script step closes the specified file. The target file may be specified via a file reference. If no file reference is designated, then the file in which the script is running is closed. (This also has the effect of halting the execution of the script that contains the Close File step.)
Comments:
If you used File, File Options to specify a script that should run when a file is closed, that script is triggered when the Close File script step is run.
Close Window
Compatibility:
Menu Equivalent: None
Syntax: Close Window [Current Window or Name: |
Options:
Specify allows you to choose a window to close, either by typing its name explicitly, or by drawing the name from a calculation.
Examples: |
Close Window [Name: "Sales records"] |
Description:
This script step closes either the currently active window or a window designated by name. The name may be a string literal typed into the script itself or generated as the result of a calculation.
Comments:
Closing the last open window in a database closes the database and halts execution of the currently running script. This also triggers any script that has been set to run when the file closes.
Comment
Compatibility:
Menu Equivalent: None
Syntax: # |
Options:
Specify allows for the entry of comment text in a dialog box.
Examples: |
# Clear Globals for Login # # Script authored by : Tom # Last modified on 1/12/2004 # Clear [Select, table::gCurrentUserID] Clear [Select, table::gCurrentUserName] Clear [Select, table::gCurrentUserEmail] |
Description:
This script step allows for the addition of comments to scripts. You can see these comments only when a script is viewed in ScriptMaker, or when a script is printed and the comments are bold text preceded by a #. Comments print as italics.
Comments:
Properly commented code helps greatly in legibility and debugging. Script comments are somewhat different from calculation comments, in that calculation comments are inserted in the body of a calculations text, and can be preceded with // or wrapped in /* . . . */ comment delimiters.
Commit Records/Requests
Compatibility:
Menu Equivalent: None
Syntax: Commit Records/Requests [No dialog] |
Options:
Skip Data Entry Validation will override any data entry validation options set for fields and commit the record regardless of any errors. This option skips validation only for fields set with the Only During Data Entry validation option in the Options for Field dialog box; fields set to Always Validate still validate, even if the Skip Data Entry Validation option is selected in this script step.
Examples: |
Show Custom Dialog ["Commit record?"; "Click Commit to save your changes."] If [Get(LastMessageChoice) = 1] Commit Records/Requests Else Revert Record/Request [No dialog] End |
Description:
This script step commits a record. In other words, it exits the current record or find request and updates the field data for the record. It has the effect of causing the user to exit the record, in the sense that no field will be active on the current layout once the record is committed. Exiting a record in this fashion will also have the effect of saving any changes made to it. Exiting/committing a record can be accomplished in many nonscripted ways as well, including changing to another record or merely clicking on a layout outside of any field so that no field is selected. See the Revert Record/Request script step for more discussion.
Comments:
While a user is editing a record, any changes she makes to the record can be seen by other users of the database. Only when she commits the record are her changes saved to the database and broadcast to other users. This script step has wide applicability. Any time you change data in a record via a script, its a good idea to commit the record explicitly. This is especially true if the changes will result in significant screen updates. For example, if data changes in a record would lead to different data being displayed in a portal on the current layout, its very important to make sure the data changes are explicitly committed. As a best practice we recommend using this step in any script where record data is altered. Its also necessary (not just desirable) to add this script step to scripts that are called from the Web, if those scripts change record data.
Its also critical to use this step liberally when the Set Field step is used in a script. Lack of an appropriate commit can leave a record in a locked state. For example, if the last step in a script is a Set Field step, you should finish the script with a Commit Records/Requests step. Otherwise, the affected record will remain "open" and will be locked until committed. Similarly, we recommend you perform Commit Records/Requests after any Set Field steps that may precede a Perform Script step to ensure the changes take effect before the next script runs. Problems with record locking in these circumstances are common in complex, scripted systems converted from FileMaker Pro 6.
When programming for the Web, be sure to select Perform Without Dialog. Leaving the box unchecked is not web compatible and does not work on the Web.
Constrain Found Set
Compatibility:
Menu Equivalent: Requests, Constrain Found Set
Syntax: Constrain Found Set [Restore] |
Options:
Specify Find Requests creates and stores a find request with the script step. See the Perform Find script step for more information.
Examples: |
# Find all employees older than 60 years of age. Enter Find Mode [ ] Set Field [Age; ">60" ] Perform Find [] # Now find which of these want early retirement Enter Find Mode [ ] Set Field [Early_Retire; "Yes" ] Constrain Found Set[] |
Description:
This script step specifies a find request that will be used to narrow the current found set. This is equivalent to applying the last find request with the new find request appended via a logical AND operator.
Comments:
Constrain[] is useful when searching unindexed fields as part of a complex find. If a search includes criteria for both stored and unstored fields, a performance gain may be achieved by first performing a find on the indexed fields, and then using Constrain[] to limit the search for the unindexed criteria to the smaller found set.
Convert File
Compatibility:
Menu Equivalent: None
Syntax: Convert File [" |
Options:
Specify Data Source allows for the designation of a data source to be converted into a FileMaker Pro 7 file.
The possible data sources are File, XML, and ODBC.
Examples: |
Convert File ["datafile.fp5"] |
Description:
This script step converts a file from a variety of supported formats into a FileMaker 7 file. This command works on only one file at a time. Supported data formats are BASIC format, Comma-Separated Text format, dBase III and IV DBF format, DIF format, FileMaker Pro format, HTML Table format, Lotus 1-2-3 WK1/WKS formats, Merge format, Microsoft Excel format, SYLK format, Tab-Separated Text format, and XML format. Designation of various data sources follows the same procedures as an import. See the Import Records script step for further discussion.
Comments:
This step is analogous to the effects of using File, Open to open a non-FileMaker 7/8 file. A variety of formats can be opened/converted, each with its own set of options.
Copy
Compatibility:
Menu Equivalent: Edit, Copy
Syntax: Copy [Select; |
Options:
Select Entire Contents copies the entire contents of a field to the Clipboard rather than just the selected portion of the designated fields contents.
Go to Target Field or Specify allow you to select the field from which you wish to copy the contents to the clipboard. If no field is specified and nothing is selected, FileMaker Pro copies the values from all fields of the current record.
Examples: |
Go To Layout[ "Customer Entry" (Customer)] Copy [Select; CustomerTable::Shipping_Address] Paste [Select; CustomerTable::Billing_Address] |
Description:
This script step places the contents of the specified field onto the clipboard. If no field is specified, all fields from the current record are copied, causing the step to function identically to the Copy Record step.
Comments:
Copy is generally a poor way to move data within scripts. It requires that the current layout contain the field to be copied. (This is fragile because the script malfunctions if the field is removed.) Additionally, the contents of the clipboard are overwritten, without the consent of the user. Copy does have some interesting uses, however. When in Preview Mode, Copy takes an image of the screen, and this image can then be pasted into a container field. Copy is one of a number of script steps that depend on the presence of specific fields on the current layout. Other script steps with the same limitations include Cut, Copy, Paste, and Set Selection.
Copy All Records/Requests
Compatibility:
Menu Equivalent: None
Syntax: Copy All Records/Requests |
Options:
None
Examples: |
# Copy Records in Found Set Go To Layout ["Detail"] Copy All Records/Requests # Place all records in log field Go To Layout ["Log"] New Record/Request Paste [Select; Log Table::Log] |
Description:
This script step copies the values of all fields in all the records in the current found set to the clipboard in a tab-delimited export format. Styles and formatting are not copied. The field values are exported in the order in which they appear on the current layout. Only those fields that appear in the current layout are included. With a record, individual fields are separated by tabs, and records are delimited by carriage returns. Repeating field values are separated by a group separator character between each repetition. Carriage returns within a field are copied to the clipboard as the "vertical tab" character (ASCII value 11), just as they are when being exported.
Comments:
Copy All Records/Requests is one of a number of script steps that depend on the presence of specific fields on the current layout. Other script steps with the same limitations include Cut, Copy, Paste, and Set Selection.
Copy Record/Request
Compatibility:
Menu Equivalent: None
Syntax: Copy Record/Request |
Options:
None
Examples: |
# Copy Current Record Go To Layout ["Detail"] Copy Record/Request # Place record in log field Go To Layout ["Log"] New Record/Request Paste [Select; Log Table::Log] |
Description:
This script step copies the values of all fields in the current record to the clipboard in a tab-delimited export format. Styles and formatting are not copied. The field values are exported in the order in which they appear on the current layout. Only those fields that appear in the current layout are included. With a record, individual fields are separated by tabs, and records are delimited by carriage returns. Repeating field values are separated by a group separator character between each repetition. Carriage returns within a field are copied to the clipboard as the "vertical tab" character (ASCII value 11), just as they are when being exported.
Comments:
Copy Record/Request is one of a number of script steps that depend on the presence of specific fields on the current layout. Other script steps with the same limitations include Cut, Copy, Paste, and Set Selection.
Correct Word
Compatibility:
Menu Equivalent: Edit, Spelling, Correct Word
Syntax: Correct Word |
Options:
None
Examples: |
Check Selection [Select; Product::Description] Correct Word |
Description:
This script step opens the spelling dialog box to allow for the correction of the spelling of a word that has been identified as having been misspelled by the FileMaker Pro spell check operation. The option to Check Spelling As You Type must be selected. A word can be corrected only if FileMaker has identified it as being misspelled.
Comments:
This option is normally available via the FileMaker menus. If one or more users have limited access to menu items, it may be necessary to write scripts that give them access to functionality normally available through menus, such as spell check functions. See the Change Password script step for further discussion of this point.
Cut
Compatibility:
Menu Equivalent: Edit, Cut
Syntax: Cut [Select; |
Options:
Select Entire Contents copies the entire contents of a field to the Clipboard, rather than just the selected portion of the designated fields contents. The field is cleared of its contents.
Go to Target Field or Specify allow you to select the field from which you wish to cut the contents to the clipboard. If no field is specified and nothing is selected, FileMaker Pro cuts the values from all fields of the current record.
Examples: |
Enter Browse Mode [ ] Cut [Select, Table1::Recent Notes] Paste [Table1::Previous Notes] |
Description:
This script step places the contents of the selected field (or of all fields on the current layout if no field is selected or designated within the script itself) onto the clipboard and then clears the contents of that field.
Comments:
Cut is generally a script step that bears avoiding. It requires that the current layout contain the field to be cut. (This is fragile because the script malfunctions if the field is removed.) Additionally, the contents of the clipboard are overwritten without the consent of the user. Think carefully about whether the intended effect could be accomplished in a layout-independent, less intrusive fashion. Other script steps with the same limitations include Copy, Paste, and Set Selection.
Delete Account
Compatibility:
Menu Equivalent: None
Syntax: Delete Account [Account Name: <account name>] |
Options:
Specify allows for the selection or input of the account to be deleted.
Examples: |
Delete Account [Account Name: "Regional Sales"] |
Description:
This script step deletes the specified account in the current database. Full access is required to complete this operation and an account with full access may not be deleted with this script step. It is possible to specify Run Script with Full Access Privileges to ensure that any user can execute this script. However, care must be taken to ensure that such usage does not create a security hole. After Run Script with Full Access Privileges has been checked, any user who can see the script can run it, including those who have external access from other FileMaker files and web access.
Comments:
It might be desirable to allow access to this functionality via a script if certain users or user groups have limited access to the FileMaker menus because of security configurations. See the Change Password script step for a fuller discussion.
Delete All Records
Compatibility:
Menu Equivalent: Records, Delete All Records
Syntax: Delete All Records [No dialog] |
Options:
Perform Without Dialog allows for the deletion of all records in the current found set without user intervention.
Examples: |
[View full width] Show All Records Delete All Records // use a custom dialog to warn user before |
Description:
This script step deletes all records in the current found set. It can be set to operate without user approval if you select the Perform Without Dialog option. Special care should be exercised in the use of this script step because it is not possible to undo the operation after it has been completed.
Comments:
Note that any records that are "in use" by other users are not deleted by this step. Records are considered to be in use if other users are actively editing them and have not committed/saved their changes, or if they have been left open as a result of script actions. You may want to check explicitly whether this has occurred, either by using the Get (RecordOpenCount) function, or by using Get(LastError) to check for a script error. You should also decide how you want to handle cases where the step doesn execute completely for reasons such as these. Note that this script step is context-dependent. The current layout determines which table is active, which determines from which table the records are deleted.
When programming for the Web, be sure to select Perform Without Dialog. Leaving the box unchecked is not web compatible and does not work on the Web.
Delete Portal Row
Compatibility:
Menu Equivalent: None
Syntax: Delete Portal Row [No dialog] |
Options:
Perform Without Dialog allows for the deletion of the current related record without user approval.
Examples: |
Go to Portal Row [Last] Delete Portal Row [No dialog] |
Description:
This script step deletes the currently selected portal row. In other words, it deletes a record thats related to the current record, and is displayed in a portal on the current layout. It can be set to operate without user approval if you select the Perform Without Dialog option. Special care should be exercised in the use of this script step because it is not possible to undo the operation after it has been completed.
Comments:
Performance of this step can be inhibited if the record represented by the specified portal row is in use by another user. See the Delete All Records script step for further discussion. Note that this script step deletes a portal row even if the Allow Deletion of Portal Records check box in the Portal Setup dialog box is unchecked.
When programming for the Web, be sure to select Perform Without Dialog. Leaving the box unchecked is not web compatible and does not work on the Web.
Delete Record/Request
Compatibility:
Menu Equivalent: Records, Delete Record/Request
Syntax: Delete Record/Request [No dialog] |
Options:
Perform Without Dialog allows for the deletion of the current record or find request without user approval.
Examples: |
Go to Record/Request [Last] Delete Record/Request [No dialog] |
Description:
This script step deletes the current record (when in Browse mode) or current find request (when in Find mode). It can be set to operate without user approval if you select the Perform Without Dialog option. Special care should be exercised in the use of this script step because it is not possible to undo the operation after it has been completed.
Comments:
If the current layout has a portal and a portal row is selected, the user is prompted to specify whether the master record or the related record should be deleted. If the step is performed without a dialog, the action automatically applies to the master record. If a portal row is selected and the portal is not set to Allow Deletion of Portal Records, the option to delete a related record never appears. Note that this is in contrast to the Delete Portal Row step, which deletes an active portal row regardless of whether Allow Deletion of Portal Records is enabled or not. Performance of this step can be inhibited if the record is in use by another user. See the Delete All Records script step for further discussion. Note that this script step is context-dependent. The current layout determines which table is active, which determines from which table the record is deleted.
When programming for the Web, be sure to select Perform Without Dialog. Leaving the box unchecked is not web compatible and does not work on the Web.
Dial Phone
Compatibility:
Menu Equivalent: None
Syntax: Dial Phone [No dialog; ] |
Options:
Perform Without Dialog prevents the Dial Phone dialog from displaying when this script step executes.
Specify displays the Dial Phone options.
- Phone Number allows the entry of a telephone number.
- Specify allows the creation of a calculation to generate the telephone number to be dialed.
- Use Dialing Preferences applies the pre-established telephone dialing preferences to the number to be dialed, based on the designated location information.
Examples: |
Dial Phone [No Dialog, Contacts::Phone_Home] |
Description:
This script step allows FileMaker Pro to dial a telephone number from within a script. The number to be dialed may be entered within the script itself, contained within a field, or generated by a specified calculation. Current telephone dialing preferences can be applied optionally based on location information. Letters within telephone numbers are translated into the appropriate numbers (q and z being, of course, omitted). Note: This script step does not work on Mac OS.
Comments:
You might use this script step if you want to be able to dial the phone numbers of people or organizations whose contact information is stored in FileMaker. You might also use it to perform more low-level serial-line tasks, in conjunction with a plug-in that can communicate directly with a computers serial port.
Duplicate Record/Request
Compatibility:
Menu Equivalent: Records, Duplicate Record/Request
Syntax: Duplicate Record/Request |
Options:
None
Examples: |
Go to Portal Row [Last] Duplicate Record/Request |
Description:
This script step duplicates the current record while in Browse mode and the current find request in Find mode. Values in fields with auto-entry options are not duplicated; new values are generated for these fields, according to the details of the specific auto-entry options. If this script step is used when a portal row is selected, and the portal relationship allows for the creation of related records, then the related record is duplicated, rather than the master record.
Comments:
If there are certain fields you want to make certain are never duplicated, you can set them to auto-enter an empty string (""). On duplication, the auto-entry option will take effect and clear the field in the new record.
Edit User Dictionary
Compatibility:
Menu Equivalent: Edit, Spelling, Edit User Dictionary
Syntax: Edit User Dictionary |
Options:
None
Examples: |
Show Custom Dialog ["Edit the user dictionary?"] If [Get (LastMessageChoice) = 1] Edit User Dictionary End If |
Description:
This script step opens the User Dictionary dialog box. This is often used to display the User Dictionary dialog box when user privileges do not allow for the dialog to be chosen directly from the FileMaker menus.
Else
Compatibility:
Menu Equivalent: None
Syntax: Else |
Options:
None
Examples: |
If [gUsername = "Tom"] Show Custom Dialog ["Hello Tom"] Else If [gUsername = "Raul"] Show Custom Dialog ["Hola Raul"] Else If [gUsername = "Guido"] Show Custom Dialog ["Ciao Guido"] Else Show Custom Dialog ["I don know who you are!"] End If |
Description:
This script step can be placed after an If or Else If statement and immediately before an End If statement. The designated code block for the Else statement is executed only if all the previous If and Else If statements have evaluated as false. It is thus often used as a way to deal with values that do not fit within expected parameters or as a default action.
Else If
Compatibility:
Menu Equivalent: None
Syntax: Else If [] |
Options:
Specify allows for any available fields, functions, and operators to be used to enter the Boolean calculation into the Specify Calculation dialog box. Only a zero (0), false, or null (empty) result is construed as a Boolean false.
Examples: |
If [gUsername = "Tom"] Show Custom Dialog ["Hello Tom"] Else if [gUsername = "Raul"] Show Custom Dialog ["Hola Raul"] Else If [gUsername = "Guido"] Show Custom Dialog ["Ciao Guido"] Else Show Custom Dialog ["I don know who you are!"] End If |
Description:
This script step must follow the If script step or the Else If script step. It performs an action or actions based on the value of the Boolean calculation. The statements in the Else If block are executed only if none of the previous If or Else If statements are true.
Comments:
There can be an arbitrary number of Else If statements between an If statement and an End If statement. Their Boolean calculations are evaluated in the sequence in which they appear. If one should happen to evaluate to True, then its code block is executed and all subsequent Else If and Else clauses that appear before the End If are ignored.
Enable Account
Compatibility:
Menu Equivalent: None
Syntax: Enable Account [Account Name: <account name>; Activate/Deactivate] |
Options:
Specify displays the Enable Account Options dialog box.
- Account Name allows either the manual entry of or designation of a calculation to generate an account name.
- Activate Account enables the specified account.
- Deactivate Account disables the specified account.
Examples: |
[View full width] Enable Account [Account Name:"UserAccount"; |
Description:
This script step enables or disables a specific pre-existing account. For this script step to be performed, the user must be assigned the Full Access privilege set or the Run Script with Full Access Privileges option must be selected. Accounts with Full Access may not be deactivated with this script step.
Comments:
It might be desirable to allow access to this functionality via a script if certain users or user groups have limited access to the FileMaker menus because of security configurations. See the Change Password script step for a fuller discussion.
End If
Compatibility:
Menu Equivalent: None
Syntax: End If |
Options:
None
Examples: |
If [gUsername = "Tom"] Show Custom Dialog ["Hello Tom"] Else If [gUsername = "Raul"] Show Custom Dialog ["Hola Raul"] Else If [gUsername = "Guido"] Show Custom Dialog ["Ciao Guido"] Else Show Custom Dialog ["I don know who you are!"] End If |
Description:
This script step designates the end of an If/Else If/Else structure. See Else and Else If for more information.
End Loop
Compatibility:
Menu Equivalent: None
Syntax: End Loop |
Options:
None
Examples: |
Set Variable [$counter; "0"] Loop New Record/Request Set Variable [$counter; $counter + 1] Exit Loop If [$counter > 10] End Loop |
Description:
This script step marks the end of a Loop structure. The steps between Loop and End Loop are executed until the loop is explicitly exited. This step passes control to the step immediately following the Loop command preceding it.
Comments:
Note that this step doesn cause a loop to stop executing. Without termination logic, a loop will run forever. Use the Exit Loop If script step to establish the conditions under which the loop will stop running and control will pass to the script step immediately following.
Enter Browse Mode
Compatibility:
Menu Equivalent: View, Browse Mode
Syntax: Enter Browse Mode [Pause] |
Options:
Pause stops the script steps execution to allow for user data entry and record navigation. The user may resume the script by clicking the Continue button in the Status Area, or by executing a Resume Script script step through a button or directly through the FileMaker Scripts menu.
Examples: |
Allow User Abort [Off] Set Error Capture [On] Go To Layout ["Monthly Report] Enter Preview Mode [Pause] Go to Layout [Original Layout] Enter Browse Mode [] |
Description:
This script step places the current window into Browse mode.
Enter Find Mode
Compatibility:
Menu Equivalent: View, Find Mode
Syntax: Enter Find Mode [Restore; Pause] |
Options:
Pause stops the script steps execution to allow for user data entry and record navigation. The user may resume the script by clicking the Continue button in the Status Area, or executing a Resume Script script step through a button or directly through the FileMaker Scripts menu.
Specify Find Requests enables you to create and edit find requests for use with the script step.
Examples: |
[View full width] #an example of a find that is executed from |
Description:
This script step places the current layout into Find mode. In Find mode, find requests may be created, edited, deleted, and duplicated. In addition, find requests can be stored with the script step if you check the Restore check box and using the Specify dialog. String multiple find requests together to create complex find requests. A single find request may either omit records from or add them to the existing found set.
Comments:
Enter Find Mode is one of several script steps that is capable of saving complex options along with the script step. Other such script steps are Perform Find, Sort Records, Import Records, Export Records, and Print Setup. Use the Pause option if you want the user to be able to enter his own search criteria, or modify a search thats saved with the script. If the status area is visible, the user sees a Continue button, as well as a Cancel button if Allow User Abort is set to "on" in the script. Be sure to set Allow User Abort to "off" if you don want to offer an option to cancel the script at that point. If the status area is hidden, these buttons won be accessible, and the user needs to either show the status area or use keyboard equivalents for Continue (Enter or Return) or Cancel (Escape or
Enter Preview Mode
Compatibility:
Menu Equivalent: View, Preview Mode
Syntax: Enter Preview Mode [Pause] |
Options:
Pause stops the script steps execution to allow for user inspection of the preview for the designated layout. The user may resume the script by clicking the Continue button.
Examples: |
Enter Preview Mode [Pause] |
Description:
This script step places the current layout into Preview mode, where an approximation of what a layout will look like when it is printed out is displayed. Preview mode is helpful for viewing layouts that use special layout parts for reporting, title headers, leading grand summaries, subsummaries, trailing grand summaries, and title footers. Preview is the only FileMaker mode that displays all layout parts correctly. (Subsummary parts do not display correctly in Browse mode.)
Comments:
Use the Pause option if you want the user to be able to spend time in Preview mode working with the displayed data. If the status area is visible, the user sees a Continue button, as well as a Cancel button, if Allow User Abort is set to "on" in the script. Be sure to set Allow User Abort to "off" if you don want to offer an option to cancel the script at that point. If the status area is hidden, these buttons aren accessible, and the user needs to either show the status area or use keyboard equivalents for Continue (Enter or Return) or Cancel (Escape or
Execute SQL
Compatibility:
Menu Equivalent: None
Syntax: | Execute SQL [No Dialog; ODBC: |
Options:
Perform Without Dialog prevents the Specify SQL dialog box, the Select ODBC Data Source dialog box, and the Password dialog box from displaying when the script step executes.
Specify displays the Specify SQL dialog box, where you can set the following options:
- Specify displays the Select ODBC Data Source dialog box. This allows for the selection of an ODBC connection and allows for the entry of the appropriate username and password.
- Calculated SQL Text allows for the creation of a calculation to generate the desired SQL query.
- SQL Text allows for the direct entry of a text SQL query.
Examples: |
[View full width] Execute SQL [No Dialog; ODBC: SQL_Server; "UPDATE |
Description:
This script step executes a designated SQL query over a selected ODBC connection. This allows for manipulation of SQL data sources through standard queries. A script can contain multiple Execute SQL steps that act on different SQL data sources.
Comments:
The Execute SQL step opens a great many avenues in FileMaker development.
Exit Application
Compatibility:
Menu Equivalent: FileMaker Pro, Quit FileMaker Pro (Mac OS); File, Exit (Windows)
Syntax: Exit Application |
Options:
None
Examples: |
Exit Application |
Description:
This script step closes all open files and exits the FileMaker Pro Application.
Comments:
The Exit application triggers the closing scripts of any files that have a closing script attached.
Exit Loop If
Compatibility:
Menu Equivalent: None
Syntax: Exit Loop If [] |
Options:
Specify allows for the definition of the Boolean calculation that decides whether the loop is exited or not.
Examples: |
Set Field [Table1::gCounter; "0"] Loop New Record/Request Set Field [Table1::gCounter; Table1::gCounter + 1] Exit Loop If [gCounter > 10] End |
Description:
This script step terminates a loop if the Boolean calculation evaluates to True (non-zero and non-null). Upon termination, control is passed to the next script step after the End Loop script step that applies to the current script step. If the Boolean calculation evaluates to False (zero or null), then control is passed to the next script step, or to the step at the beginning of the loop if no further steps are specified within the loop.
Comments:
Youll probably want to have at least one Exit Loop If script step inside any loop you write. Without at least one such statement, its difficult to exit the loop, except by performing a subscript that performs a Halt Script or using a Go To Record/Request/Page [Next; Exit after last] script step.
Exit Script
Compatibility:
Menu Equivalent: None
Options:
You can use Specify to specify a value to be returned from the script as the script result. This result will be accessible via the Get(ScriptResult) function.
Examples: |
Perform Find [Restore] If [Get (CurrentFoundCount)=0] Show All Records Go to Layout ["Detail View"] Exit Script Else Print [] End |
Description:
Exit Script forces the current script to stop executing. No further script steps in the current script will execute. If the current script was called by another script, the remaining script steps in the calling script will continue to execute.
Comments:
Its important to distinguish this script step from the related script step Halt Script. Halt Script forces the termination of all currently running scripts, whereas Exit Script simply exits the current script.
Export Field Contents
Compatibility:
Menu Equivalent: Edit, Export Field Contents
Syntax: Export Field Contents [ |
Options:
Specify Target Field allows for the specification of the field whose contents are to be exported.
Specify Output File allows the desired filename and file path for the exported data to be specified.
Examples: |
[View full width] Go to Layout [Pictures::Agent_Picture] Export Field Contents [Pictures::Picture_Full; |
Description:
Export Field Contents creates a named file on disk with the contents of the specified field.
Comments:
Export Field Contents is a very powerful and flexible command when used in conjunction with container fields. FileMaker Pro allows the user to store a file of any type in a container field (including FileMaker Pro files). Export Field Contents writes the file out to disk in its native format, where the file can then be opened with the appropriate application. Any type of file, including images, of course, can be saved in a FileMaker database and written out to disk.
Export Records
Compatibility:
Menu Equivalent: File, Export Records
Syntax: Export records [No dialog; " |
Options:
Perform Without Dialog prevents the display of dialog boxes that let the user set new export criteria when the script step executes.
Specify Output File allows the desired filename and file path for the exported data to be specified as well as its file type. If XML Export is selected, then the XML Export Options dialog is displayed and allows the selection of an appropriate XML grammar and stylesheet for the export.
Examples: |
Export Records [No dialog, "Contracts"] |
Description:
This script step exports records from the current found set to a specified file in a specified format. The current sort order of the found set is used for the export order of the records. Note that Group By works only for fields that are included in the current sort order. (Sorted fields appear in the Group By box; check off any fields in which you want to group by.)
Comments:
Because its possible to create FileMaker field names that are not valid names for XML elements, use extreme caution when exporting in the FMPDSORESULT grammar; the resulting XML may be invalid. FMPDSORESULT is deprecated in this version of FileMaker Pro and should probably be avoided.
Extend Found Set
Compatibility:
Menu Equivalent: Requests, Extend Found Set
Syntax: Extend Found Set [Restore] |
Options:
Specify Find Requests allows for the creation and storage of find requests with the script step.
Examples: |
[View full width] #This script finds employees that are local or |
Description:
This script step allows the current found set to be extended if you append additional search criteria to the previous search or, put differently, if you apply designated search criteria only to records not included in the current found set. (This is equivalent to a logical OR search combined with the results of the previously executed search.)
Comments:
Similar to the Constrain Found Set script step, this step enables you to combine the results of more than one search. Whereas Constrain Found Set enables you to limit the results of one found set by the results of a second search (an operation known as an intersection), the Extend Found Set command enables you to add the results of one search to the results of another search (an operation known as a union).
Flush Cache to Disk
Compatibility:
Menu Equivalent: None
Syntax: Flush Cache to Disk |
Options:
None
Examples: |
[View full width] Replace Field Contents [Line_Items::ProductID; |
Description:
This script step causes FileMaker Pros internal disk cache to be written to disk. This operation is normally performed periodically or after structural changes such as defining fields or modifying calculation definitions. Flush Cache to Disk enables the developer to explicitly write out the contents of memory.
Comments:
Note that this script step flushes the contents of the cache for a local client copy of FileMaker Pro. It has no effect on the cache of any instance of FileMaker Server.
Freeze Window
Compatibility:
Menu Equivalent: None
Syntax: Freeze Window |
Options:
None
Examples: |
[View full width] Freeze Window Replace Field Contents [Line_Items::ProductID; |
Description:
This script step halts the updating of the active window as script steps are performed. The window resumes refreshing either at the end of the script where it was frozen or after a Refresh Window script step is executed within a script.
Comments:
Freeze Window is useful in creating more professional-looking applications because it prevents the screen from flashing or redrawing while other script steps execute (for example, those that navigate to "utility" layouts, perform some work there, and then return to a main interface layout). Its also possible to realize some performance gains from freezing a window; scripts that would otherwise cause changes to the contents or appearance of the active window run more quickly if the active window doesn need to be refreshed.
Go to Field
Compatibility:
Menu Equivalent: None
Syntax: Go to Field [Select/perform; |
Options:
Select/Perform directs FileMaker to select all contents of the designated field. If the field is a container field and an action is associated with that field (such as playing a movie or sound file), then that action is performed.
Go to Target Field allows for the specification of the field to go to, using the standard FileMaker Pro field selection dialog box.
Examples: |
Enter Browse Mode [] Go to Layout ["Contracts"] New Record/Request Go to Field [Contracts::Signatory] |
Description:
This script step selects a specified field in the current layout. If the Select/Perform option is selected, then if an action is associated with a field, that action is performed. (Actions would be associated with container field types, such as sound files or moviesin these cases, the associated action would be to play the sound or movie file.) In cases where there is no implied action, the entire contents of the field are selected.
Comments:
Go to Field allows the developer to insert the cursor into a specific field after a record has been created from a script.
Like other script steps such as Cut, Copy, and Paste, this step depends on the specified field being present on the current layout.
Go to Layout
Compatibility:
Menu Equivalent: None
Syntax: Go to Layout [" |
Options:
Specify allows the target layout to be selected. The following choices are available:
- Original Layout refers to the layout that was active when the script was initiated.
- Layout Name by Calculation enables you to enter a calculation that generates the name of the desired layout.
- Layout Number by Calculation enables you to enter a calculation that will generate the number of the desired layout. Layout numbers correspond to the order in which layouts are listed.
An existing layout may also be specified directly by name.
Examples: |
Go to Layout ["Contracts"] Copy [Select; DataTable1::ID_Number] Go To Layout [Original Layout] |
Description:
This script step makes the specified layout active in the current file. This step can navigate only to layouts in the currently active file. In the case where multiple layouts have the same name, the first match is selected for a calculated layout name.
Comments:
This script step is vital for establishing the proper context for any subsequent script steps that operate on record data. Any script steps that directly deal with FileMaker data or records will do so in the context of the table occurrence of the currently active layout.
Its also possible to draw either the name or the number of a layout from a calculation.
Go to Next Field
Compatibility:
Menu Equivalent: None
Syntax: Go to Next Field |
Options:
None
Examples: |
Go to Field [Table1::First Name] Set Field [Table1::gCounter; "0"] Loop Set Field [Table1::gCounter; Table1::gCounter + 1] Exit Loop If [gCounter > Table1::ActiveField] Go To Next Field End Loop |
Description:
This script step moves to the next field in the established tab order for the current layout. If no field is selected, the first field in the established tab order for the current layout is selected. If the user regains control, either by pausing in Browse mode or by exiting the script, the cursor remains in the selected field. If there is no tab order on the layout, the fields are traversed in the order in which they were added to the layout.
Comments:
Note that this script can override the effect of field behaviors that prevent entry into a field.
Go to Portal Row
Compatibility:
Menu Equivalent: None
Syntax: Go to Portal Row [ |
Options:
First selects the first row of the currently active portal.
Last selects the last row of the currently active portal.
Previous selects the previous row of the currently active portal. If the Exit After Last option is selected and the script is currently performing a loop, then an Exit Loop action is performed when the first row in the designated portal is reached.
Next selects the next row of the currently active portal. If the Exit After Last option is selected and the script is currently performing a loop, then an Exit Loop action is performed when the last row in the designated portal is reached.
By Calculation selects the row number determined by the designated calculation.
Examples: |
Go to Portal Row [Select, First] |
Description:
This script step allows navigation among related records in the active portal on the current layout. If no portal is active, then the first portal in the layout stacking order is assumed. This step attempts to maintain the selected portal field when it changes rows. If no field is selected, the first enterable field is selected in the new row.
Go to Previous Field
Compatibility:
Menu Equivalent: None
Syntax: Go to Previous Field |
Options:
None
Examples: |
Go to Previous Field |
Description:
This script step moves focus to the previous field in the current layouts tab order. If no field is selected, then the last field in the current layouts tab order is selected. If the user regains control, either by pausing in Browse mode or by exiting the script, the cursor will remain in the selected field. If there is no tab order on the layout, the fields are traversed in the order in which they were added to the layout.
Comments:
Note that this script can override the effect of field behaviors that prevent entry into a field.
Go to Record/Request/Page
Compatibility:
Menu Equivalent: None
Syntax: Go to Record/Request/Page [ |
Options:
First moves to the first record in the current found set, displays the first find request, or moves to the first page of the currently displayed report if in Preview mode.
Last moves to the last record in the current found set, displays the last find request, or moves to the last page of the currently displayed report.
Previous moves to the previous record in the current found set, displays the previous find request, or moves to the previous page of the currently displayed report. If the Exit After Last option is selected and the script is currently performing a loop, then an Exit Loop action is performed when the first record is reached; otherwise no action is taken. If the record pointer is already on the first page, FileMaker generates an error code of 101, which is not reported to the user.
Next moves to the next record in the current found set, displays the next find request, or moves to the next page of the currently displayed report. If the Exit After Last option is selected and the script is currently performing a loop, then an Exit Loop action is performed when the last record is reached; otherwise no action is taken. If the record pointer is already on the last page, FileMaker generates an error code of 101, which is not reported to the user.
By Calculation selects the record, find request, or report page determined by the designated calculation.
Examples: |
[View full width] # A very inefficient way of counting records Go To Record/Request/Page [First] Set Variable [$count; "0"] Loop Set Variable [$count; $count + 1] Go To Record/Request/Page [Next; Exit After Last] End Loop # $count now contains the number of records in the |
Description:
This script step moves to a record in the found set if the file running the script is in Browse mode, to a find request if it is in Find mode, and to a report page if it is in Preview mode. This step can also be configured to exit a loop when either the first or last record has been reached.
Go to Related Record
Compatibility:
Menu Equivalent: None