About the Script Step Reference

 < Day Day Up > 

The script step reference is a detailed guide to all the FileMaker Pro script steps. It is similar in layout to FileMaker's 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 though the step as a whole is Web compatible, one or more specific options of the step are not. So far, the only non-Web-compatible options we've seen are those that display a dialog box to the user when the step executes.

Add Account

Compatibility: Mac: yes

Windows : yes

Web: yes


Menu Equivalent: None

Syntax:

 

 Add Account [Account Name: <account name>; Password: <password>; Privilege Set: graphics/ccc.gif "<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 preexisting 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:

 

 Add Account [Account Name: "User_Account"; Password: "User_Password"; PrivilegeSet: "[Data graphics/ccc.gif Entry Only]"; Expire password] 

Description: This script step adds an account name, password, and privilege set to a database's 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.

Adjust Window

Compatibility: Mac: yes

Windows: yes

Web: no


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 user's screen.

Minimize minimizes the current window to an icon.

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 in a single-user environment, the size and position of a window cannot be relied upon unless one has explicitly set it or users are explicitly prohibited from modifying it.

Allow Toolbars

Compatibility: Mac: yes

Windows: yes

Web: no


Menu Equivalent: None

Syntax:

 

 Allow Toolbars [<On/Off>] 

Options:

On allows FileMaker's native toolbars to be utilized.

Off hides and makes inaccessible FileMaker's 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: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: None

Syntax:

 

 Allow User Abort [<on or off>] 

Options:

On allows users to halt the execution of a script by pressing the Esc key (or graphics/shift.gif -period on Mac OS machines).

Off disables the halting of scripts by users.

Examples:

 

 Allow User Abort[Off] 

Description: Allow User Abort is used to control the user's ability to cancel scripts by using the Esc key (or the graphics/shift.gif -period key combination on Mac OS systems). This script step is usually used in scripts whose operation should not be arbitrarily canceled by the user, such as login logic or data import/export. Most of FileMaker's menu options are also unavailable while a script is in the Allow User Abort [Off] state.

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: Mac: yes

Windows: yes*

Web: no


Menu Equivalent: Window, (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 application's windows, this step ensures that all FileMaker windows are above other application windows.

Examples:

 

 New Window [Name: "Trees"; Height: 200; Width: 600; Top: 16; Left: 16] Arrange All Windows [Tile Vertically] 

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: Mac: yes

Windows: yes

Web: no


Menu Equivalent: None

Syntax:

 

 Beep 

Options:

None

Examples:

 

 Set Error Capture [On] Perform Find [Restore] If [Get (FoundCount) = 0]    Beep    Show Custom Dialog ["No records were found that match your find criteria."] End 

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. (We've 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: Mac: yes

Windows: yes

Web: yes*


Menu Equivalent: F ile, Change Pass w ord

Syntax:

 

 Change Password [Old Password: <old password>; New Password: <new password>; No dialog] 

Options:

Old Password is the current account's 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 FileMaker Pro confirmation dialog for this action.

Examples:

 

 Change Password [Old Password: '0ldpassw0rd'; New Password: New_Password; No Dialog] // Change Password can be used in conjunction with "Show Custom Dialog" to cascade graphics/ccc.gif password changes throughout several files: Allow User Abort [ Off ] Set Error Capture [ On ] # Show Custom Dialog [ Title: "Password Change"; Buttons: "OK", "Cancel"; Input #1: graphics/ccc.gif zgPassword_Old. t, "Old Password:"; Input #2: zgPassword_New. t, "New Password:" ] # If [ Get(LastMessageChoice)=1 ]   Change Password [ Old Password: zgPassword_Old. t; New Password: zgPassword_New. t ]   # send password change to other files   Perform Script [ "Change Password"; from file "Contacts" Parameter: zgPassword_Old. graphics/ccc.gif t&""&zgPassword_New. t ]   Perform Script [ "Change Password"; from file "Invoices" Parameter: zgPassword_Old. graphics/ccc.gif t&""&zgPassword_New. t ] End If # be sure to clear the globals for security reasons Set Field [zgPassword_Old. t; ""] Set Field [zgPassword_New. t; ""] 

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 or her 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 he or 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. See Chapter 12, "Implementing Security," for more information on creating and editing privilege sets.) 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: Mac: yes

Windows: yes

Web: no


Menu Equivalent: E dit, Spelli n g, Check A ll

Syntax:

 

 Check Found Set 

Options:

None

Examples:

 

 Perform Find [Restore] Check Found Set 

Description: This script step uses FileMaker Pro's 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: Mac: yes

Windows: yes

Web: no


Menu Equivalent: E dit, Spelli n g, Check R e cord

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 Pro's 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: Mac: yes

Windows: yes

Web: no


Menu Equivalent: E dit, Spelli n g, Check S election

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 Pro's 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: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: E dit, Cl e ar

Syntax:

 

 Clear [Select; <table::field>] 

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).

Go to Target Field specifies which field is to have its contents or selected contents deleted.

Examples:

 

 #The following example clears the values in a repeating field with three repetitions. Clear [Select, table::field[3]] Clear [Select, table::field[2]] Clear [Select, table::field] 

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: Mac: yes

Windows: yes

Web: no


Menu Equivalent: F ile, C lose

Syntax:

 

 Close File [Current File/"<filename>"] 

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 pre-defined file references.

Define File References allows for existing file references to be modified or deleted.

Examples:

 

 Close ["Line_Items.fp7"] 

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 O p tions 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: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: None

Syntax:

 

 Close Window [Current Window or Name: <name of window>] 

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: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: None

Syntax:

 

 #<comment text> 

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. For more discussion of this point see Chapter 9, "Getting Started with Scripting" and Chapter 17, "Troubleshooting." Script comments are somewhat different from calculation comments, in that calculation comments are inserted in the body of a calculation's text, and can be preceded with // or wrapped in /* . . . */ comment delimiters.

Commit Records/ Requests

Compatibility: Mac: yes

Windows: yes

Web: yes*


Menu Equivalent: None

Syntax:

 

 Commit Records/Requests [No dialog] 

Options:

Skip Data Entry Validation overrides any data entry validation options set for fields and commits the record anyway. 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.

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. Note: exiting a record will also have the effect of committing any changes made to it. Exiting a record can be accomplished in many non-scripted ways, 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't be seen. 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, it's 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, it's 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 . It's also necessary to add this script step to scripts that are called from the Web, if those scripts change record data.

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: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: R equests, C onstrain 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 [] # 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: Mac: yes

Windows: yes

Web: no


Menu Equivalent: None

Syntax:

 

 Convert File ["<filename>"] 

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

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 F ile, O pen to open a non-FileMaker 7 file. A variety of formats can be opened/converted, each with its own set of options. See Chapter 18, "Converting Systems from Previous Versions of FileMaker Pro" and Chapter 19, "Importing Data into FileMaker Pro."

Copy

Compatibility: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: E dit, C opy

Syntax:

 

 Copy [Select; <table::field>] 

Options:

Select Entire Contents copies the entire contents of a field to the Clipboard rather than just the selected portion of the designated field's 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 on to 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: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: None

Syntax:

 

 Copy All Records/Requests 

Options:

None

Examples:

 

 # Copy Current Record 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 .

In previous versions of FileMaker it was often necessary to use this script step to copy a set of record keys and paste them into a field that would act as a "multikey," capable of relating to many records in another file at once. This technique was often used to navigate multi-step relationship chains. The new relational capabilities of FileMaker 7 make it unlikely that this step will need to be used in this way.

Copy Record/Request

Compatibility: Mac: yes

Windows: yes

Web: yes


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: Mac: yes

Windows: yes

Web: no


Menu Equivalent: E dit, Spelli n g, Correct W ord

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: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: E dit, Cu t

Syntax:

 

 Cut [Select; <table::field>] 

Options:

Select Entire Contents copies the entire contents of a field to the Clipboard, rather than just the selected portion of the designated field's 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: Mac: yes

Windows: yes

Web: yes


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: "Guest Access account"] 

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: Mac: yes

Windows: yes

Web: yes*


Menu Equivalent: R ecords, Dele t e 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:

 

 Perform Find [Restore] // use a custom dialog to warn user before deleting all records Allow User Abort [ Off ] Set Error Capture [ On ] Show Custom Dialog [ Title: "Delete All Records"; Message: "Are you really sure you want graphics/ccc.gif to delete all records?"; Buttons: "Cancel", "Delete" ] If [Get(LastMessageChoice)=2 ] # the user still wants to delete   Show Custom Dialog [ Title: "Delete All Records"; Message: "Do you have a current graphics/ccc.gif backup?"; Buttons: "No", "Yes" ] If [ Get(LastMessageChoice)=2 ]   # after they confirmed twice, go ahead with delete   Show All Records   Delete All Records[ No dialog ]  End If End If 

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. You may want to check explicitly whether this has occurred, either by examining the found set, 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't 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: Mac: yes

Windows: yes

Web: yes


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 current portal row. In other words, it deletes a record that's related to the current record. 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: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: R ecords, D elete 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 or find request record. 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: Mac: no

Windows: yes

Web: no


Menu Equivalent: None

Syntax:

 

 Dial Phone [No dialog; <phone number>] 

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 computer's serial port.

Duplicate Record/Request

Compatibility: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: R ecords, Duplic at e 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. 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 after the Go to Portal Row script step has been executed 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: Mac: yes

Windows: yes

Web: no


Menu Equivalent: E dit, Spelli n g, Edit U ser 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: Mac: yes

Windows: yes

Web: yes


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't 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: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: None

Syntax:

 

 Else If [<Boolean calculation>] 

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't 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: Mac: yes

Windows: yes

Web: yes


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:

 

 Enable Account [Account Name:"UserAccount"; Activate] 

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 security configurations. See the Change Password script step for a fuller discussion.

End If

Compatibility: Mac: yes

Windows: yes

Web: yes


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't 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: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: None

Syntax:

 

 End Loop 

Options:

None

Examples:

 

 Set Field [Table1::gCounter; "0"] Loop    New Record/Request    Set Field [Table1::gCounter; Table1::gCounter + 1]    Exit Loop If [gCounter > 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't 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: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: V iew, B rowse Mode

Syntax:

 

 Enter Browse Mode [Pause] 

Options:

Pause stops the script step's 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 file into Browse mode.

Enter Find Mode

Compatibility: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: V iew, F ind Mode

Syntax:

 

 Enter Find Mode [Restore; Pause] 

Options:

Pause stops the script step's 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:

 

 #an example of a find that is executed from requests stored with the script Go to Layout ["Detail View"] Enter Find Mode [Restore] Perform Find [] #this example waits for the user to enter find criteria and execute the find Go to Layout ["Detail View"] Enter Find Mode [Pause] Perform Find[] 

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 are 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 . See Chapter 9, "Getting Started with Scripting", for more discussion of saved script step options. Use the Pause option if you want the user to be able to enter his own search criteria, or modify a search that's 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't want to offer an option to cancel the script at that point. If the status area is hidden, these buttons won't 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 graphics/shift.gif -period).

Enter Preview Mode

Compatibility: Mac: yes

Windows: yes

Web: no


Menu Equivalent: V iew, P review Mode

Syntax:

 

 Enter Preview Mode [Pause] 

Options:

Pause stops the script step's 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't want to offer an option to cancel the script at that point. If the status area is hidden, these buttons aren't accessible, and the user needs to either show the status area or use keyboard equivalents for Continue (Enter or Return) or Cancel (Escape or graphics/shift.gif -period). For more information on Preview mode, see Chapter 4, "FileMaker Fundamentals: Working with Layouts," and Chapter 10, "Reporting with Grouped Data."

Execute SQL

Compatibility: Mac: yes

Windows: yes

Web: no


Menu Equivalent: None

Syntax:

 

 Execute SQL [No Dialog; ODBC: <datasource name>; <native SQL or calculated SQL>] 

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:

 

 Execute SQL [No Dialog; ODBC: SQL_Server; "UPDATE Customers SET Status = '" & Customer: graphics/ccc.gif :Status & "' where CustID = '" & Customer::CustomerID & "' ;"] 

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. For a thorough discussion, see Chapter 20, "Getting Data Out of FileMaker."

Exit Application

Compatibility: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: FileMaker Pro, Quit FileMaker Pro (Mac OS); F ile, E x it (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: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: None

Syntax:

 

 Exit Loop If [<Boolean calculation>] 

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:

You'll probably want to have at least one Exit Loop If script step inside any loop you write. Without at least one such statement, it's difficult to exit the loop, except by performing a subscript that performs a Halt Script .

Exit Script

Compatibility: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: None

Syntax:

 

 Exit Script 

Options:

None

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:

It's 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: Mac: yes

Windows: yes

Web: no


Menu Equivalent: E dit, E x port Field Contents

Syntax:

 

 Export Field Contents [<table::field>; "<filename>"] 

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:

 

 Go to Layout [Pictures::Agent_Picture] Export Field Contents [Pictures::Picture_Full; Pictures::filename] 

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. For more information on exporting, see Chapter 20, "Getting Data Out of FileMaker."

Export Records

Compatibility: Mac: yes

Windows: yes

Web: no


Menu Equivalent: F ile, E xport Records

Syntax:

 

 Export records [No dialog; "<output filename>"] 

Options:

Perform Without Dialog prevents dialog boxes from displaying when the script step executes that lets the user set new export criteria.

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.

Specify Export Order displays the export order that was in effect when you added the script step. The last export order used in the file appears as the default and can be edited or deleted.

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 by which you want to group by.)

Comments:

Because it's 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. For more information, see "About the FMPDSORESULT Grammar" in Chapter 22, "FileMaker and Web Services."

Exporting data from FileMaker is a large and complex topic. For more information on exporting, see Chapter 20, "Getting Data Out of FileMaker."

Extend Found Set

Compatibility: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: R equests, E xtend 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:

 

 #This script finds employees that are local or have a specific zip code Set Error Capture [On] Allow User Abort [Off] Enter Find Mode [ ] Set Field [Local; "Yes"] Perform Find [ ] Enter Find Mode [ ] Set Field [Zip; "94965"] Extend Found Set[] 

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 add the results of one search to the results of another search (an operation known as a union ).

Flush Cache to Disk

Compatibility: Mac: yes

Windows: yes

Web: no


Menu Equivalent: None

Syntax:

 

 Flush Cache to Disk 

Options:

None

Examples:

 

 Replace Field Contents [Line_Items::ProductID; Line_Items::NewProductID] Flush Cache to Disk 

Description:

This script step causes FileMaker Pro's 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. See Chapter 25, "FileMaker Server," for more information on configuring and flushing the FileMaker Server cache.

Freeze Window

Compatibility: Mac: yes

Windows: yes

Web: no


Menu Equivalent: None

Syntax:

 

 Freeze Window 

Options:

None

Examples:

 

 Freeze Window Replace Field Contents [Line_Items::ProductID; Line_Items::NewProductID] Sort [Restore; No Dialog] Refresh Window 

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). It's 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't need to be refreshed.

Go to Field

Compatibility: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: None

Syntax:

 

 Go to Field [Select/perform; <table::field>] 

Options:

Select/Perform directs FileMaker to select all contents of the designated field. If 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: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: None

Syntax:

 

 Go to Layout ["<layout name or layout number>"] 

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 step was executed.

  • 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 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:

It's also possible to draw either the name or the number of a layout from a calculation. For an extended example of the use of this script step in a custom navigation mechanism, see Chapter 13, "Advanced Layout Techniques."

Go to Next Field

Compatibility: Mac: yes

Windows: yes

Web: yes


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: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: None

Syntax:

 

 Go to Portal Row [<first/last/previous/next/by calculation>] 

Options:

First selects the first row of the designated portal.

Last selects the last row of the designated portal.

Previous selects the previous row of the designated portal. If the Exit After Last option is selected, then an exit loop action is performed when the first row in the designated portal is reached.

Next selects the next row of the designated portal. If the Exit After Last option is selected, 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 modifiable field is selected in the new row.

Go to Previous Field

Compatibility: Mac: yes

Windows: yes

Web: yes


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 layout's tab order. If no field is selected, then the last field in the current layout's 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: Mac: yes

Windows: yes

Web: yes*


Menu Equivalent : None

Syntax:

 

 Go to Record/Request/Page [<first/last/previous/next/by calculation>] 

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:

 

 # A very inefficient way of counting records Go To Record/Request/Page [First] Set Field [Contacts::gCount; "0"] Loop    Set Field [Contacts::gCount; Contacts::gCount + 1]    Go To Record/Request/Page [Next; Exit After Last] End Loop # Contacts::gCount now contains the number of records in the found set. # This could have been more easily accomplished by: # Set Field [Contacts::gCount; Get(FoundCount)] 

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.

Comments:

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.

Go to Related Record

Compatibility: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: None

Syntax:

 

 Go to Related Record [From table: "<table name>";Using layout "<layout name>"] 

Options:

Get Related Record From allows the selection of a table that's related to the current table. If an appropriate table is not in the list or if you need to add or change a relationship, Define Database displays the Define Database dialog box, where you can create or edit relationships.

Use External Table's Layouts opens the file containing the external table you specify and displays any related record(s), using the specified layout in that file.

Show Record Using Layout displays related record(s), using the specified layout in the current file.

Show Related Records Only creates a found set in the related table containing only related records. For example, if you use this script step on a relationship that has four matching records in Table B for the current record in Table A, this option replaces any current found set in Table B with a new found set of just these four records. If the relationship has a sort order applied in the table occurrence to which you're navigating, this option causes the found set to be sorted by the relationship's sort criteria. If the Show Related Records Only option is not selected, the resulting found set is not sorted.

Examples:

 

 #The following example goes to a related record in the table "LineItems" and shows a found graphics/ccc.gif set of related records only. Go to Related Record [Show only related records; From table: "LineItems"; Using layout: "List View"] 

Description:

This script step goes to the table designated by the relationship selected in the script step, bringing its window to the foreground and selecting the first related record in the process. This step also works with portals. If a portal row is selected and the Go to Related Record stepspecifying the portal's relationshipis executed, then the related table is brought to the forefront and the row that was selected in the portal corresponds to the record that is selected in the related table. This step may also use relationships to external files so that when the step is executed, the selected external file is opened and brought to the forefront, with its found set consisting of related records only. Further, if a layout was selected, then the records are displayed in that layout.

Comments:

This script step goes to a record in a related table (that is, a table that is related to the currently active table by one or more relationships in the Relationships Graph). There are a number of options to this script step, and they relate in somewhat complex ways. If more than one record in the target table is related to the current record in the table where the script is being called, FileMaker selects the first related record in the target table. If the relationship has a sort order on the target table, that sort order is used to determine which is the first of several related records. For example, if you have a table of Customers and a table of Orders, and a relationship between the two that is sorted on the Order side by OrderDate ascending , then the "first" related record when navigating from a specific customer to related orders is a given customer's earliest order. If the relationship has no sort order specified on the target table, then the first record is determined based on the creation order of the related records.

As part of this script step, you need to determine the layout that should be used to display the related records. Most likely, you'll want it to be a layout tied to a table occurrence that's based on the target table. If the target table is part of an externally referenced file, you may choose to display the records on a layout in the external file. If you choose to do so, that file comes to the forefront. You may also choose to display the related record set in a new window. If you choose to do so, you can specify a set of new window options, such as the window name, height, width, and screen position. One unfortunate limitation is that you can't direct the related records to appear in an existing window other than the currently active one. If you had to have that effect, you could select the desired target window, capture its name, dimensions, and positions into global fields, then close that window and create a new window with exactly the same dimensions and use that as the target of this script step.

If the option to Show Related Records Only is checked, FileMaker creates a found set in the target table that contains only those records that are related to the current record in the table in which the script is executing. For example, given a table of Salespeople and a table of Orders related to Salespeople by a SalespersonID field, if you issue a Go to Related Record[Show only related records; From table:"Orders"] while on a record in Salespeople, you end up with a found set of only those Orders related to the current Salesperson by the SalespersonID. If the option to Show Only Related Records is unchecked, the behavior is more complex: If there's a found set on the target layout and the first related record is within that found set, the found set is unchanged. If there's a found set on the target layout and the first related record is outside that found set, all records in the target table are found (though only the first related record is selected). If there is no found set on the target layout (that is, all records are currently found), that remains the case. No matter whether Show Related Records Only is checked or not, and no matter what the state of any found set on the target layout is, the first related record is always selected. If there are no related records, no navigation takes place, and a FileMaker Error of 101 is generated.

For further discussion of the Go To Related Records script step, see "Go To Related Record," p. 437 .


Halt Script

Compatibility: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: None

Syntax:

 

 Halt Script 

Options:

None

Examples:

 

 # Example of using 'Halt Script' to return control immediately back to the user. Show Custom Dialog ["Print Report?"] If [Get (LastMessageChoice) = 2]    Halt Script End If Print[] 

Description:

This script step causes all script activity to stop immediately. All scripts, subscripts and external scripts are cancelled and the system is left in whatever state it was in when the Halt step was executed. Halt Script is different from Exit Script in that the latter merely aborts the current subscript and allows the script that called the subscript to continue running, whereas the former stops all script activity, whether it is run from a subscript, a sub-subscript, and so on.

If

Compatibility: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: None

Syntax:

 

 If [<Boolean calculation>] 

Options:

Specify allows the definition of the Boolean calculation by which the If step determines its branching.

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't know who you are!"] End If 

Description:

The If step introduces a block of conditional logic. It needs to be used with an End If statement, and, optionally, one or more Else and Else If statements. This script step contains a calculation, which should perform a logical true/false test. If the specified Boolean calculation results in a 1 (or any number greater than 1), the specified action(s) will be performed. If the specified Boolean calculation results in a 0 (or nothing or any non-number), then the specified action(s) will be skipped and control passed to the next Else If or Else clause. If there are no more such clauses, then control passes to the End If step and proceeds to any subsequent steps. Else If and Else clauses are optional. End If is required when If is used.

Comments:

If you don't provide a Boolean test in the If step, it defaults to a result of False.

Import Records

Compatibility: Mac: yes

Windows: yes

Web: no


Menu Equivalent: F ile, I mport Records

Syntax:

 

 Import Records [No dialog; "<source or filename>"; Add/Update existing/Update matching; graphics/ccc.gif <platform and character set>] 

Options:

Perform Without Dialog prevents the display of FileMaker Pro's Import Records dialog box, which enables the user to select a file from which to import, to set new import criteria, to map fields from import to target fields, and to see a summary of facts about the import after it has been successfully completed.

Specify Data Source allows for the selection of the source for the data to be imported. Data can be imported into FileMaker Pro from a file, a folder of files, a digital camera (Mac OS), an XML data source, or an ODBC data source.

Specify Import Order allows the order in which FileMaker imports records to be set. The last import order used is used as the default for the subsequent import. This option allows control of how FileMaker is to handle repeating field data, either by splitting it among new records or keeping it together as a repeating field in the destination table. Also, the import can be made to add new records with the imported data, to replace the records in the found set with the imported data, or to attempt to reconcile data by matching keys (ID fields).

Examples:

 

 Import Records [Restore; No dialog; "Contacts"; Mac Helvetica] 

Description:

This script step imports records from another file or data source specified either dynamically through the Import Records dialog or within the script step configuration itself. Import order can be specified as either manually defined or based on matching fields names. (It is important to note that when import source fields and target fields are mapped with matching names, field name matching is performed dynamically each time the script step is performed.)

For a full description of FileMakers importing options, see Chapter 19, "Importing Data into FileMaker Pro," p. 537 .


Insert Calculated Result

Compatibility: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: None

Syntax:

 

 Insert Calculated Result [Select; <table::field>; <formula>] 

Options:

Select Entire Contents replaces the contents of a field. If this option is not selected, Insert Calculated Result replaces only the selected portion of the current field, or inserts the result at the insertion point. The default insertion point is at the end of the field's data.

Go To Target Field allows the selection of the field into which the contents of the clipboard are to be inserted. The specified field must be available for modification on the current layout for this script step to operate properly.

Calculated Result allows the definition of a calculation whose result is inserted into the specified target field by this script step.

Examples:

 

 Insert Calculated Result [Books::Author; Get(AccountName)] 

Description:

This script step pastes the result of a calculation into the current (or specified) field on the current layout.

Comments:

In a Web-published database, use a Commit Record/Request script step after an Insert Calculated Result script step to update the record in the browser window. All of the Insert... functions depend on the presence of fields on the current layout. If the correct field is not present, FileMaker will generate an internal error of 102.

Insert Current Date

Compatibility: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: I nsert, Current D ate

Syntax:

 

 Insert Current Date [Select; <table::field>] 

Options:

Select Entire Contents replaces the contents of the selected field with the current date. If this option is not selected, then the current date is appended to the end of the current contents of the field.

Go To Target Field allows for the selection of the field into which the current date will be inserted.

Examples:

 

 New Record/Request Go To Layout ["Invoice"] Insert Current Date [Select; Invoices::Invoice Date] 

Description:

This script step pastes the current system date into the specified field on the current layout.

Comments:

In a Web-published database, use a Commit Record/Request script step after an Insert Current Date script step to update the record in the browser window. All the Insert... functions depend on the presence of fields on the current layout. If the correct field is not present, FileMaker generates an internal error of 102.

Insert Current Time

Compatibility: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: I nsert, Current T ime

Syntax:

 

 Insert Current Time [Select; <table::field>] 

Options:

Select Entire Contents replaces the contents of the selected field with the current time. If this option is not selected, then the current time is appended to the end of the current contents of the field.

Go To Target Field allows for the selection of the field into which the current time is to be inserted.

Examples:

 

 New Record/Request Go To Layout ["Invoice"] Insert Current Date [Select; Invoices::Invoice Date] Insert Current Time [Select; Invoices::Invoice Time] 

Description:

This script step pastes the current system time into the specified field on the current layout.

Comments:

In a Web-published database, use a Commit Record/Request script step after an Insert Current Time script step to update the record in the browser window. All the Insert... functions depend on the presence of fields on the current layout. If the correct field is not present, FileMaker generates an internal error of 102.

Insert Current User Name

Compatibility: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: I nsert, Current U ser Name

Syntax:

 

 Insert Current User Name [Select; <table::field>] 

Options:

Select Entire Contents replaces the contents of the selected field with the current username. If this option is not selected, then the current username is appended to the end of the current contents of the field.

Go To Target Field allows for the selection of the field into which the current user name is to be inserted.

Examples:

 

 New Record/Request Go To Layout ["Invoice"] Insert Current Date [Select; Invoices::Invoice Date] Insert Current Time [Select; Invoices::Invoice Time] Insert Current User Name [Select; Invoices::Entered_By] 

Description:

This script step pastes the current username into the specified field on the current layout.

Comments:

In a Web-published database, use a Commit Record/Request script step after an Insert Current User Name script step to update the record in the browser window. All the Insert... functions depend on the presence of fields on the current layout. If the correct field is not present, FileMaker generates an internal error of 102.

Insert File

Compatibility: Mac: yes

Windows: yes

Web: no


Menu Equivalent : I nsert, F ile

Syntax:

 

 Insert File [Reference; <table::field>; "<filename>"] 

Options:

Store Only a Reference instructs FileMaker Pro to store only a link to a file in the container field, rather than the entire file. This option may reduce the size of your FileMaker Pro file, but if you move or delete the file being referenced, FileMaker Pro can't display it.

Select Go To Target Field or click Specify to specify the container field into which to insert the selected file.

Select Specify Source File or click Specify to designate the file to be inserted.

Examples:

 

 Go To Field [Photos::Thumbnail] Insert File ["house_thumb.jpg"] 

Description:

This script step inserts a file into a selected container field on the current layout. Files may be stored in their entirety within FileMaker Pro, or you may choose to store only a file reference. File references certainly take up much less space within the database but they remove an element of control over a database's behavior. Files stored by reference can be moved or deleted while this is much more difficult to achieve within FileMaker itself.

Comments:

All the Insert... functions depend on the presence of fields on the current layout. If the correct field is not present, FileMaker generates an internal error of 102.

Insert From Index

Compatibility: Mac: yes

Windows: yes

Web: no


Menu Equivalent: I nsert, From I ndex

Syntax:

 

 Insert From Index [Select; <table::field>] 

Options:

Select Entire Contents replaces the contents of the selected field. If this option is not selected, then the selected index value is appended to the end of the current contents of the field if the field does not contain the cursor, or at the current cursor position if it does.

Go To Target Field allows for the selection of the field into which the selected index value is to be inserted.

Examples:

 

 Enter Find Mode [ ] Insert From Index [Users::User_Name] Perform Find [ ] 

Description:

This script step displays the index (if one exists) of the designated field and allows one of its values to be inserted into the field. If the Select Entire Contents option is selected, the contents of the field will be replaced with the selected value. If this option is not selected, then the value is inserted either at the position of the cursor in the field or appended to the end of the field's contents, depending on whether or not the field has the cursor in it. Note: If the specified field does not exist on the layout where the script is being performed or indexing has been disabled for the selected field, Insert From Index returns an error code which can be captured with the Get(LastError) function.

Comments:

All the Insert... functions depend on the presence of fields on the current layout. If the correct field is not present, FileMaker generates an internal error of 102.

Insert From Last Visited

Compatibility: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: I nsert, From L ast Visited Record

Syntax:

 

 Insert From Last Visited [Select; <table::field>] 

Options:

Select Entire Contents replaces the contents of the selected field. If this option is not selected, then the value from the last visited field is appended to the end of the current contents of the field if the field does not contain the cursor or at the current cursor position if it does.

Go To Target Field allows for the selection of the field into which the last visited field value is to be inserted.

Examples:

 

 Go to Record/Request/Page [Next] Go to Field [Vendor Name] Insert From Last Visited [] #Will use vendor from previous record 

Description:

This script step pastes the value of the specified field from the same field in the last active record. This step is compatible with both Find and Browse mode. A record is considered as having been active if it has been operated upon by FileMaker Pro in some way.

Comments:

In a Web-published database, use a Commit Record/Request script step after an Insert From Last Visited script step to update the record in the browser window. All the Insert... functions depend on the presence of fields on the current layout. If the correct field is not present, FileMaker generates an internal error of 102.

Insert Object

Compatibility: Mac: no

Windows: yes

Web: no


Menu Equivalent: I nsert, O bject

Syntax:

 

 Insert Object ["<object type>"] 

Options:

Specify displays the Insert Object dialog box.

Object Type allows the selection of the type of object to embed or link from the list of available file and application types.

Create New embeds a blank object of the specified object type.

Create from File allows the specification of the name of an existing file as the object to be embedded or linked.

When Create from File has been selected, Link can be selected to indicate that the object should be a linked object. When Link is not selected, the object is embedded instead.

Display As Icon tells FileMaker Pro not to display the embedded or linked object completely, but to display an icon that represents the object. The Change Icon button can be used to select a different icon for display. When Display As Icon is not selected, the complete object is displayed in the container field.

Examples:

 

 Go to Field [Profile::Greeting] Insert Object ["Video Clip"] 

Description:

This script step allows the user, through the Insert Object dialog box, to select an OLE Object and insert it into the current container field. If the specified object/file does not exist on the computer on which the script is being run, Insert Object returns an error code that can be captured with the Get(LastError) function.

Comments:

All of the Insert... functions depend on the presence of fields on the current layout. If the correct field is not present, FileMaker generates an internal error of 102. Insert Object works only on the Windows platform. Insert Object returns an error code if run on the Mac OS.

Insert Picture

Compatibility: Mac: yes

Windows: yes

Web: no


Menu Equivalent: I nsert, P icture

Syntax:

 

 Insert Picture [Select; <table::field>] 

Options:

Store Only A Reference To The File allows graphics to be stored by file system reference, thereby alleviating the need to store the actual image in the database. However, if the file is moved from the designated file path, FileMaker Pro can no longer display it.

Specify Source File or Specify allow the designation of the file path to the desired image file.

Examples:

 

 Go to Field [Profile::Greeting] Insert Picture ["headshot.jpg"] 

Description:

This script step imports an image file into the current container field. The desired field must be selected before this script is run. If the desired image file has not been specified, the user is given the Insert Picture dialog box.

Comments:

All the Insert... functions depend on the presence of fields on the current layout. If the correct field is not present, FileMaker generates an internal error of 102.

Insert QuickTime

Compatibility: Mac: yes

Windows: yes

Web: no


Menu Equivalent: I nsert, Q uickTime

Syntax:

 

 Insert QuickTime ["<filename>"] 

Options:

Specify Source File or Specify allow the designation of the file path to the desired QuickTime file.

Examples:

 

 Go to Field [Profile::Interview] Insert Picture ["Interview_Video"] 

Description:

This step imports a QuickTime movie or sound file into the current container field. A container field must be selected before this step can function. If an appropriate QuickTime file has not been designated, a dialog box is presented to the user, through which he or she may select and preview the file to be imported. This step requires that QuickTime be installed on the system being used to import the desired file.

Comments:

All the Insert... functions depend on the presence of fields on the current layout. If the correct field is not present, FileMaker generates an internal error of 102.

Insert Text

Compatibility: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: None

Syntax:

 

 Insert Text [Select; <table::field>; "<text>"] 

Options:

Select Entire Contents replaces the contents of a field. If this option is not selected, Insert Text inserts the specified value at the end of the field's data.

Use Go To Target Field or click Specify to specify the field to receive the pasted information. If no field is selected, the Insert Text command places the specified text after the insertion point. If no field is active at the time the command executes, it has no effect. If the selected field is not present on the current layout, the Insert Text command has no effect.

Specify displays the Specify dialog box where you can enter the text to be pasted.

Examples:

 

 Insert Text [Select; Profile::Favorite_Color; "Red"] 

Description:

This script step inserts text into the selected text field in the current record. If the Select Entire Contents option has not been selected, then the designated text is inserted at the cursor position or at the end of the field's contents, depending on whether or not there is a cursor in the field. The text to be inserted needs to be specified explicitly. If you want to insert variable text data, use the Insert Calculated Result script step or the Set Field script step.

Comments:

In a Web-published database, use a Commit Record/Request script step after an Insert Text script step to update the record in the browser window. All the Insert... functions depend on the presence of fields on the current layout. If the correct field is not present, FileMaker generates an internal error of 102.

Loop

Compatibility: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: None

Syntax:

 

 Loop 

Options:

None

Examples:

 

 # Create 10 new blank records 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 marks the beginning of a Loop structure. The end of the Loop structure is defined by a corresponding End Loop step. Script control passes from the Loop step through all intervening steps to the End Loop step and back again until an Exit Loop directive is encountered or until a Halt Script or Exit Script step is encountered. The Exit Loop directive is available as an option with the Exit Loop If step, the Go To Record/Request/Page step, and the Go To Portal Row step. Loops are often used to perform an action over a group of records or portal rows.

Modify Last Find

Compatibility: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: R ecords, Modify Last F i nd

Syntax:

 

 Modify Last Find 

Options:

None

Examples:

 

 Modify Last Find Set Field [Contacts::Birthdate; "1/1/1974...1/1/1985"] Perform Find[] 

Description:

This script step activates Find mode and then recalls the last find requests used. The find requests may then be modified and executed with the Perform Find script step.

Move/Resize Window

Compatibility: Mac: yes

Windows: yes

Web: no


Menu Equivalent: None

Syntax:

 

 Move/Resize Window [Current Window or Name: <name of window>; Height: <n>; Width : <n>; graphics/ccc.gif Top: <n>; Left: <n>] 

Options:

Specify allows the setting of the move/resize options.

Current Window causes the changes to be performed on the current window.

Window Name causes the changes to be performed on an open window, specified by name. Literal text may be entered or Specify clicked to create a window name from a calculation.

Height is the height of the adjusted window in pixels. A number may be entered or Specify clicked to generate a number from a calculation.

Width is the width of the adjusted window in pixels. A number may be entered or Specify clicked to generate a number from a calculation.

Distance From Top is the adjusted window's distance in pixels from the top of the screen (Mac OS) or top of the FileMaker Pro window (Windows). A number may be entered or Specify clicked to generate a number from a calculation.

Distance From Left is the adjusted window's distance in pixels from the left of the screen (Mac OS) or left of the FileMaker Pro window (Windows). A number may be entered or Specify clicked to generate a number from a calculation.

Examples:

 

 Move/Resize Window [Name:Invoices ; Height: 400; Width: 600; Top: 16; Left: 16] 

Description:

This script step adjusts the size and location of the selected window. Every other aspect of the window, including found set, current table, and current record remain unchanged. Where an option is left without a value, the current value of that option is used. If position or size options exceed or fall below allowable minimums or maximums for a machine's particular operating system and configuration, the allowed minimums or maximums are used instead of the chosen values. In multiple monitor environments, the use of negative position values makes it possible to position a window on alternate monitors . Note for Windows: FileMaker Pro orients the moved window to the top left corner of the visible part of the application window. Note that this may not be the (0, 0) point of the window, depending on how the current file window is positioned (for example, if half of the file window extends past the left border of the application window, you would need to scroll to the left to see the [0, 0] point of the application window).

New File

Compatibility: Mac: yes

Windows: yes

Web: no


Menu Equivalent: F ile, N ew Database

Syntax:

 

 New File 

Options:

None

Examples:

 

 New File 

Description:

This script step enables the user to create a new database file in FileMaker Pro's usual Create New File Named dialog box. If the Show Templates in New Database Dialog Box preference is selected, then the script step shows the New Database dialog box.

Comments:

The user is taken to the Define Database dialog. When he's finished defining the new database, and has closed the Define Database dialog, the script that invoked the New File command continues. The new database stays open, but it is not activated.

New Record/Request

Compatibility: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: R ecords, N ew Record

Syntax:

 

 New Record/Request 

Options:

None

Examples:

 

 # Create 10 new blank records 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 creates a new, blank record if the system is in Browse mode, and a new find request if the system is in Find mode.

Comments:

Note that this script step is context-dependent. The current layout determines which table is active, which determines in which table the record is created.

New Window

Compatibility: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: W indow, N ew Window

Syntax:

 

 New Window [Name: <name of window>; Height: n; Width: n; Top: n; Left: n] 

Options:

Specify allows the setting of options for the new window.

Window Name is the name specified for the new window. Literal text may be entered or Specify clicked to create a window name from a calculation.

Height is the height of the new window in pixels. A number may be entered or Specify clicked to generate a number from a calculation.

Width is the width of the new window in pixels. A number may be entered or Specify clicked to generate a number from a calculation.

Distance From Top is the new window's distance in pixels from the top of the screen (Mac OS) or top of the FileMaker Pro window (Windows). A number may be entered or Specify clicked to generate a number from a calculation.

Distance From Left is the new window's distance in pixels from the left of the screen (Mac OS) or left of the FileMaker Pro window (Windows). A number may be entered or Specify clicked to generate a number from a calculation.

Examples:

 

 New Window [Name: "Profile"; Height: 500; Width: 700; Top: 25; Left: 25] 

Description:

This script step creates a new window based on the current window. The new window is the same as the current window except in the specified options. In the case where an option is left without a value, the default value (as specified in the Window menu, New Window command) for that option is used. If position or size options exceed or fall below allowable minimums or maximums for a machine's particular operating system and configuration, the allowed minimums or maximums are used instead of the chosen values. In multiple monitor environments, the use of negative position values makes it possible to position a window on alternate monitors. Note for Windows: FileMaker Pro orients the moved window to the top-left corner of the visible part of the application window. Note that this may not be the (0, 0) point of the window, depending on how the current file window is positioned. (For example, if half of the file window extends past the left border of the application window, you would need to scroll to the left to see the [0, 0] point of the application window.)

Omit Multiple Records

Compatibility: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: R ecords, Omit M ultiple

Syntax:

 

 Omit Multiple Records [No dialog; <number of records>] 

Options:

Perform Without Dialog prevents a dialog box from displaying when the script step executes. Without this option selected, the user sees a dialog that allows the user to enter the number of records to be omitted.

When Perform Without Dialog is selected, if a number of records to omit is not specified, only the current record is omitted.

Selecting Specify Records or clicking Specify allows the entry of the exact number of records to omit. The Specify button may also be clicked in the Options dialog box to allow for the entry of a calculation. The calculation result must be a number.

Examples:

 

 Perform Find [Restore] # Omit only the current record Omit Multiple Records [No Dialog] 

Description:

This script step omits the specified number of records from the found set, leaving the next available record as the current record. Omitted records are not deleted; they are just excluded from the found set. They remain in the database, as can be easily verified if you re-execute the Find Request that generated the found set in the first place.

Comments:

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.

Omit Record

Compatibility: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: R ecords, O mit Record

Syntax:

 

 Omit Record 

Options:

None

Examples:

 

 # Omit records marked for omission Go To Record/Request/Page [First] Loop  If [Contacts::Omit]    Omit Record  End If  Go To Record/Request/Page [Next; Exit After  Last] End Loop 

Description:

This script step omits the current record from the current found set when executed in Browse mode. The next available record becomes the new current record. Omitted records are not deleted. They are merely removed from the current found set. If this script step is executed while in Find mode, the current find request's Omit check box is toggled. (If it was checked, it will be unchecked and if it is unchecked it will be checked.) A find request that has the omit checkbox checked becomes an omit request that subtracts rather than adds to the found set.

Open Define Database

Compatibility: Mac: yes

Windows: yes

Web: no


Menu Equivalent: F ile, D efine, D atabase

Syntax:

 

 Open Define Database 

Options:

None

Examples:

 

 If [Get (LastMessageChoice) = 1]    #1=Yes, 2=No    Open Define Database End If 

Description:

This script step opens the Define Database dialog box, where the user can create or edit tables, fields, and relationships. This script step is not performed if the user's account does not have the Full Access privilege set. (The script may be set to Run Script With Full Access Privileges in the ScriptMaker menu.) When the user closes the dialog box, the remaining steps in the script, if any, are executed.

Open Define File References

Compatibility: Mac: yes

Windows: yes

Web: no


Menu Equivalent: F ile, D efine, F ile References

Syntax:

 

 Open Define File References 

Options:

None

Examples:

 

 Show Custom Dialog ["Do you want to create or edit a file reference?"] If [Get (LastMessageChoice) = 1]    #1=Yes, 2=No    Open Define File References End If 

Description:

This script step opens the Define File References dialog box, where the user can create or edit references to files used throughout the database. This script step is not performed if the user's account does not have the Full Access privilege set. (The script may be set to Run Script With Full Access Privileges in the ScriptMaker menu.) When the user closes the dialog box, the remaining steps in the script, if any, are executed.

Open Define Value Lists

Compatibility: Mac: yes

Windows: yes

Web: no


Menu Equivalent: F ile, D efine, V alue Lists

Syntax:

 

 Open Define Value Lists 

Options:

None

Examples:

 

 Show Custom Dialog ["Do you want to create or edit a value list?"] If [Get (LastMessageChoice) = 1]    #1=Yes, 2=No    Open Define Value Lists End If 

Description:

This script step opens the Define Value Lists dialog box, where the user can define new or edit existing value lists. This script step is not performed if the user's account does not have the Full Access privilege set. (The script may be set to Run Script With Full Access Privileges in the ScriptMaker menu.) When the user closes the dialog box, the remaining steps in the script, if any, are executed.

Open File

Compatibility: Mac: yes

Windows: yes

Web: no


Menu Equivalent: F ile, O pen

Syntax:

 

 Open File [Open hidden; "<filename>"] 

Options:

Open Hidden causes FileMaker Pro to open the specified database hidden (with its window minimized.)

Specify allows the selection of a FileMaker Pro database to be opened. Within the Specify menu, Add File Reference provides a dialog box to assist in the location and selection of a filename. After a file is selected, it is added to the Specify list. In the same menu, Define File References allows one to modify or delete a file reference already added to the list.

Examples:

 

 Open File [Open Hidden; "Tempfile.fp7"] 

Description:

This script step opens the specified file or allows the user to select a file to open in the Open File dialog box. The Open File Dialog box is invoked when no file is specified in the script step or if the specified file cannot be found. The active file before the Open File step is executed remains active after it has completed.

Open File Options

Compatibility: Mac: yes

Windows: yes

Web: no


Menu Equivalent: O pen, F ile Options

Syntax:

 

 Open File Options 

Options:

None

Examples:

 

 Show Custom Dialog ["Open File Options dialog box?"] If [Get (LastMessageChoice) = 1]    #1=Yes, 2=No    Open File Options End If 

Description:

This script step opens the File Options dialog box to the General preferences area. This script step is not performed if the user's account does not have the Full Access privilege set. (The script may be set to Run Script With Full Access Privileges in the ScriptMaker menu.)

Open Find/Replace

Compatibility: Mac: yes

Windows: yes

Web: no


Menu Equivalent: E dit, Find/Rep l ace, F ind/Replace

Syntax:

 

 Open Find/Replace 

Options:

None

Examples:

 

 Show Custom Dialog ["Open the Find/Replace dialog box?"] If [Get (LastMessageChoice) = 1]    #1=Yes, 2=No    Open Find/Replace End If 

Description:

This script step opens the Find/Replace dialog box. The remaining steps in the script, if any, are executed after the user closes the dialog box or completes a search.

Open Help

Compatibility: Mac: yes

Windows: yes

Web: no


Menu Equivalent: H elp, FileMaker Pro H elp

Syntax:

 

 Open Help 

Options:

None

Examples:

 

 Show Custom Dialog ["Do you want to open onscreen Help?"] If [Get (LastMessageChoice) = 1]    #1=Yes, 2=No    Open Help End If 

Description:

This script step opens the FileMaker Pro Help system. By default, the user is placed in the Help System Contents screen.

Comments:

The Help dialog is non-modal, so any additional script steps after the Open Help step execute right away, possibly pushing the help window into the background.

Open Preferences

Compatibility: Mac: yes

Windows: yes

Web: no


Menu Equivalent: E dit, Pre f erences (Windows) or FileMaker Pro, Preferences (Mac OS)

Syntax:

 

 Open Preferences 

Options:

None

Examples:

 

 Show Custom Dialog ["Open Preferences dialog box?"] If [Get (LastMessageChoice) = 1]    #1=Yes, 2=No    Open Preferences End If 

Description:

This script step opens the Preferences dialog box. The General Preferences area is selected by default.

Comments:

When the user closes the dialog box, the remaining steps in the script, if any, are executed.

Open Record/Request

Compatibility: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: None

Syntax:

 

 Open Record/Request 

Options:

None

Examples:

 

 Perform Find [Restore] Go to Record/Request/Page [First] Open Record/Request If [ Get(LastError) = 200 or Get(LastError) = 300]    Show Custom Dialog ["An error has ocurred. This record is locked or you do not have graphics/ccc.gif sufficient permission to access it."] End If 

Description:

This script step attempts to acquire exclusive access to the current record. Exclusive access prevents other users from editing the record. It has the same effect as a user selecting a data field on a layout (by clicking or tabbing) and then beginning to enter or edit field data. These actions either give exclusive access to that user, or, if another user has already acquired exclusive access (otherwise known as a "lock"), the user attempting to gain control of the record sees an error message with a warning that another user has control of the record. It can be useful to try to gain exclusive access to a record in the course of a script. If you are looping over records and need to change each one, if a user is editing one of the records, your script may be prevented from changing it. Open Record/Request cannot override another user's access, but if the script step fails it generates an error that your script can inspect with the Get(LastError) statement.

Open Remote

Compatibility: Mac: yes

Windows: yes

Web: no


Menu Equivalent: F ile, Open Re m ote

Syntax:

 

 Open Remote 

Options:

None

Examples:

 

 Show Custom Dialog ["Do you want to look for a networked database?"] If [Get (LastMessageChoice) = 1]    #1=Yes, 2=No    Open Remote End If 

Description:

This script step opens the Open Remote dialog box to allow the opening of a shared FileMaker Pro database over a network connection.

Comments:

When the user closes the dialog box, the remaining steps in the script, if any, are executed.

Open ScriptMaker

Compatibility: Mac: yes

Windows: yes

Web: no


Menu Equivalent: S cripts, S criptMaker

Syntax:

 

 Open ScriptMaker 

Options:

None

Examples:

 

 Show Custom Dialog ["Open ScriptMaker?"] If [Get (LastMessageChoice) = 1]    #1=Yes, 2=No    Open ScriptMaker End If 

Description:

This script step opens the ScriptMaker dialog box, which enables a user to create, edit, rename, and duplicate scripts. When this script step is performed, FileMaker halts the current script because if any currently-executing scripts were to be edited, the resulting behavior could be unpredictable.

Open Sharing

Compatibility: Mac: yes

Windows: yes

Web: no


Menu Equivalent: E dit, S h aring, FileMaker N etwork (Windows) or FileMaker Pro, Sharing, FileMaker Network (Mac OS)

Syntax:

 

 Open Sharing 

Options:

None

Examples:

 

 Show Custom Dialog ["Do you want to open the sharing dialog?"] If [Get (LastMessageChoice) = 1]    #1=Yes, 2=No    Open Sharing End If 

Description:

This script step opens the FileMaker Network Settings dialog box where users can configure network database sharing.

Open URL

Compatibility: Mac: yes

Windows: yes

Web: yes


Menu Equivalent : None

Syntax:

 

 Open URL [No dialog; <URL>] 

Options:

Perform Without Dialog prevents the Open URL Options dialog box from displaying when the script step executes.

Specify may be selected to display the Open URL Options dialog box, where the URL can be typed directly into the text entry area or created by a calculation.

Examples:

 

 Open URL [No dialog; "http://www. apple. com/"] Open URL [No dialog; "file://c:/addresses. txt"] Open URL [No dialog; "mailto:no-one@name. net"] Open URL [No dialog; "fmp7://system:password@192. 168. 10. 46:591/WebDB"]  #Note about the last example: "system" is the FileMaker Pro account name, "password" is graphics/ccc.gif that account's password, and "WebDB" is the FileMaker Pro filename. 

Description:

This script step allows a URL to be opened in the appropriate application. Supported schemes include HTTP, FTP, file , mailto , and HTTPS. FileMaker consults the operating system preferences to help decide which application to use to service a particular URL scheme.

Comments:

This could be one effective means to an asset management solution. If the solution stores only references to the files, and the files are stored in a Web server directory, FileMaker can construct a full URL to the file based on the reference in the database, and bring the file up in the user's browser with an Open URL command.

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.

Paste

Compatibility: Mac: yes*

Windows: yes

Web: yes


Menu Equivalent: E dit, P aste

Syntax:

 

 Paste [Select; No style; <table::field>] 

Options:

Select Entire Contents replaces the contents of a field with the contents of the Clipboard. If Select Entire Contents is not used, Paste copies the contents of the Clipboard to the currently selected portion of the field.

Paste Without Style tells FileMaker Pro to ignore all text style and formatting associated with the Clipboard contents.

Select Go To Target Field or click Specify to specify the field into which to paste.

Link If Available (Windows only) tells FileMaker Pro to choose a link over other formats on the clipboard. If both a link and an embedded object are present on the clipboard, the link is selected. If a link is available, it is selected over other formats.

Examples:

 

 Go to Record/Request/Page [First] Copy [Select; Customer::ZipCode] Loop   Go to Record/Request/Page [Next; Exit after last]   Paste [Select; No style; Customer::ZipCode] End Loop 

Description:

This script step pastes the contents of the clipboard into the specified field in the current record. If the data type of the data being pasted does not match the type of the field being pasted into, FileMaker Pro displays the customary validation alert when the record is committed. (It's also possible that the script that calls the Paste step may leave the record in an uncommitted state, in which case the error dialog appears later, when the record is committed.) If the field is not on the current layout, FileMaker Pro returns an error code, which can be captured with the Get(LastError) function. In a Web-published database, use a Commit Record/Request script step after a Paste script step to update the record in the browser window.

Comments:

Paste 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 .

Pause/Resume Script

Compatibility: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: None

Syntax:

 

 Pause/Resume Script [Duration (seconds) <n>] 

Options:

Specify displays the Pause/Resume Options dialog box, where the following options can be set.

Select Indefinitely to pause the script until the user clicks the Continue button in the Status Area.

Select For Duration to enter the number of seconds to pause the script.

Select For Duration and click Specify to create a calculation that determines the number of seconds to pause.

Examples:

 

 Perform Find [Restore] Pause/Resume Script [Indefinitely] Set Field [Contacts::Status; "Ready for Review"] 

Description:

This script step pauses a script for a specified period of time or indefinitely. This enables the user to perform data entry or other tasks before continuing the script. This step brings the active window of the file in which the script step is running to the foreground if it is not already there. The duration of a pause must be a number and represents the number of seconds that the pause will last before resuming execution for the script. Most FileMaker Pro menu options are not available to users while in a paused script. While paused , a script displays a Continue button in the status bar. The pause is terminated when a user clicks this button. There is also a Cancel button, which appears only if the Allow User Abort option is set to On. This button exits the currently running script. In the case where the status bar is hidden, the Enter key performs the same function as the Continue button. Buttons that run other scripts function while the current script is paused. Thus a button may be linked to a script that executes the Resume Script step. A script run in this way is run as a subscript of the paused script.

Perform AppleScript

Compatibility: Mac: yes

Windows: no

Web: no


Menu Equivalent: None

Syntax:

 

 Perform AppleScript ["<applescript text>"] 

Options:

Specify to display the Perform AppleScript Options dialog box, where the following options can be set:

Calculated AppleScript lets you draw the AppleScript code from the result of a calculation.

Native AppleScript allows you to enter an AppleScript by hand (up to 30,000 characters long).

Examples:

 

 #This example sets the primary monitor to its minimum bit depth. Perform AppleScript ["tell application "Finder" to set bounds of window "My Files" to {100 graphics/ccc.gif , 100, 100, 100}"] 

Description:

This script step sends AppleScript commands to an AppleScript-aware application. The AppleScript may be typed in manually or generated as the result of a specified calculation. Calculated scripts are compiled every time the script is run, whereas typed-in scripts are compiled only when the script is edited. Obviously, the latter is a faster process, but creating AppleScript code via a calculation provides much greater flexibility.

Comments:

Perform AppleScript is supported only on the Mac OS. The script step generates an error on Windows. For more information on AppleScript and AppleEvents, see the "Apple Events Reference" included with FileMaker Pro.

Perform Find

Compatibility: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: None

Syntax:

 

 Perform Find [Restore] 

Options:

Select Specify Find Requests or click Specify to create or edit one or more find requests that will be stored with the script steps.

New opens a dialog box that enables you to create and specify a new find request to be stored with the script step.

Edit opens a selected find request from the existing list for editing.

Duplicate duplicates one or more selected find requests from the list and adds them to the stored set.

Delete deletes one or more selected find requests from the list.

Use the Edit Find Request dialog box to work with find request criteria.

Use Find Records or Omit Records to specify the behavior of the request. Selecting Omit Records is equivalent to checking the Omit check box in a find request in Find mode. Finding records adds them to the current found set. Omitting records excludes them. As in Find mode, use multiple requests if it's necessary to both find and omit records in the course of a single stored search.

Find Records When (or Omit Records When ) shows a list of the fields in your current table. To construct a find request, begin by selecting a field from this list.

To select a field from a related table, click the name of the current table at the top of the list and select the related table you want. Select a related field from this new list.

Change the value in Repetition to specify a particular cell of a repeating field.

Type the search criteria for the selected field in the Criteria area.

Click Add to add criteria to the find request.

To change existing criteria, select the line containing the field and criteria from the top of the dialog box, and make the changes to the field and/or criteria. Click Change to store changes.

To delete existing criteria, select the line containing the field and criteria from the top of the dialog box and click Remove.

Examples:

 

 Set Error Capture [On] Perform Find [Restore] #check for a "no records" error If [Get (LastError) = 401]    Show Custom Dialog ["Sorry, no records were found. "] End If 

Description:

This script step places the system in Find mode and performs the search request(s) that have been designated for this step. If no find requests have been designated, then the last find request(s) that the system performed is performed. If the system is in Find Mode when Perform Find is executed, then the currently entered find request is performed. This behavior is often used in conjunction with the Enter Find Mode step with the Pause option selected to allow a user to define a search request or group of search requests and then perform them. If FileMaker Pro doesn't find any records that match the find criteria when a script is performed, the script can be stopped , execution of the script can be resumed with zero records in the current found set, and the find criteria can be changed. With the Set Error Capture script step and the Get(LastError) function, a script to handle such situations can be written.

Perform Find/Replace

Compatibility: Mac: yes

Windows: yes

Web: no


Menu Equivalent: None

Syntax:

 

 Perform Find/Replace [No dialog; "<text to be found>"; "<replacement text>"; Find Next graphics/ccc.gif /Replace & Find/Replace/Replace All] 

Options:

Perform Without Dialog inhibits the display of the Find/Replace Summary dialog box at the end of the Find/Replace operation. This option also prevents display of the confirmation dialog box when a Replace All operation is executed.

If it is desired that the user be able to enter find or replace criteria, use the Open Find/Replace script step.

Specify displays the Specify Find/Replace dialog box, where search options, as well as the type of find/replace operation to be performed, can be set.

Examples:

 

 Perform Find/Replace ["hte"; "the"; Replace All] 

Description:

This script step finds the specified text, and, if directed, replaces it with either literal text or the result of a calculation. The scope of the operation can be defined to be the current record or the entire found set. The Find/Replace can span all fields in a layout or just the current field. The operation can be defined to proceed forward or backward in the current found set (as sorted). Finally, options are available for the matching of whole words only instead of parts of words, and for the matching of case.

Perform Script

Compatibility: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: None

Syntax:

 

 Perform Script ["<script name>"; Parameter: <parameter>] 

Options:

To select a script, click Specify and choose the script from the list.

Specify a script parameter using the optional script parameter choice. You can specify the parameter as text, or click Edit and specify the parameter by means of a calculation formula.

Examples:

 

 Go to Layout ["Detail"] Perform Script ["Find Contact"; Parameter: Contact::ContactID] 

Description:

This script step performs a script either in the current file or in another FileMaker Pro file. Scripts can be as simple or as complex as is required, but it is often more efficient to break larger scripts into smaller subscripts for ease of re-use and debugging. Script parameters allow scripts to communicate with one another without having to use database fields or globals. The script parameter may be accessed with the Get(ScriptParameter) function. It is important to note that script parameters exist only within a script into which they have been explicitly passed. For a subscript to have access to the parameter of the script that called it, it must, in turn , be passed into the subscript. Script parameters exist for only as long as the script to which they are passed exists. Parameter strings can contain many pieces of information as long as they are properly separated. Carriage returns and separator characters are common ways to pass many pieces of information in a parameter string.

For more information using script parameters and subscripts in programming, see Chapter 15, "Advanced Scripting," p. 421 .


Print

Compatibility: Mac: yes

Windows: yes

Web: no


Menu Equivalent: F ile, P rint

Syntax:

 

 Print [Restore; No dialog] 

Options:

Perform Without Dialog prevents a dialog box from displaying when the script step executes. Ordinarily, users would see a dialog box permitting them to use their own settings. When this option is selected, FileMaker Pro uses the print settings that are stored with the script step.

Select Specify Print Options or click Specify to open the Print dialog box and set generic printing options, including the printer, number of copies, and the pages to print. FileMaker Pro can also set printing options such as printing the current record, printing records being browsed, or printing a blank record.

Examples:

 

 Go To Layout ["Detail View"] Show All Records Sort Records [Restore; No dialog] Print Setup [Restore; No dialog] Print [] 

Description:

This script step prints selected information from a FileMaker Pro file. This information can include field contents, reports , and field or script definitions. Print setup is stored with the script step, but may be changed with the Print Setup script step. Multiple Print steps may be used in a single script.

Comments:

Printer settings generally do not transfer well between platforms. Unless your settings are very generic, you may need separate Print or Print Setup steps for each platform you intend to support. You may need to check the current user's platform with Get(SystemPlatform) and use separate print setups for each different platform.

Print Setup

Compatibility: Mac: yes

Windows: yes

Web: no


Menu Equivalent: F ile, Print S etup

Syntax:

 

 Print Setup [Restore; No dialog] 

Options:

Perform Without Dialog prevents a dialog box from displaying when the script step that lets the user enter new printing options executes. When this option is selected, FileMaker Pro uses the print settings that are stored with the script step.

Select Specify Print Options or click Specify to open the Print dialog box and set generic printing options, including the printer, number of copies, and the pages to print. FileMaker Pro can also set printing options such as printing the current record, printing records being browsed, or printing a blank record.

Examples:

 

 Go To Layout ["Detail View"] Show All Records Sort Records [Restore; No dialog] Print Setup [Restore; No dialog] Print [] 

Description:

This script step sets printing options such as printer, print layout, number of copies, and so on, which can all be stored within the script step. There is the option to allow the user to modify the print setup by presenting him or her with the Print Setup dialog box. Multiple Print Setup steps may be used in a single script.

Comments:

Printer settings generally do not transfer well between platforms. Unless your settings are very generic, you may need separate Print or Print Setup steps for each platform you intend to support. You may need to use Get(SystemPlatform) to check the current user's platform and use separate print setups for each different platform.

Re-Login

Compatibility: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: None

Syntax:

 

 Re-Login [Account Name: <account name>; Password: <password>; No dialog] 

Options:

Perform Without Dialog prevents the Open File dialog box from displaying when the script step executes. When this option is unchecked, users see a normal FileMaker authentication dialog. When this option is checked, FileMaker Pro uses the account and password information that is stored with the script step, or derives the information from calculations.

Click Specify to display the Re-Login Options dialog box, where you can set the following options:

Account Name is the name of the account to be authenticated. This may be entered as literal text, or Specify can be clicked to create a new account name from a calculation.

Password is the password for this account. Literal text may be entered or Specify clicked to create a new password from a calculation.

Examples:

 

 Re-Login [Account Name:"User"; Password:"Password"; No dialog] 

Description:

This script step allows a user to log in to the current database with a different account name and password. This does not require the database file to be closed or re-opened. Privileges assigned to the new account take effect immediately, including access to tables, records, layouts, scripts, and value lists. Users get five attempts to enter an account and password, unless the Set Error Capture script step is enabled. If the Set Error Capture script step is enabled, users get a single attempt to enter an account and password. If a user fails the allotted number of times, she must close and re-open the database file before she can try to access the database again.

Comments:

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.

Recover File

Compatibility: Mac: yes

Windows: yes

Web: no


Menu Equivalent: F ile, Reco v er

Syntax:

 

 Recover File [No dialog; "<filename>"] 

Options:

Perform Without Dialog prevents a dialog box from displaying after the script step completes. Ordinarily, users would see a dialog box that shows how many bytes of data were recovered, the number of records and field values skipped, and the number of field definitions recovered.

Select Specify Source File or click Specify to display a dialog box where you can select the file to be recovered. If you don't select a source file, the Open Damaged File dialog box displays when the script is run.

Examples:

 

 Recover File [No Dialog; "DataFile.fp7"] 

Description:

This script step recovers damaged FileMaker Pro files. In the recovery process, FileMaker Pro attempts to repair and recover as much of the information in a damaged file as is possible. It then creates a new file and saves it to the selected directory. The original file is not deleted or replaced. The new recovered file is named exactly as the damaged file except "Recovered" is appended to its filename, before any extenders. For example, the recovery of DataFile.fp7 would produce the file DataFile Recovered.fp7 .

Comments:

Recover File is intended only to recover data from a corrupted file. It does not remove any corruption that may be present in the file, nor does it render the file fit for production use again. You should never re-use a file that has been recovered! Import the extracted data into the most recent clean backup of the file and discard the recovered version.

Refresh Window

Compatibility: Mac: yes

Windows: yes

Web: no


Menu Equivalent: None

Syntax:

 

 Refresh Window 

Options:

None

Examples:

 

 Freeze Window Go to Record/Request/Page [First] # Give everyone a 10% raise. Loop    Set Field [Employee::Salary; Employee::Salary * 1. 1]    Go to Record/Request/Page [Next; Exit after last] End Loop Refresh Window 

Description:

This script step updates the active FileMaker Pro document window. Use Refresh Window after Freeze Window to update a window.

Comments:

This step may also be used to force a portal to refresh after match fields (such as keys or other IDs) have been modified. It may also happen that complex related data is slow to refresh in a window, or user interactionsuch as a mouse clickmay be required to show the changed data. If you find such behavior, you may be able to cure it with an explicit Refresh Window step.

Relookup Field Contents

Compatibility: Mac: yes

Windows: yes

Web: yes*


Menu Equivalent : R ecords, Reloo k up Field Contents

Syntax:

 

 Relookup Field Contents [No dialog; <table::field>] 

Options:

Perform Without Dialog prevents a dialog box from displaying when the script step that lets the user confirm field information executes.

Select Go To Target Field or click Specify to specify the field that is the match field of the relookup operation. FileMaker Pro moves the cursor to the field you specify. This must be the match field for the relationship upon which the lookup is based, not the lookup source or target field. If no field is selected, Relookup Field Contents returns an error code.

Examples:

 

 Relookup Field Contents [No dialog, Invoice::Customer ID] 

Description:

Use Relookup to "refresh" values that are copied from one place to another via the Lookup field option. It's important to realize that you must specify the field that's the match field for the lookup operation, rather than any of the fields that will receive the newly copied data. As an example, imagine you have a system with a Customer table and an Invoice table. The two tables are related by a shared CustomerID. The Invoice table also has fields for Customer Name and Customer Address, which are defined to look up the corresponding fields from the related Customer record. To "refresh" the customer name and address information on one or more invoices, it would be necessary to specify the Customer ID field in Invoices, which is the match field that links the two tables, rather than specify either of the two fields intended to receive the refreshed. Note that the relookup operates only on records in the current found set.

Comments:

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.

Replace Field Contents

Compatibility: Mac: yes

Windows: yes

Web: yes*


Menu Equivalent: R ecords, R e place Field Contents

Syntax:

 

 Replace Field Contents [No Dialog; <table::field>; Current contents/Serial numbers graphics/ccc.gif /Calculation results] 

Options:

Perform Without Dialog prevents display of the Replace Field Contents dialog box when the script step executes.

Select Go To Target Field or click Specify to specify the target field for the replace operation.

Click Specify to display the Replace Contents dialog box, where you can determine the settings required for the Replace Field Contents command so that they'll be stored in the script.

Replace With Current Contents uses the current value in the specified field as the replacement value to place in that field in every other record in the current found set.

Replace With Serial Numbers updates the field with new serial numbers in every record in the current found set.

Entry Options consults the underlying database structure to determine how to serialize records. In particular, it causes the Replace step to use the database field settings for Next Value and Increment by, as stored in the field options for that field.

Custom Values lets you enter a value to be used as a starting point for the serialization, as well as a value by which to increment each serialized field in the current found set.

Update Serial Number In Entry Options resets the serial number value in the entry options for the field, so that the next serial number that is automatically entered follows the records you have reserialized with this script step. If this option is not used, the serial value in Entry Options is not changed, and may not be in sequence with the newly reserialized records. This may lead to duplicated serial numbers or data validation errors.

If the field to be replaced was set up for auto-entry of a serial number and Prohibit Modification of Value is not selected, FileMaker Pro still puts sequential numbers in the selected field, but does so starting with the next number to be automatically entered.

Replace With Calculated Result displays the Specify Calculation dialog box, where you can enter a calculation to be used as the replacement value.

Examples:

 

 # Fill in full names Replace Field Contents [No Dialog; Contacts::FullName; FirstName & " " & LastName] 

Description:

This script step replaces the contents of a selected field in the current record or every record in the found set with either a designated field's value or a calculated result. This step can also be used to reserialize a field in every record in the found set. Note that if the specified field does not exist on the layout where the script is being performed, Replace Field Contents returns an error code which can be captured with the Get(LastError) function.

Comments:

It may be helpful to think of this step as being akin to filling in multiple cells in a spreadsheet column. Replace is particularly powerful when used in conjunction with a calculation (a technique often known as a calculated replace ). The calculation can reference fields, which refer to the field values in whichever is the current record. So in a database with fields for FirstName and LastName, you could create an additional text field called FullName, and use a calculated replace to insert the results of a formula concatenating first and last names together with a space in between.

Reset Account Password

Compatibility: Mac: yes

Windows: yes

Web: yes


Menu Equivalent : None

Syntax:

 

 Reset Account Password [Account Name: <account name>; New Password: <password>; Expire graphics/ccc.gif password] 

Options:

Click Specify to display the Reset Account Password Options dialog box.

Account Name is the name of the account with the password to be reset. You can enter literal text or click Specify to create a new account name from a calculation.

New Password is the new password for this account. Literal text may be entered or Specify clicked to create a new password from a calculation.

When User Must Change Password On Next Login is selected, this option forces users to change their password the next time they log in to the database.

Examples:

 

 Reset Account Password [Account Name:"Guest User"; New Password:"guestpassword"; Expire graphics/ccc.gif password] 

Description:

This script step resets the account password for the selected account. The selected account must be existing. The Full Access privilege set is needed to perform this script step. The Run with Full Access Privileges option may be selected in the ScriptMaker dialog box to circumvent this restriction for all users.

Comments:

Be aware that using User Must Change Password On Next Login does not work correctly when users log in to a solution via the Web. It's also important to make sure that any user with that restriction can modify his password.

Revert Record/Request

Compatibility: Mac: yes

Windows: yes

Web: yes*


Menu Equivalent: R ecords, R evert Record

Syntax:

 

 Revert Record/Request [No dialog] 

Options:

Perform Without Dialog inhibits the display of a confirmation dialog when the script step executes.

Examples:

 

 Show Custom Dialog ["Do you want to save your changes?"; "Click 'Save' to save your changes, or 'Revert' to return the record to its original state."] #1 = Save, 2 = Revert If [Get(LastMessageChoice) = 1] Commit Records/Requests Else    Revert Record/Request [No dialog] End If 

Description:

This script step discards changes made to a record and its fields, assuming the record has not been saved. After changes have been committed, such as through use of the Commit Records/Requests script step, they can no longer be reverted. This is also true if a user has clicked outside of any field.

Comments:

Note that record reversion applies not only to the current record on whatever layout is being viewed, but also to any records in related tables that are displayed in a portal on the current layout. If a user has edited one or more records in a portal, the Revert Record/Request script step, if carried out, undoes all uncommitted changes to portal records, as well as any uncommitted changes to the current record.

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.

Save a Copy As

Compatibility: Mac: yes

Windows: yes

Web: no


Menu Equivalent: F ile, Save a Cop y As

Syntax:

 

 Save a Copy as ["<filename>"; copy/compacted/clone] 

Options:

Specify Output File displays the Specify Output File dialog box, which allows specification of the name and location of the resulting copy. If a save location is not specified in the script, FileMaker Pro displays a regular Save As dialog box so the user can specify copying options.

Use Specify to choose a save format: copy of current file, compacted copy (smaller), or clone (no records).

Examples:

 

 Save a Copy as ["Customers.bak"] 

Description:

This script step saves a copy of the current file to the designated location. If no location is designated, a dialog box is presented to the user. Three types of copies are available. Copy creates an exact replica of the current file. Compressed also creates a copy of the current file, but the copy will be compressed to utilize space more efficiently . This sort of copy takes longer to create but is generally smaller than the original. Clone creates a file that's structurally identical to the current database but contains no data. This is useful for backup purposes because clones are very compact.

Scroll Window

Compatibility: Mac: yes

Windows: yes

Web: no


Menu Equivalent: None

Syntax:

 

 Scroll Window [Home/End/Page Up/Page Down/To Selection] 

Options:

Use Specify to choose a scrolling option.

Home, End, Page Up , or Page Down scrolls the window to the beginning, to the end, up a page, or down a page.

To Selection brings the current field into view (similar to tabbing into a field).

Examples:

 

 Go to Field[ "Scroll Right"] Scroll Window [To Selection] #The next step just makes sure we leave the "scroll to" field Commit Records/Requests 

Description:

This script step scrolls a window to its top or bottom, up or down, or to a specified field.

Comments:

You may want to use this script step for rapid, easy scrolling within a window. For example, if you've had to design a layout that's wider than some users screens, you can put dummy "scroll left/scroll right" fields at the far left and right sides of the layout. If you make the field small and forbid entry, the user will not notice them. Then a script like the example above scrolls quickly to the right side of the window (assuming the field is placed somewhere to the right).

Select All

Compatibility: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: E dit, Select A ll

Syntax:

 

 Select All 

Options:

None

Examples:

 

 Go To Field [Contacts::Statement] Select All Copy [] Go To Field [Contacts::PreviousStatement] Paste[] 

Description:

This script step selects the entire contents of the current field.

Select Dictionaries

Compatibility: Mac: yes

Windows: yes

Web: no


Menu Equivalent: Edit, Spelling, Select Dictionaries

Syntax:

 

 Select Dictionaries 

Options:

None

Examples:

 

 Select Dictionaries Check Record 

Description:

This script step opens the Select Dictionaries dialog box. This is often used to give users access to the Select Dictionaries dialog box when access to the FileMaker Pro menus has been restricted.

Select Window

Compatibility: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: None

Syntax:

 

 Select Window [<name of window>] 

Options:

Current Window brings the active window of the file that contains the script to the foreground.

Otherwise, click Specify to select the window FileMaker Pro should bring to the foreground. The name may be typed as literal text, or derived from a calculation.

Examples:

 

 Select Window [Name: "Contract Players"] 

Description:

This script step specifies a window by name and makes it the current window. FileMaker Pro script steps are always performed in the foreground table. It is, therefore, sometimes necessary to bring a specific window to the front. Use this script step when working with scripts in multi-table files to make certain that a script step is performed in the intended table. (You may also need to use a Go to Layout step to establish context correctly.) The Select Window script step does not open a window of a related file when the related file is open in a hidden state, such as when a file is opened, because it is the source file of a related field. The related file must be explicitly opened with the Open File script step before its windows are allowable targets for the Select Window step.

Send DDE Execute

Compatibility: Mac: no

Windows: yes

Web: no


Menu Equivalent: None

Syntax:

 

 Send DDE Execute [<topic text or filename>; <service name>] 

Options:

Click Specify to display the Send DDE Execute Options dialog box.

Service Name is the name of the application that executes the commands. Refer to the documentation of the application being specified for the valid service name. The service name may be entered directly as text or Specify clicked to create the service name from a calculation.

Topic is a filename or text string that describes the topic on which the application executes the commands. Refer to the documentation of the application specified in the Service Name for valid topics. Enter the topic name directly as text, or click Specify to create the topic name from a calculation.

Commands are calculated values or text strings that specify what the application does. Refer to the documentation of the application specified in the Service Name for valid commands and formats. Enter the commands directly as text or click Specify to create the commands from a calculation.

Examples:

 

 Send DDE Execute [Service Name: "iexplore"; Topic: "WWW_OpenURL"; Commands: "www graphics/ccc.gif .moyergroup.com"] 

Description:

This script step sends a DDE (Dynamic Data Exchange) command to another DDE-aware application. FileMaker sends DDE commands but does not receive them. When a FileMaker Pro script first establishes a DDE connection, the connection stays open to execute subsequent script steps for the same service name and topic. If the script includes another DDE Execute script step that specifies a different service name or topic, FileMaker Pro closes the current connection and opens another with the new service name and topic. All open connections close when the script is completed.

Send Event (Windows)

Compatibility: Mac: no

Windows: yes

Web: no


Menu Equivalent: None

Syntax:

 

 Send Event ["<aevt>"; "<event name>"; "<filename>"] 

Options:

Click Specify to display the Send Event Options dialog box.

For Send The < Event Name > Message , select

  • Open Document/Application to tell FileMaker Pro to open a document file or application. The application that Windows has associated with the document's file type is used to open it.

  • Print Document to tell FileMaker Pro to print a document in another application.

Select File or click Specify to specify a document/application to open or a document to print.

Select Calculation or click Specify to create a message from a calculation.

Select Text to manually enter text for the message to be sent.

Select Bring Target Application To Foreground to activate the target application and display it on the screen. Displaying the target application can slow down the performance of a script. If Bring Target Application To Foreground is not selected, the event is performed in the background.

Examples:

 

 #To launch the Notepad application, select the open document/application message, click graphics/ccc.gif File, and specify notepad.exe. The following script step appears in the Script Definition graphics/ccc.gif dialog box: Send Message ["NOTEPAD.EXE", "aevt", "odoc"] 

Description:

This script step communicates with other Windows applications. It can instruct them to either open or print a document in its associated application. Custom code written in a language such as C or BASIC can be executed this way.

Send Event (Mac OS)

Compatibility: Mac: yes

Windows: no

Web: no


Menu Equivalent: None

Syntax:

 

 Send Event ["<Target Application>"; "<Event Class>"; "<Event ID>", "<Document or graphics/ccc.gif Calculation or Script Text>"] 

Options:

Click Specify to display the Send Event Options dialog box.

Send The < Value > Event With offers a choice between the following:

  • Open Application tells FileMaker Pro to open an application. Click Specify Application to select the application.

  • Open Document tells FileMaker Pro to open a document in the target application. You can also specify a calculated value or script.

  • Do Script tells FileMaker Pro to perform a script in the language of the target application. Click Specify Application to select an application, and use Document to select the document to use with the target application. Or select Script Text and enter script text or type in the name of the script. (Make sure it is one that will be recognized by the target program.)

  • Other displays the Specify Event dialog box, where you can manually enter the Apple Event class and Event ID.

Select Document or click Specify to select the document you want used with the target application.

Select Calculation or click Specify to create a calculation that generates a value you want to send with the event.

Bring Target Application to Foreground activates the target application and displays it on the screen. Displaying the target application can slow down the performance of a script. If Bring Target Application to Foreground is not selected, the event is performed in the background.

Wait for Event Completion Before Continuing tells FileMaker Pro to wait until the event is finished before continuing. If you don't want to wait until the event is completed, deselect this option.

Copy Event Result to the Clipboard copies the resulting events data to the Clipboard, from which it can later be retrieved. This option is disabled if Bring Target Application to Foreground is selected.

Click Specify Application to display a dialog box where you can select the target application.

Examples:

 

 Send Event ["TextEdit", "aevt", "oapp"] 

Description:

This script step sends an Apple Event to another Apple Eventaware application. The desired event is selected in the Send Event Options dialog box. When FileMaker Pro sends an Apple event, it sends text (not compiled) data. You must know what information the target application expects to receive with an event. Each Send Event script step sends one event. You can include more than one Send Event in a script.

Send Mail

Compatibility: Mac: yes

Windows: yes

Web: no


Menu Equivalent: None

Syntax:

 

 Send Mail [No dialog; To: <to>; CC: <CC>; BCC: <BCC>; Subject: <subject>; Message: graphics/ccc.gif <message>; "<attachment>"] 

Options:

Perform without dialog instructs FileMaker Pro to put the composed email message in the email application's Out box, ready to be sent. If this option is not selected, the composed message is left open in the email application so that it can be reviewed. In Microsoft Outlook Express or Microsoft Entourage on the Macintosh operating system, the new message is left in the Drafts folder.

Click Specify to display the Specify Mail dialog box, where options for mail can be set. For each of the following options, one can enter text directly, or click > to enter values from an address book, field, or calculation.

  • Select Specify Email Addresses to select an email address from the email application's address book.

  • Select Specify calculation to create an address (or subject or message text) from a calculation.

  • Select Specify Field Name to choose a single field that contains the desired value.

  • If the Specify Field Name option is used to specify a value for the To:, CC:, or BCC: entries, one can also select Get Values from Every Record in Found Set to specify that all the values from this field in the current found set be used (to address a message to multiple recipients).

To stores the address(es) of the recipient(s).

CC stores the address(es) of the carbon copy recipient(s).

BCC stores the address(es) of the blind carbon copy recipient(s).

Subject indicates the title for the email message.

Message indicates the text of the email message. The message may be typed as text, designated as a field value, or created by a calculation.

Select Attach File to select a file to send as an attachment to the mail message.

Examples:

 

 Perform Find [Restore] # Send the same email to everyone in the found set. Send Mail [To: sContacts::email; Subject: "This is a test email"; Message: "Testing..." 

Description:

The Send Mail script steps allow you to send email to one or more recipients via a client-side email application. The following things are necessary to send mail from FileMaker:

  • Windows: A [Mail] section in the Win.ini file, and Microsoft Exchange or another email application that is MAPI-compliant, installed and configured to work with an existing email account.

  • Mac OS: Mac OS X Mail or Microsoft Entourage installed and configured as the default email application.

Comments:

To send mail, you must have an Internet connection and a correctly-configured email client (see the previous Description section for configurations). It's not possible to use the Send Mail step to send email via an SMTP server.

Set Error Capture

Compatibility: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: None

Syntax:

 

 Set Error Capture [<on or off>] 

Options:

Setting Error Capture to On suppresses most FileMaker Pro alert messages and some dialog boxes. If the error result is 100 or 803, then certain standard file dialog boxes are suppressed, such as the Open dialog box.

Setting Error Capture to Off re-enables the alert messages.

Examples:

 

 Perform Find [Restore] Go to Record/Request/Page [First] Open Record/Request If [ Get(LastError) = 200 or Get(LastError) = 300]    Show Custom Dialog ["An error has ocurred. This record is locked or you do not have graphics/ccc.gif sufficient permission to access it."] End If 

Description:

This script step suppresses or enables the FileMaker Pro error dialogs and messages. This provides the developer with the opportunity to write scripts to handle errors in a manner that is customizable and appropriate to the functions being performed. The Get(LastError) function, when used immediately after a script step is executed, gives the code of the error that was encountered, if an error was encountered.

Set Field

Compatibility: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: None

Syntax:

 

 Set Field [<table::field>; <value or formula>] 

Options:

Select Specify Target Field or click Specify to specify the field whose contents you want to replace. If no field is specified and a field is already selected in Browse mode or Find mode, that field is used.

Click Specify to define a calculation, the results of which will replace the current contents of the target field.

Examples:

 

 Freeze Window Go to Record/Request/Page [First] # Give everyone a 10% raise. Loop    Set Field [Employee::Salary; Employee::Salary * 1.1]    Go to Record/Request/Page [Next; Exit after last] End Loop Refresh Window 

Description:

This script step replaces the contents of the designated field on the current record with the result of the specified calculation. The result of the calculation must match the field type of the target field, or the results may be unexpected. Unlike many other script steps that deal with field contents, Set Field does not require that the field being targeted be on the active layout. If the result of the calculation doesn't match the target field type, and the Validate option for the field is set to Always, the field is not set and an error code is returned (which can be captured with the Get(LastError) function).

Comments:

When possible, the Set Field script step makes the record active and leaves it active until the record is exited or committed. Scripts that use a series of Set Field script steps should thus group these steps together if possible, so that subsequent Set Field script steps can act on the record without having to lock the record, synchronize data with the server, index the field, and so on, after each individual Set Field script step. Synchronization, indexing, and record-level validation are performed after the record has been exited or committed.

Set Multi-User

Compatibility: Mac: yes

Windows: yes

Web: no


Menu Equivalent: None

Syntax:

 

 Set Multi-User [On/On (Hidden)/Off] 

Options:

Select On to allow network access via FileMaker Network Sharing. This is the same as enabling Network Sharing and selecting All Users in the FileMaker Network Settings dialog box.

Select On (Hidden) to allow network access but prevent the name of the shared database from appearing in the Open Remote File dialog box. This is the same as enabling Network Sharing and selecting the All Users and Don't Display in Open Remote File dialog options in the FileMaker Network Settings dialog box.

Select Off to disallow network access. This is the same as selecting No Users in the FileMaker Network Settings dialog box.

Examples:

 

 If [Get (MultiUserState) = 0]   Show Custom Dialog ["Would you like to enable network sharing?"]   If [Get (LastMessageChoice) = 1]      Set Multi-User [On]   End If End 

Description:

This script step allows or disallows network access to the current database. The Hidden option allows a file to be accessed by other files and in dialogs but not through the Open Remote dialog.

Comments:

If FileMaker's Network Sharing is currently set to Off, both of this script step's On options will also enable network sharing. This could possibly enable sharing access to other files than just the one in which this script step is run. The converse is not true: The Off option to this script step does not also turn off FileMaker Network Sharing. It's sometimes helpful to have Set Multi-User On/Off script steps in all the files of a multi-file solution. By means of a single master script in one of the files, all these individual files can execute their Set Multi-User On/Off scripts. This makes it possible to fully enable or fully disable multi-user access to a set of files with just a single script.

Set Next Serial Value

Compatibility: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: None

Syntax:

 

 Set Next Serial Value [<table::field>; <value or formula>] 

Options:

Select Specify Target Field or click Specify to specify the serial number field on which the script step is to operate. The field specified must be defined as an auto-entry serial number field.

Calculated Result: Click Specify to enter the next serial value or create a calculation to determine the next serial value.

Examples:

 

 Find All Set Next Serial Value [Contacts::ContactID;Contacts::MaxContactID + 1] # Note: MaxContactID would be a summary field defined as the max of the serial field ContactID 

Description:

This script step resets the Next Serial Value for an auto-enter serial number field. This is especially useful to ensure that there are no duplicate serial numbers when a large number of records have been imported into a backup clone of a system. It is also useful for importing records when it is not desirable to allow auto-enter calculations. The calculated result always evaluates to a text result. Note this script step can operate on multiple files. If a field in another file is specified, then FileMaker Pro attempts to update the serial number for the specified field in the other file. To specify a field in another file, define a relationship to that file and use Specify Target Field to select a field from that file. Also, if a serial number is not strictly a number, special care must be taken to ensure that the newly set serial number matches the format of the existing serial numbers.

Comments:

This script step does not change any field data. Instead, it changes the definition of the target field. Specifically, it changes the Next Serial Number you see in the Field Options dialog for that field.

Set Selection

Compatibility: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: None

Syntax:

 

 Set Selection [Start Position: <n>; End Position: <n>] 

Options:

Select Go To Target Field or click the Specify button by the check box to specify the field whose contents you want to select.

The second Specify option lets you set the starting and ending positions of a selection, either by entering the start and end numbers directly or by using a calculation to determine them.

Examples:

Description:

This script step makes it possible to "select" some or all of a field's contents without direct user intervention. It's possible to specify the start and end positions (in terms of numbers of characters) for the new selection. You might do this to "set up" additional operations that act on the current selection, such as cut or copy. You might also choose to transform the selection, for example by removing it and substituting a styled version of the same text. This script step allows the setting of the starting and ending position of a selection within a field. These values may be entered literally or generated as the result of a specified calculation. This step does not operate on container fields. Data that is out of the visible portion of a layout or field is scrolled into view to show the newly selected contents. The start and end values must be integers between 1 and the number of characters in the target field. If the start position number is valid and the end position number is invalid, then the selection goes from the start position number to the end of the field contents. If the start position number is invalid and the end position is valid, the cursor (or insertion point) is placed at the specified end position with no characters selected. If neither the start nor the end numbers are valid, then the cursor is placed at the end of the fields' contents.

Comments:

Set Selection 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 , and Paste .

Set Use System Formats

Compatibility: Mac: yes

Windows: yes

Web: no


Menu Equivalent: None

Syntax:

 

 Set Use System Formats [On] 

Options:

Use System Formats may be set to On or Off .

Examples:

 

 If [Get (SystemLanguage) <> "English"]    Set Use System Formats [On] End If 

Description:

FileMaker Pro databases store date, time, and number format preferences. These are taken from the computer on which the database was created. These creation settings may differ from those in use on other machines on which the database may be open. This script step can be used to determine whether a file draws its time display settings from those stored in the file, or those in effect on the local machine.

Set Window Title

Compatibility: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: None

Syntax:

 

 Set Window Title [Current Window or Name: <name of window>; New Title: <new window name>] 

Options:

Click Specify to set all the options for this script.

Window to Rename tells FileMaker Pro which window to rename. Current Window renames the current window. You may also specify a different window, either by typing the window name in plain text or deriving the window name from a calculation.

New Name is the new title for the window. Here again, you can enter literal text or click Specify to derive a name from the result of a calculation.

Examples:

 

 Set Error Capture [On] Allow User Abort [Off] Perform Find [Restore] Set Window Title [Get(FoundCount) &" Contacts Found"] 

Description:

Set Window Title sets the name of the current window or the window specified by name.

Comments:

Window names aren't case sensitive when you select them in this way, so be sure not to rely on case sensitivity in window names.

Set Zoom Level

Compatibility: Mac: yes

Windows: yes

Web: no


Menu Equivalent: None

Syntax:

 

 Set Zoom Level [Lock; 25%...400%/Zoom In/Zoom Out] 

Options:

Lock prohibits users from making changes to the zoom level.

Specify lets you select a zoom level:

  • Specific reduction values: 100%, 75%, 50%, or 25%.

  • Specific enlargement values: 150%, 200%, 300%, or 400%.

  • Zoom In: reduces the screen image by one zoom level.

  • Zoom Out: enlarges the screen image by one zoom level.

Examples:

 

 Allow User Abort [Off] Set Error Capture [On] If[ // the screen resolution to too low// Get (ScreenHeight) < 600]   Set Zoom Level [Lock; 100%] Else   Set Zoom Level [100%] End 

Description:

Set Zoom Level enlarges or reduces the image on the screen and optionally locks screen scaling. It is equivalent to using the magnification icons beneath the status area.

Show All Records

Compatibility: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: R ecords, Sho w All Records

Syntax:

 

 Show All Records 

Options:

None

Examples:

 

 Allow User Abort [Off] Set Error Capture [On] Enter Find Mode [Pause] Perform Find [] If[// no records were found// Get(CurrentFoundCount) = 0]   Show Message ["No Records Found"; "Sorry, no records that match your find criteria were graphics/ccc.gif found."]   Show All Records [ ] // don't leave the user on an empty found set 

Description:

Displays all the records in the current table and leaves the user on the current record. Show All Records is used in Browse mode or Preview mode. If you perform this step in Find mode or Layout mode, FileMaker Pro switches to Browse mode after the records have been found.

Show Custom Dialog

Compatibility: Mac: yes

Windows: yes

Web: no


Menu Equivalent: None

Syntax:

 

 Show Custom Dialog [<title>; <message text>; Table1::input field 1;. . . ] 

Options:

Click Specify to display a dialog box, where you can set the dialog box title, message text, and buttons, and specify up to three fields to use for input or display.

General options:

Title lets you specify the title of the custom dialog box. You can enter literal text or click Specify to create the dialog box title from a calculation.

Message lets you specify the message of the dialog box. You can enter literal text or click Specify to create the message text from a calculation.

Button Labels let you specify how many buttons (up to three) to display in the custom dialog box and labels for these buttons. If you leave a button label blank, the button does not appear in the custom dialog box. If you leave all button titles blank, an OK button displays in the lower-right corner of the custom dialog box.

Input Field options:

Select Show input field <n> to activate an input field.

Select Specify to choose the field for input. Each input area maps to one field.

Select Use Password Character (*) to mask text as it is entered, or as it is displayed from the database. This option obscures data being input into the custom dialog box or being displayed, but does not alter the actual data as it is stored in the database.

Use Label to specify a field label (the text that will identify this input to the user). You can enter literal text or create the label from a calculation.

Examples:

 

 Allow User Abort [ Off ] Set Error Capture [ On ] # Show Custom Dialog [ Title: "Password Change"; Buttons: "OK", "Cancel"; Input #1: zgPassword_Old. t, "Old Password:"; Input #2: zgPassword_New. t, "New Password:" ] # If [ /* user did not cancel the dialog */ Get(LastMessageChoice)=1 ]   Change Password [ Old Password: zgPassword_Old. t; New Password: zgPassword_New. t ]   # send password change onto other files   Perform Script [ "Change Password"; from file "Contacts" Parameter: zgPassword_Old. graphics/ccc.gif t&""&zgPassword_New. t ]   Perform Script [ "Change Password"; from file "Invoices" Parameter: zgPassword_Old. graphics/ccc.gif t&""&zgPassword_New. t ] End If # be sure to clear the globals for security reasons Set Field [zgPassword_Old.t; ""] Set Field [zgPassword_New.t; ""] 

Description:

Show Custom Dialog enables you to display a custom message dialog box. The dialog box is modal, with from one to three buttons, each with a custom title. The custom message window can also display up to three input fields, each with a custom label. Each of these input fields corresponds to a FileMaker data field. When the window is opened, each input area displays the most recent contents of the corresponding field. When the user closes the window, the button clicked can be determined by the Get(LastMessageChoice) function. A result of 1 represents the first button on the right, whereas 2 and 3 would represent the middle and leftmost buttons if they were used. Button 1, the rightmost, is the default. It's also the only button that, when clicked, causes the data from any input fields to be written back to the corresponding FileMaker fields.

Comments:

If values entered into any input fields don't match the field type of the underlying FileMaker field, a validation error message displays. The user must resolve validation errors before the dialog box can be closed. The fields you specify don't need to appear on the current layout. Show Custom Dialog input fields are independent of layouts, similar to the Set Field script step. And as with the Set Field script step, Show Custom Dialog bypasses the Allow Entry Into Field field formatting option. Data entry via the Show Custom Dialog script step is limited by any access privilege rules that may be in place. In other words, users can't use a custom dialog to edit data in fields that they can't normally change because of access restriction. If you select Run Script With Full Access Privileges, this restriction is lifted. On Windows, you can create a keyboard shortcut for a custom dialog box button by placing an ampersand before the shortcut key letter in the button label. For example, to create a keyboard shortcut D (Alt+D) for a button labeled Done, type the label &Done .

Show Omitted Only

Compatibility: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: R ecords, Show Om i tted Only

Syntax:

 

 Show Omitted Only 

Options:

None

Examples:

 

 // reduce found set to zero Show All Records Show Omitted Only 

Description:

Show Omitted Only "inverts" the found set to show records that are currently not displayed, and omits records that are currently displayed.

Show/Hide Status Area

Compatibility: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: None

Syntax:

 

 Show/Hide Status Area [Lock; Show/Hide/Toggle] 

Options:

Lock prohibits the user from using the status area control button to manually show or hide the status area.

Show tells FileMaker Pro to show the status area.

Hide tells FileMaker Pro to hide the status area.

Toggle switches between showing and hiding the status area (equivalent to clicking the status area control button).

Examples:

 

 Allow User Abort [Off] Set Error Capture [On] Go to Layout ["Invoice"] Show/Hide Status Area [Lock; Show] // show status area so the user can click 'Continue' Enter Preview Mode [Pause] Show/Hide Status Area [Lock; Hide] // shut the status area back down Enter Browse Mode [ ] Go To Layout [Original Layout] 

Description:

Show/Hide Status Area allows for control of the status area from scripts.

Comments:

In databases where it's important to tightly control the user's navigation, it may be desirable to prevent users from using the status area either to page through records or to change layouts. Hiding and locking the status area may well be the right thing to do in such a case.

Show/Hide Text Ruler

Compatibility: Mac: yes

Windows: yes

Web: no


Menu Equivalent: V iew, Te x t Ruler

Syntax:

 

 Show/Hide Text Ruler [Show/Hide/Toggle] 

Options:

Show tells FileMaker Pro to show the text ruler.

Hide tells FileMaker Pro to hide the text ruler.

Toggle switches between showing and hiding the text ruler.

Examples:

 

 Allow User Abort [Off] Set Error Capture [On] If[ // the screen resolution to too low// Get (ScreenHeight) < 600]   Show/Hide Text Ruler [Hide] End 

Description:

Hides or shows the text ruler. Choosing the Toggle option switches the current state of the ruler. The Text Ruler is used with text fields, and also to aid in design in Layout mode. It can be used to set tabs and indents for a text area. Hiding the text ruler is sometimes required to save screen space. Unless you have disabled access to menus, users are generally able to enable the text rulers by choosing View, Text Ruler, and it may later be desirable to disable the rulers again to save room.

Sort Records

Compatibility: Mac: yes

Windows: yes

Web: yes*


Menu Equivalent: R ecords, S ort Records

Syntax:

 

 Sort Records [Restore; No dialog] 

Options:

Perform Without Dialog prevents display of a dialog box that lets the user enter a different set of sort instructions.

Select Specify Sort Order or click Specify to create a sort order and store it with the script step. When Specify Sort Order is not selected, FileMaker Pro uses the most recently executed sort instructions.

Examples:

 

 Allow User Abort [Off] Set Error Capture [On] # find overdue invoices Perform Find [Restore] # sort by due date and customer Sort [Restore] Go to Layout ["Invoice"] Enter Preview Mode [Pause] Enter Browse Mode [ ] Go To Layout [Original Layout] Unsort 

Description:

Sort Records sorts the records in the current found set according to specified criteria. Be sure to perform any operations that might change the found set before calling Sort Records . If you sort a repeating field, FileMaker Pro sorts on only the first entry in that field. Note that in previous versions of FileMaker Pro, only one sort order could be saved with a script. However, in the current version, sort criteria are saved with individual Sort Record script steps, so any number of sorts can be saved with a single script.

Comments:

Note that saved sort criteria are relative to the current table context. If the table Contact was the active table when the sort criteria were entered, and fields from Contacts are used in the sort order, then that table must be active when the sort is executed. If your sort step makes field references that are not valid at the time the step is executed, the invalid field references are ignored. Table context is controlled by the current layout; to change table context, navigate to a layout that is used by the table in question.

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.

Speak

Compatibility: Mac: yes

Windows: no

Web: no


Menu Equivalent: None

Syntax:

 

 Speak [<text to be spoken>] 

Options:

Click Specify to display the Speak Options dialog box, where you can set the following options.

You can enter the text to be spoken directly by hand, or draw the text from a calculation.

Use Voice lets you select from the various voices available on your computer.

Wait for Speech Completion Before Continuing tells FileMaker Pro to wait until the speech is completed before continuing with the next script step. If you leave this option unchecked, the script continues while the text is being spoken.

Examples:

 

 Speak ["Hello"] Speak[Get(CurrentDate)] 

Description:

Speaks the specified text. You can specify which voice synthesizer to use and whether or not FileMaker Pro is to wait for the speech to be completed before continuing with the next script step. On a computer without speech capabilities, the script can still be edited, but only the default voice synthesizer is available. Speak script steps are not executed when the script is run on a computer without speech capability.

Spelling Options

Compatibility: Mac: yes

Windows: yes

Web: no


Menu Equivalent: F ile, F ile Options, Spelling

Syntax:

 

 Spelling Options 

Options:

None

Examples:

 

 # a button on a layout calls this script step directly: Spelling Options 

Description:

Opens the Spelling tab of the File Options dialog box. Use this script step to open the File Options dialog box for users if you have restricted their access to FileMaker Pro menus.

Undo

Compatibility: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: E dit, U ndo

Syntax:

 

 Undo 

Options:

None

Examples:

 

 Undo 

Description:

Undo acts the same as choosing Undo from the edit menu: The most recent edits to the record are reversed .

Unsort Records

Compatibility: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: None

Syntax:

 

 Unsort Records 

Options:

None

Examples:

 

 Allow User Abort [Off] Set Error Capture [On] Enter Browse Mode [] Unsort Records Go to Record/Request/Page [First] 

Description:

Unsort Records restores the found set to its natural order (order in which records were created).

Update Link

Compatibility: Mac: no

Windows: yes

Web: no


Menu Equivalent: None

Syntax:

 

 Update Link [<table::field>] 

Options:

Select Go to Target Field or click Specify to specify the field to be updated.

Examples:

 

 Set Error Capture [On] Allow User Abort [Off] Update Link [Contact::Resume] If [//an error occured// Get(LastError)]   Show Message ["An error occurred updating the resume link"] End If 

Description:

Update Link updates the OLE link in the specified container field. If the field does not contain an OLE link, then Update Link returns an error. Both manual and automatic links are updated.

View As

Compatibility: Mac: yes

Windows: yes

Web: yes


Menu Equivalent: V iew, View As For m /Li s t/Tabl e

Syntax:

 

 View As [Form/List/Table/Cycle] 

Options:

View as Form tells FileMaker Pro to display records page by page on the current layout, so that only one record at a time is shown.

View as List tells FileMaker Pro to display records as records in a list, so that the user can see multiple records at once in a list.

View as Table tells FileMaker Pro to display the records on screen in a spreadsheet-like grid.

Cycle switches from the current view type to the next type.

Examples:

 

 Set Error Capture [On] Allow User Abort [Off] Go to Layout ["Contact List"] View As [View As List] 

Description:

View As sets the view mode for the current layout. Note that Layout Setup can be used to limit which views are accessible via the View menu, but the View As script step can override those settings and enable you to view a layout in any of the three styles.

 < Day Day Up > 


QUE CORPORATION - Using Filemaker pro X
QUE CORPORATION - Using Filemaker pro X
ISBN: N/A
EAN: N/A
Year: 2003
Pages: 494

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net