FileMaker 10 ® Script Steps Reference
© 2004-2009 FileMaker, Inc. All Rights Reserved. FileMaker, Inc. 5201 Patrick Henry Drive Santa Clara, California 95054 FileMaker, the file folder logo, Bento and the Bento logo are trademarks of FileMaker, Inc. in the U.S. and other countries. Mac and the Mac logo are the property of Apple Inc. registered in the U.S. and other countries. All other trademarks are the property of their respective owners. FileMaker documentation is copyrighted.
Contents About script steps Creating scripts to automate tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Using this script steps reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Learning about scripts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Fields script steps Set Field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Set Field By Name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Set Next Serial Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Insert Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Close Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Adjust Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Move/Resize Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Arrange All Windows. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Open Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Open Remote . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Open Manage Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Open Sharing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
About script steps About script steps Creating scripts to automate tasks Scripts can do simple tasks like setting print orientation or complex tasks like preparing a customized mailing to each client. For example, you could define a complex set of scripts that creates a thank you letter to clients in your Client database who have made a purchase in the last week. The script composes a letter tailored to each client.
Script steps reference (alphabetical list) Script steps reference (alphabetical list) A, B, C Add Account . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 Adjust Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 Allow Toolbars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Script steps reference (alphabetical list) Extend Found Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 F Flush Cache to Disk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 Freeze Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 G Go to Field . . . . . . . . . . . . . . .
Script steps reference (alphabetical list) Open Manage Data Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 Open Manage Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 Open Manage Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124 Open Manage Value Lists . . . . . . . . . . . . . . . . . . . . . .
Script steps reference (alphabetical list) Set Zoom Level . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 Show All Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 Show Custom Dialog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 Show Omitted Only . . . . . . . . . . . . . . .
Control script steps Alphabetical headings for script steps reference: A, B, C D E F G H, I, J, K L, M, N O P Q, R S, T U, V, W, X, Y, Z Control script steps Control script steps control the progression of the script by letting you tell FileMaker Pro exactly what to do when and if specific conditions occur.
Control script steps Script parameters: • exist within the parent script only unless explicitly passed to the sub-script, as shown in examples three and four below. If your script calls another script, parameters in the called script are independent of parameters in the parent script. • exist only for the duration of the script. Script parameters are reset each time a script is performed.
Control script steps Script: Get New Account Info #Clear the Account Name and Password fields for new information Set Field [ first_table::account_name; "" ] Set Field [ first_table::password; "" ] Show Custom Dialog [ Title: "Create A New Administrator Account"; Message: "Please enter an account name and pasword for your new user.
Control script steps debug your scripts, for example, to see what value is in a field at a particular point in a script or to evaluate the progress of a script. The Pause/Resume Script script step operates on the foreground window of the file from which the script is performed. If the script’s current window is hidden, Pause/Resume Script brings that window to the front and shows it. The For duration value must evaluate as a number, which is the duration of the pause in seconds.
Control script steps Examples #Example 1: Master Mailing Label Script Go to Layout ["Mailing Labels"] Perform Script ["Find records for California mailing"] Go to Layout ["List View"] #Find records for California mailing sub-script Perform Find [Restore] If [Get (ScriptResult)=0] Show All Records Go to Layout ["Data Entry"] Exit Script Else Print [] End If #Example 2: Assign Letter Grade If [Get(ScriptParameter) >= 90] Exit Script[Result: "A")] Else If [Get(ScriptParameter) >= 80] Exit Script[Result: "B"]
Control script steps Description While pressing Esc will also halt a script, Halt Script is useful if you are also using the Allow User Abort script step to disable the Esc key. Halt Script stops the script when Allow User Abort is set to Off. Examples You can use the Halt Script script step with the Show Custom Dialog script step to present a user with options. If the user clicks Cancel, the script stops; otherwise, the script continues.
Control script steps Examples If [Get (AccountName) = "Jim Davis"] Go to Layout [“File One”] Perform Find [Restore] End If Else If Purpose Evaluates a Boolean calculation and performs a conditional action based on that evaluation, like the If script step. Format Else If [] Options Click Specify to define the Boolean calculation.
Control script steps Note In this example, Get(AccountName) only returns usable values if database users log in using assigned account names. If no accounts are created or required, Get (AccountName) returns the default value ‘Admin’. Else Purpose Performs one set of steps if a calculation is True (not zero), and another set of steps if the calculation is False (zero). Format Else Options None.
Control script steps Description Every If script step must have a corresponding End If script step somewhere after it at the same indentation. Whenever you use an If script step, the Manage Scripts feature automatically enters an End If step. Examples If [Table1::State = "CA"] Perform Script ["Compute CA Tax and Total"] Else Perform Script ["Compute Total"] End If Loop Purpose Repeats a set of script steps. Format Loop Options None.
Control script steps Exit Loop If Purpose Exits a loop if the specified calculation is True (not zero). Format Exit Loop If [] Options Click Specify to define the Boolean calculation. In the Specify Calculation dialog box, type the calculation you want evaluated, or use the field list (on the left) and the functions list (on the right) with the mathematical and text operators to build the calculation.
Control script steps End Loop Purpose Marks the end of a Loop script structure. Format End Loop Options None. Compatibility This script step is also supported in web publishing and in a FileMaker Server scheduled script. Description Whenever you use a Loop script step, the Manage Scripts feature automatically enters an End Loop step. The steps between Loop and End Loop are automatically indented and the End Loop step is placed at the same indentation level as its corresponding Loop step.
Control script steps Description By default, Allow User Abort is turned on for an entire script. In other words, users can stop a script by pressing Esc or Command-.(period) (Mac OS). To prevent users from stopping a script, use the Allow User Abort script step and set it to Off. FileMaker Pro automatically turns Allow User Abort on after the script finishes running. Examples To set up a kiosk solution, use: Allow User Abort[Off] Then, create the rest of the script as a looping script that never ends.
Control script steps Compatibility This script step is: • not supported in web publishing • not supported in a FileMaker Server scheduled script Description Use this script step to handle errors in a manner consistent with the functions the script performs. By using the Get(LastError) function immediately after a script step, you can verify that the step was performed properly. By using the Get (LastError) function with the control script steps, you can make sure your script performs correctly.
Control script steps Compatibility This script step is also supported in web publishing and in a FileMaker Server scheduled script. Description If a variable doesn’t exist, this script step will create one. A variable name has the same naming restrictions as a field name. For more information, see About naming fields. Local and global variables can be created and used in calculations. • A local variable can only be used in script steps in the currently executing script.
Control script steps Description This step repeats until the window in which it is running closes or its options change. You can also halt the step by specifying another Install OnTimer Script script step for the window with no script specified. The default interval is zero; you must specify a script name and an interval. Examples The following example runs the script MyScript every 10 minutes.
Navigation script steps Navigation script steps Navigation script steps move to different areas of a database.
Navigation script steps • Layout Name by calculation recognizes layouts with the same names in the order in which they were created. If you have multiple layouts with the same name, either select the specific layout you want from the layout list or use Layout Number by calculation. • Define an unstored calculation field with the function Get(LayoutNumber) function and place it on your layouts to verify the layout numbers of your layouts.
Navigation script steps Examples Go Go Go Go to to to to Record/Request/Page Record/Request/Page Record/Request/Page Record/Request/Page [First] [Last] [Previous] [Next] This command uses a calculation to determine the correct number: Go to Record/Request/Page [MyDatabase::Number Field] Go to Related Record Purpose Goes to the current related record(s) in a related table, except when this script step is used from an active portal row.
Navigation script steps Compatibility This script step is also supported in web publishing and in a FileMaker Server scheduled script. Description If this script step is used from an active portal row, and the portal’s table is the related table, then the related record in that table is made current. If the portal’s table is not the related table, the first related record in the found set is made current. You have the option to view the related records in a new window.
Navigation script steps Options Specify lets you choose from the following options. • First moves to the first row in the portal. • Last moves to the last row in the portal. • Previous moves to the previous row in the portal. Exit after last tells FileMaker Pro to exit the loop or the enclosing script. • Next moves to the next row in the portal. Exit after last tells FileMaker Pro to exit the loop or the enclosing script.
Navigation script steps Compatibility This script step is also supported in web publishing and in a FileMaker Server scheduled script. Description This script step uses an object name to identify an object, so you must assign a unique object name to each object on a layout that you want to go to. Note If the object is a repeating field, you can also specify which repetition that you want to go to.
Navigation script steps Description This script step can also perform an action on an object in that field. For instance, in a container field, it can play a sound or a movie, or activate an OLE object (Windows). To play a sound or movie, or perform the primary command for an OLE object (Windows), use the Select/perform option. Note If this script step specifies a field in a tab panel that is not in front, the specified field is selected and the tab panel it is in moves to the front of the tab control.
Navigation script steps Go to Previous Field Purpose Moves to the previous field in the tab order of the current layout. Format Go to Previous Field Options None. Compatibility This script step is also supported in web publishing and in a FileMaker Server scheduled script. Description If no field is selected when this script step is performed, this script step moves to the last field of the tab order of the current layout.
Navigation script steps Show All Records Sort [Restore, No dialog] Enter Find Mode Purpose Switches to Find mode, where you can search for sets of records. Format Enter Find Mode [Restore; Pause] Options • Pause temporarily stops the script to allow the user to enter a find request. • Specify find requests allows you to create and edit requests for use with this script step. Compatibility This script step is also supported in web publishing and in a FileMaker Server scheduled script.
Navigation script steps Enter Preview Mode Purpose Switches to Preview mode, where you can see how records, forms, or reports will look when they're printed. Format Enter Preview Mode [Pause] Options Pause temporarily stops the script to allow you to examine the preview result before proceeding with the next step in the script.
Editing script steps Editing script steps With editing script steps, you can cut, copy, paste, or clear the contents of a field; undo or redo previous actions; or select the contents of a field. Undo/Redo Purpose Reverses, restores, or switches between the most recently performed actions in the file. Format Undo/Redo [Undo; Redo; Toggle] Options Undo reverses the previously performed action in the file. Redo restores the previously undone action in the file.
Editing script steps Options • Select entire contents deletes the contents of a field and saves it to the Clipboard. If you do not use Select entire contents, only the selected portion of the field's data is cut. • Select Go to target field or click Specify to select the field whose contents you want to cut. Compatibility This script step is also supported in web publishing and in a FileMaker Server scheduled script. Description This script step removes the contents of the field.
Editing script steps Examples Find All Copy [Select; Table1::RandomTimesNumber] Paste [Select; Table1::SortNumber] Replace Contents [No dialog; Table1::SortNumber] Sort Records[Restore, No dialog] Commit Records/Requests [] Paste Purpose Pastes the contents of the Clipboard into the specified field in the current record. Format Paste [Select; No style; ] Options • Select entire contents replaces the contents of a field with the contents of the Clipboard.
Editing script steps Clear Purpose Deletes the contents of the specified field in the current record. Format Clear [Select; ] Options • Select entire contents deletes the entire contents of a field. If you do not use Select entire contents, only the selected portion of the field's data is deleted. • Select Go to target field or click Specify to specify the field whose contents you want to delete.
Editing script steps Compatibility This script step is also supported in web publishing and in a FileMaker Server scheduled script. Description The starting and ending values can be typed in directly or determined via a calculation. If no target field is specified the current active field is used. Notes • Field position is determined by the number of characters, including spaces, beginning with position 1, the first character in the field.
Editing script steps Examples Go to Field [Table1::Performance Review] Select All Copy [] Go to Record/Request/Page [Next] Go to Field [Performance Review] Paste [] Perform Find/Replace Purpose Finds/replaces data according to the options in the Specify Find/Replace dialog box.
Fields script steps Fields script steps Fields script steps operate on specific fields. With these script steps, you can: • paste data into fields • import information into fields • evaluate a calculation and assign the result to a field Set Field Purpose Replaces the entire contents of the specified field in the current record with the result of a calculation.
Fields script steps Examples The following example calculates 7 percent of the Salary field and assigns the result to the field SDI. Note that Set Field works whether or not the field is on the active layout. Set Field [Table1::SDI; Salary * .07] Set Field By Name Purpose Replaces the entire contents of a calculated target field in the current record with the result of the calculated value.
Fields script steps Example 1 In the following example, a calculation identifies the target field in which a value should be replaced based on the geographical location in which the data was entered. Then the script enters a calculated value in the target field based on the appropriate currency exchange rate.
Fields script steps Options • Select Specify target field or click Specify to specify the serial number field on which the script step will operate. The field you specify 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. Compatibility This script step is also supported in web publishing and in a FileMaker Server scheduled script.
Fields script steps Options • Select entire contents replaces the contents of a field. If you do not select this option, Insert Text inserts the specified value at the end of the field's data. • Select 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 will place the specified text after the insertion point. If no field is active at the time the command executes, it has no effect.
Fields script steps Options • Select entire contents replaces the contents of a field. If you don't select this option, 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. • Select Go to target field or click Specify to specify the field to paste the calculated results into. The target field must be present on the layout to paste successfully.
Fields script steps Description This script step displays the index for the active field. You can use Insert From Index in Browse or Find modes. FileMaker Pro displays the View Index dialog box so the user can select an entry. This method promotes consistent data entry and correct spelling. For this script step, you can specify a field and select the entire contents of the field.
Fields script steps Compatibility This script step is also supported in web publishing and in a FileMaker Server scheduled script. Description Use this script step to ensure consistency and automate data entry. The active record is the last record where FileMaker Pro performed some activity, such as pasting text or moving into a field with the Go to Field script step.
Fields script steps Examples Go to Record/Request/Page [First] Enter Find Mode [] Insert Current Date [Select; Invoices::Invoice Date] Insert Current Time Purpose Pastes the current system time into the specified field. Format Insert Current Time [Select; ] Options • Select entire contents replaces the contents of a field with the current time. If you do not select this option, Insert Current Time adds the value of the current time to the end of the field's existing data.
Fields script steps Compatibility This script step is: • not supported in web publishing • not supported in a FileMaker Server scheduled script Notes • If the specified field does not exist on the layout where the script is being performed, Insert Current User Name returns an error code which can be captured with the Get(LastError) function. • User name is the FileMaker Pro user, an editable field displayed on the General tab of the Preferences dialog box.
Fields script steps Notes • You must specify a field, click in a field, or use the Go to Field script step before performing this script step. If you have not specified a graphic to be imported, FileMaker Pro displays a dialog box, where the user can select the graphic file to import. • If there is no active container field on the layout where the script is being performed, Insert Picture returns an error code that can be captured with the Get(LastError) function.
Fields script steps Examples Go to Field [Table1::Product Demo] Insert QuickTime [“”] Insert Object (Windows) Purpose Embeds or links an OLE object in the current container field. Format Insert Object [“
Fields script steps Insert File Purpose Imports a file or a reference to a file into the current container field. Format Insert File [Reference; ; “”] Options • Store only a reference instructs FileMaker Pro to store only a link to a file in the container field instead of 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 won't be able to display it.
Fields script steps Compatibility This script step is: • not supported in web publishing • not supported in a FileMaker Server scheduled script Description If the field does not contain an OLE link, then this script step does not return an error code.
Fields script steps value in Entry Options is not changed, and may not be in sequence with the newly reserialized records. • 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 will still put sequential numbers in the selected field, but will do so starting with the next number to be automatically entered.
Fields script steps Compatibility This script step is also supported in web publishing and in a FileMaker Server scheduled script. Notes • The target field specified for the Relookup Field Contents step must be an editable field. • Relookups are only performed on the found set of records in the active table. • Calculation fields cannot be used for the Relookup Field Contents command.
Fields script steps Examples Go to Layout [Images::Nature Scenes] Export Field Contents [Images::Original Pictures;”Uncropped.
Records script steps Records script steps Records script steps affect specific records and find requests. Use these script steps to: • add, delete, and copy records or find requests • change field contents in all records in the found set • commit and revert records • import and export records New Record/Request Purpose In Browse mode, creates a new, blank record. In Find mode, creates a new find request. Format New Record/Request Options None.
Records script steps Compatibility This script step is also supported in web publishing and in a FileMaker Server scheduled script. Description If the record has a field set up for automatic entry of values, this script step does not duplicate the value in the field of the current record. In that case, FileMaker Pro generates and enters a new value for the duplicated record.
Records script steps Description To delete Do this A master record Make sure that the record you want to delete is active (use navigation script steps), and then use Delete Record/Request. If the current layout contains a portal, use Exit Record/Request to make sure that no related record is selected, then use Delete Record/Request. A related record Use the Delete Portal Row script step.
Records script steps Examples The following script selects the first portal row in the current record and then deletes that row with no confirmation dialog box. Go to Portal Row [First] Delete Portal Row [No dialog] Delete All Records Purpose Deletes all the records in the current found set. Format Delete All Records [No dialog] Options Perform without dialog prevents a message box from displaying when the script step executes that asks the user to confirm the deletion of records.
Records script steps Options None. Compatibility This script step is also supported in web publishing and in a FileMaker Server scheduled script. Description When performed on a record, this script step verifies that the user has sufficient access privileges to edit the record. If the user has the proper privilege set, FileMaker Pro attempts to prevent others from simultaneously editing or deleting the record. Once locked, the record is considered “opened” and may be edited.
Records script steps Examples Show Custom Dialog ["Commit record or revert changes?"; "Click 'Commit' to save your changes, or 'Revert' to discard changes to this record."] #1 = Commit, 2 = Revert If [Get(LastMessageChoice) = 1] Commit Records/Requests Else Revert Record/Request [No dialog] End If Commit Records/Requests Purpose Commits a record.
Records script steps Examples Show Custom Dialog ["Commit record or revert changes?"; "Click 'Commit' to save your changes, or 'Revert' to discard changes to this record."] #1 = Commit, 2 = Revert If [Get(LastMessageChoice) = 1] Commit Records/Requests Else Revert Record/Request [No dialog] End If Copy Record/Request Purpose Copies the values of a record or find request to the Clipboard. Format Copy Record/Request Options None.
Records script steps Paste [Select; History table::History] Commit Records/Requests [] Copy All Records/Requests Purpose In Browse mode, copies the values of all records to the Clipboard. In Find mode, copies all find requests. Format Copy All Records/Requests Options None. Compatibility This script step is also supported in web publishing and in a FileMaker Server scheduled script.
Records script steps Import Records Purpose Imports records from another file or data source you specify. Format Import Records [No dialog; “”; Add/Update existing/ Update matching; ] Options • Perform without dialog prevents display of import-related dialog boxes when the script step executes. However, if a data source file has not been specified, the Open File dialog box will be displayed when a script is run from FileMaker Pro.
Records script steps When you choose this file or source ODBC Data Do this Specify the data source name and location, the user ID and password (if any), and the SQL query to be executed. You can enter a query directly or specify a calculation to generate the query. For more information, see Automating ODBC import using the Import Records script step. Note If you use the Import Records script step to import ODBC data that contains Unicode strings, your ODBC driver must support Unicode.
Records script steps Notes • When using the Import Records script step or Export Records script step in a FileMaker Server scheduled script, keep the following in mind: • Any specified file must be in the FileMaker Server Documents folder, the temporary folder, or a child folder of either the FileMaker Server Documents folder or the temporary folder. For example, the following are all valid paths for file.csv: /file.csv /file.csv /Folder1/file.
Records script steps information on saving FileMaker Pro files as Excel files, see Saving and sending records as an Excel file. If you specify XML as the export file type, the Specify XML and XSL Options dialog box appears, where you can specify an XML grammar and choose an XSLT style sheet if you want to transform the XML. The XSLT source may be a file, the result of an HTTP request, or a calculation that generates a file path or an HTTP request.
Records script steps is run with the pathname file:/export.tab, and the file running the script is /MyFiles/ Library/Books.fp7, the exported file will be created as /MyFiles/Library/export.tab. Examples Go to Layout ["Layout #4"] Export Records [No dialog, "Contacts"] Save Records As Excel Purpose Saves records to a specified Excel or Excel 2007/2008 worksheet.
Records script steps Examples Go to Layout ["Layout #4"] Save Records As Excel [No dialog; "Contacts.xls"] Save Records As PDF Purpose Saves records to a specified PDF file. Format Save Records As PDF [Append; No dialog; “
Records script steps Compatibility This script step is: • not supported in web publishing • not supported in a FileMaker Server scheduled script • not supported in runtime solutions Description This script step operates in all modes except Find mode. Note (Mac OS) For runtime solutions, you can choose to print records as a PDF file, and the script will be saved with the printed file. Examples Go to Layout ["Layout #4"] Save Records As PDF [No dialog, "Contacts.
Found Sets script steps Found Sets script steps With Found Sets script steps, you can: • specify a find request to find records • extend or constrain the found set • modify the most recent find request • show all records • omit records from the found set • sort and unsort records Perform Find Purpose Enters Find mode and finds records that match one or more find requests that you set up, that are stored with the script step.
Found Sets script steps • To change existing criteria, select the line containing the field and criteria from the top of the dialog box, and make your changes to field and/or criteria. Click Change to store your changes. • To delete existing criteria, select the line containing the field and criteria from the top of the dialog box and click Remove. Compatibility This script step is also supported in web publishing and in a FileMaker Server scheduled script.
Found Sets script steps Compatibility This script step is also supported in web publishing and in a FileMaker Server scheduled script. Description This script step is equivalent to a logical AND search. Note If no records match the find criteria, this script step returns a found set of zero records. Examples Go to Layout ["Data entry"] Constrain Found Set [Restore] Sort Records [Restore; No dialog] Extend Found Set Purpose Broadens the existing found set using the criteria in the stored find request.
Found Sets script steps Options None. Compatibility This script step is also supported in web publishing and in a FileMaker Server scheduled script. Description Add a Perform Find script step after this script step to find records.
Found Sets script steps Examples Go to Layout [“Address Layout”] Show All Records Show Omitted Only Purpose Finds the records not in the current found set. Format Show Omitted Only Options None. Compatibility This script step is also supported in web publishing and in a FileMaker Server scheduled script. Description Use this script step in Browse mode or Preview mode. If you perform this script step in Find mode or Layout mode, FileMaker Pro switches to Browse mode after the records have been found.
Found Sets script steps Description This script step temporarily hides the current record. Omit Record only operates in Browse mode and Find mode. When this script step is performed in Find mode, it causes the find request to become an Omit request, as if the Omit checkbox had been selected.
Found Sets script steps Sort Records Purpose Sorts the records in the current found set according to specified criteria. Format Sort Records [Restore; No dialog] Options • Perform without dialog prevents display of a dialog box when the script step executes 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.
Found Sets script steps Unsort Records Purpose Restores the records in the current found set to their creation order (the order in which they were entered in the file). Format Unsort Records Options None. Compatibility This script step is also supported in web publishing and in a FileMaker Server scheduled script. Description Use this script step when it's important to maintain the original creation order, as with invoices entered by invoice number or membership records entered by date.
Windows script steps Windows script steps Windows script steps affect screen elements and windows. You can: • open or close a window • select a window • arrange windows • move or resize a window • update or freeze a window • scroll a window • show or hide a window, the status toolbar, or the text ruler • set the title of a window • set the zoom level • view data as a list, table, or form New Window Purpose Creates a new window based on the foreground window.
Windows script steps Description The new window has the same layout, same table, same found set, and same current record as the original window. Notes • Window names created with the New Window script step do not have to be unique. • Window name selection is not case-sensitive. • It is not necessary to enter values for each option. When no value is entered, FileMaker Pro uses the default value associated with the Window menu > New Window command.
Windows script steps Compatibility This script step is also supported in web publishing and in a FileMaker Server scheduled script. Description Because FileMaker Pro script steps are always performed in the foreground table, it is sometimes necessary to bring a specific window to the front. Use this script step when you are working with scripts in multi-table files to make certain that a script step is performed in the intended table. Notes • Window name selection is not case-sensitive.
Windows script steps Compatibility This script step is also supported in web publishing and in a FileMaker Server scheduled script. Examples Perform Find Sort Records Pause/Resume Close Window [Restore] [Restore] Script [Indefinitely] [Name: “Sales records”] Adjust Window Purpose Hides or changes the size of a window. Format Adjust Window [Resize to fit/Maximize/Minimize/Restore/Hide] Options Use Specify to choose an adjustment option.
Windows script steps Move/Resize Window Purpose Adjusts the size or location of the chosen window. Format Move/Resize Window [Current window or Name: ; Current file; Height: ; Width: ; Top: ; Left: ] Options Click Specify to set the move/resize options. • Current Window selects the current foreground window when the script step is performed. • Window Name selects an open window by name. You can enter literal text or click Specify to create a window name from a calculation.
Windows script steps • Maximum window height and width depend on the script user’s screen resolution. If the height or width values you specify are greater than the maximum, FileMaker Pro uses the maximum value possible. • You can move a window off-screen by supplying negative top and/or left values, which can be useful for multiple monitor environments. • Windows: FileMaker Pro orients the moved window to the top left corner of the visible part of the application window.
Windows script steps Examples Perform Find [Restore] Sort Records [Restore] New Window [Name: “Customers”; Height: 200; Width: 600; Top: 16; Left: 16] Arrange All Windows [Tile Vertically] Freeze Window Purpose Stops updating the active window. Format Freeze Window Options None.
Windows script steps Refresh Window Purpose Updates the entire contents of the FileMaker Pro document window, including any related records. Format Refresh Window Options Select Flush cached join results to delete the results of queries for related records and cause related records to be refreshed.
Windows script steps 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). Compatibility This script step is: • not supported in web publishing • not supported in a FileMaker Server scheduled script Examples Go to Record/Request/Page [First] Loop Set Field [Table1::Salary; Table1::Salary * 1.
Windows script steps Show/Hide Text Ruler Purpose Shows or hides the text ruler. Format 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. Compatibility This script step is: • not supported in web publishing • not supported in a FileMaker Server scheduled script Description Choosing the Toggle option switches the current state of the ruler.
Windows script steps • Rename window to is the new title for the window. You can enter literal text or click Specify to create a name using a calculation. Compatibility This script step is also supported in web publishing and in a FileMaker Server scheduled script. Description You can change the name of any open window. Note Window name selection is not case-sensitive.
Windows script steps View As Purpose Displays data in the specified format. Format View As [View as Form/View as List/View as Table/Cycle] Options • View as Form tells FileMaker Pro to display records page by page in the format determined by the database designer. • View as List tells FileMaker Pro to display records as records in a list, so they can be browsed without clicking the left and right arrows in the book.
Files script steps Files script steps Files script steps operate on entire files. With Files script steps, you can: • create a file • open or close a file • save a copy of a file • convert a file to FileMaker Pro • set multi-user status • recover a file • set print setup options • print New File Purpose Allows the user to create a new database file. Format New File Options None.
Files script steps Open File Purpose Opens the specified FileMaker file or allows the user to select a file to open. Format Open File [Open hidden; “”] Options • Open hidden causes FileMaker Pro to open and hide the specified database. • Specify lets you select a FileMaker Pro database or ODBC data source to open. Choose Add FileMaker Data Source or Add ODBC Data Source to locate and select a file. After you select a file, it is added to the Specify Table list.
Files script steps Close File Purpose Closes the specified FileMaker file. Format Close File [Current File/””] Options Specify lets you select a FileMaker Pro to close or an ODBC data source to disconnect from. Choose Add FileMaker Data Source or Add ODBC Data Source to locate and select a file. After you select a file, it is added to the Specify Table list. Choose Manage Data Sources to modify or delete a data source you’ve already added to the list.
Files script steps Options • Specify data source lets you choose the file or source of the data to be converted. If you don’t specify a file, FileMaker Pro displays the Open File dialog box when the script step executes. For more information about converting files, see the conversion information in the FileMaker Pro User’s Guide. • Depending on the file or source you choose, a dialog box may appear for specifying the following additional options.
Files script steps Set Multi-User Purpose Allows or disallows network access to a database. Format Set Multi-User [On/On (Hidden)/Off] Options • Select On to allow network access via FileMaker Network Sharing. This is the same as 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.
Files script steps Set Use System Formats Purpose Allows the user to choose between the formats stored with the file or the user's current system formats. Format Set Use System Formats [On/Off] Options • On instructs FileMaker Pro to use the current system formats. • Off instructs FileMaker Pro to use the formats saved with the file.
Files script steps Save a Copy as Purpose Saves a copy of the current database file. Format Save a Copy as [“”; copy/compacted/clone] Options Specify output file displays the Specify Output File dialog box, where you can specify the name and location of the resulting copy. For more information, see Creating file paths. If you do not specify a file, FileMaker Pro saves a copy of the current file and displays the Save As dialog box so the user can specify copying options.
Files script steps Perform without dialog applies only to default recovery operations. The Advanced Recover Options dialog box is not supported. • Select Specify source file or click Specify to display a dialog box where you can select the file to be recovered. For more information, see Creating file paths. If you don’t select a source file, the Open Damaged File dialog box displays at runtime.
Files script steps Description You can also have this script step performed with a dialog box so the user can specify print options. You can use multiple Print Setup script steps within a script. Examples Enter Browse Mode [] Go to Layout ["Layout #1"] Print Setup [Restore; No dialog] Show All Records Sort Records [Restore; No dialog] Print [] Print Purpose Prints information in a file.
Files script steps Description Multiple print steps can be added to a script. You can store print options with this script step, or allow the user to enter printing criteria when the step executes. If the print job needs special page setup options to print correctly, add a Print Setup script step before the Print step. Notes • When you use more than one Print script step in a script, the saved printer name applies to only the containing Print script step.
Accounts script steps Accounts script steps Accounts script steps allow you to create and manage user accounts. With Accounts script steps, you can: • add accounts • delete accounts • reset account passwords • change passwords • enable accounts • log in to a file using a different account and password Notes • Accounts created using script steps cannot be granted full access privileges (only accounts created manually).
Accounts script steps Compatibility This script step is also supported in web publishing and in a FileMaker Server scheduled script. Description The account name and password can be literals stored with this script step, or generated at runtime based on calculations that you set up. Notes • Account names must be unique. • You must be assigned the Full Access privilege set to perform this script step.
Accounts script steps Examples Delete Account [Account Name: "Guest Access account"] Reset Account Password Purpose Resets the password of the existing FileMaker Pro account you specify. Format Reset Account Password [Account Name: ; New Password: ; Expire password] Options • Click Specify to display the “Reset Account Password” Options dialog box, where you can set the following options.
Accounts script steps Change Password Purpose Changes the password for the current account. Format Change Password [Old Password: ; New Password: ; No dialog] Options Click Specify to display the “Change Password” Options dialog box, where you can set the following options. • Old Password is the old password for the current account. You can enter literal text or click Specify to generate the password from a calculation.
Accounts script steps Examples The following, used as a startup script with a password-protected database, presents the user with the Change Password dialog box every other time the database is opened (to encourage the user to change his or her password frequently). The gOpenCount field is a global number field that records how many times the database has been opened.
Accounts script steps Re-Login Purpose Allows the user to log in to the database using a different account and password without closing and reopening the file. Format Re-Login [Account Name: ; Password: ; No dialog] Options Perform without dialog prevents the Open dialog box from displaying when the script step executes.
Spelling script steps Spelling script steps With spelling script steps you can: • check the spelling in a selection of text • check the spelling of a record • check the spelling of an entire found set • correct a word • set spelling options for a file • select a dictionary • edit the user dictionary Check Selection Purpose Uses the spelling checker to check the selected text. Format Check Selection [Select; table::field] Options • Select entire contents checks all the text in the active field.
Spelling script steps Options None. Compatibility This script step is: • not supported in web publishing • not supported in a FileMaker Server scheduled script Examples Go to Record/Request/Page [First] Loop Check Record Go to Record/Request/Page [Next; Exit after last] End Loop Check Found Set Purpose Uses the spelling checker to check the contents of every field in the records being browsed. Format Check Found Set Options None.
Spelling script steps Correct Word Purpose Opens the Spelling dialog box so you can correct a word that FileMaker Pro has identified as misspelled. Format Correct Word Options None. Compatibility This script step is: • not supported in web publishing • not supported in a FileMaker Server scheduled script Description This script step is the same as choosing Edit menu > Spelling > Correct Word.
Spelling script steps Spelling Options Purpose Opens the File Options dialog box to the Spelling tab. Format Spelling Options Options None. Compatibility This script step is: • not supported in web publishing • not supported in a FileMaker Server scheduled script Description This script step is the same as choosing File menu > File Options > Spelling tab. Use this script step to open the File Options dialog box for users if you have restricted their access to FileMaker Pro menus.
Spelling script steps Compatibility This script step is: • not supported in web publishing • not supported in a FileMaker Server scheduled script Description This script step is the same as choosing Edit menu > Spelling > Select Dictionaries. Use this script step to open the Select Dictionaries dialog box for users if you have restricted their access to FileMaker Pro menus. Examples Select Dictionaries Edit User Dictionary Purpose Opens the User Dictionary dialog box.
Spelling script steps Examples The following script displays a message box that asks if the user wants to open the Edit User Dictionary dialog box, and opens it if the response is Yes.
Open Menu Item script steps Open Menu Item script steps Open Menu Item script steps open specific FileMaker Pro dialog boxes as if you had chosen the command from a menu. You could use one of these script steps to open a dialog box for users if you have restricted their access to FileMaker Pro menus with access privileges.
Open Menu Item script steps Examples The following script displays a message box that asks if the user wants to open the Preferences dialog box, and opens it if the response is Yes. Show Custom Dialog ["Open Preferences dialog box?"] If [Get (LastMessageChoice) = 1] #1=Yes, 2=No Open Preferences End If Open Edit Saved Finds Purpose Opens the Edit Saved Finds dialog box, where the user can add or change saved finds. Format Open Edit Saved Finds Options None.
Open Menu Item script steps Open File Options Purpose Opens the File Options dialog box to the General preferences area. Format Open File Options Options None. Compatibility This script step is: • not supported in web publishing • not supported in a FileMaker Server scheduled script • not supported in runtime solutions except for spell checking (the Spelling tab opens) Description This script step is the same as choosing File menu > File Options.
Open Menu Item script steps Compatibility This script step is: • not supported in web publishing • not supported in a FileMaker Server scheduled script • not supported in runtime solutions Description This script step is the same as choosing File menu > Manage > Database. Notes • The user’s account must be assigned the Full Access privilege set, or this script step will not be performed. (Select Run script with full access privileges to enable the script for all users.
Open Menu Item script steps Description This script step is the same as choosing File menu > Manage > External Data Sources. Notes • The user’s account must be assigned the Full Access privilege set, or this script step will not be performed. (Select Run script with full access privileges to enable the script for all users.) • See Sharing databases on a network for information about making schema changes to shared databases.
Open Menu Item script steps Notes • The user’s account must be assigned the Full Access privilege set, or this script step will not be performed. (Select Run script with full access privileges to enable the script for all users.) • See Sharing databases on a network for information about making schema changes to shared databases.
Open Menu Item script steps Examples The following script displays a message box that asks if the user wants to open the Find/Replace dialog box, and opens it if the response is Yes. Show Custom Dialog ["Open the Find/Replace dialog box?"] If [Get (LastMessageChoice) = 1] #1=Yes, 2=No Open Find/Replace End If Open Help Purpose Opens FileMaker Pro Help to the Help contents screen. Format Open Help Options None.
Open Menu Item script steps Open Remote Purpose Opens the Open Remote dialog box. Format Open Remote Options None. Compatibility This script step is: • not supported in web publishing • not supported in a FileMaker Server scheduled script • not supported in runtime solutions Description This script step is the same as choosing File menu > Open Remote. The Open Remote dialog box allows you to select and open a shared FileMaker Pro database over a network connection.
Open Menu Item script steps Compatibility This script step is: • not supported in web publishing • not supported in a FileMaker Server scheduled script • not supported in runtime solutions Description This script step is the same as choosing Scripts menu > Manage Scripts, or File menu > Manage > Scripts. Note Once an Open Manage Scripts step is performed, FileMaker Pro halts execution of the current script. This prevents unexpected conditions from occurring if the currently running script is edited.
Open Menu Item script steps Description This script step is the same as choosing File menu > Sharing > FileMaker Network. Use this script step to open the FileMaker Network Settings dialog box for users if you have restricted their access to FileMaker Pro menus. Note The user’s account must be assigned a privilege set that permits changes to sharing settings, or this script step will not be performed. (Select Run script with full access privileges to enable the script for all users.
Miscellaneous script steps Miscellaneous script steps Miscellaneous script steps allow you to script miscellaneous actions, like: • displaying a dialog box that presents the user with different options • playing the system alert sound • launching a web browser and displaying a specified URL • sending internet email • sending a DDE command (Windows) or an event to another application • exiting the application Tip Use the Comment script step to annotate your scripts so your colleagues can understand them.
Miscellaneous script steps Compatibility This script step is: • not supported in web publishing • not supported in a FileMaker Server scheduled script Description The custom message dialog box can take user input for up to three fields in the database, and display data from up to three fields in the database. The script pauses as long as the custom dialog box stays on the screen. Fields used for input can be of type text, number, date, time, timestamp, or container.
Miscellaneous script steps Example 1 The following performs a search using a custom dialog box. The dialog box asks users to enter a customer name and city. The dialog box shows a custom title, custom text, and two input fields. #This script begins by entering Find mode. Enter Find Mode [] #The custom dialog box solicits the name and city of the customer to be found.
Miscellaneous script steps Options • On indicates that the formatting bar, the View menu > Formatting Bar menu item, and the Formatting Bar button in the layout bar are enabled. • Off hides the formatting bar, disables the View menu > Formatting Bar menu item, and disables the Formatting Bar button in the layout bar.
Miscellaneous script steps Examples Set Error Capture [On] Perform Find [Restore] If [Get (LastError) <> 0] Beep Show Custom Dialog ["Couldn't find the record..."] End If Speak (Mac OS) Purpose Produces speech from text. Format Speak [] Options Click Specify to display the “Speak” Options dialog box, where you can set the following options. • Type the text to be spoken directly in the text entry area, or click Specify to create your spoken text from a calculation.
Miscellaneous script steps Examples The following script checks a database to see if all records have phone numbers entered, audibly notifies the user when it finds one missing, and waits so the user can enter one if desired. Go to Record/Request/Page [First] Loop If [IsEmpty(Contacts::PhoneNumberField)] Speak ["Phone number is missing"] Pause/Resume Script [Indefinitely] End If Go to Record/Request/Page [Next; Exit after last] End Loop Dial Phone Purpose Dials a phone from within a script.
Miscellaneous script steps Description You can enter a phone number or specify a calculation to create a phone number. You can also choose whether to use the current phone preferences based on your current location. You can specify number, text, calculation, or global fields, and letters within the phone number are translated to numbers (except for q and z). Important The Dial Phone script step is not supported in Mac OS X.
Miscellaneous script steps Set Web Viewer Purpose Controls the specified web viewer. Format Set Web Viewer [Object Name: ”
Miscellaneous script steps • You can send html data to a web viewer by including the data in a URL, using the following format: data:[][;base64], Where the following syntax applies: dataurl = "data:" [ mediatype ] [ ";base64" ] "," data mediatype = [ type "/" subtype ] *( ";" parameter ) data = *urlchar parameter = attribute "=" value More information about the “data URL scheme” can be found on the web. • In FileMaker Pro 8.5, data URLs will work on Mac OS_X but not in Windows.
Miscellaneous script steps Options • Perform without dialog prevents the “Open URL” Options dialog box from displaying when the script step executes. • Click Specify to display the “Open URL” Options dialog box, where you can type the URL directly in the text entry area or click Specify to create your URL from a calculation. Compatibility This script step is also supported in web publishing and in a FileMaker Server scheduled script.
Miscellaneous script steps Send Mail Purpose Sends an intranet or internet email message (with or without a file attachment) to one or more recipients. Email can be sent through an email application or via SMTP (Simple Mail Transfer Protocol, a set of criteria for sending and receiving email).
Miscellaneous script steps • Select Attach File to select a file to send as an attachment to the mail message. For more information, see Creating file paths. Compatibility This script step is: • not supported in web publishing • not supported in a FileMaker Server scheduled script Notes • To send email, you must have an internet connection. In addition, to send mail through an email application, you must have the following configurations. Windows: • A [Mail] section in the Win.ini file.
Miscellaneous script steps Options Click Specify to display the “Send DDE Execute” Options dialog box, where you can set the following options: • Service name is the name of the application that executes the commands. Refer to the documentation of the application you specify for the valid service name. You can enter the service name directly as text or click Specify to create the service name from a calculation.
Miscellaneous script steps Options Click Specify to display the “Perform AppleScript” Options dialog box, where you can set the following options. • Calculated AppleScript lets you create a calculation to use as the AppleScript text. • Native AppleScript lets you manually enter the text of an AppleScript (up to 30000 characters). Indenting of repeat loops and conditional statements is not supported.
Miscellaneous script steps Execute SQL Purpose Executes any SQL statement. Format Execute SQL [No Dialog; ODBC: ; ] Options • Perform without dialog prevents the Specify SQL dialog box, the Select ODBC Data Source dialog box, and the Password dialog box from displaying when the script step executes. • Click Specify to display the Specify SQL dialog box, where you can set the following options. • Specify displays the Select ODBC Data Source dialog box.
Miscellaneous script steps Examples The following example of a manual SQL statement entry executes once each time you run the Execute SQL script step.
Miscellaneous script steps • other displays the Specify event dialog box, where you can manually enter the Apple event Event class and Event ID. • Select Document or click Specify to select the document you want used with the target application. For more information, see Creating file paths. • Select Calculation or click Specify to create a calculation that generates a value you want to send with the event.
Miscellaneous script steps Send Event (Windows) Purpose Starts another application, opens a document in another application, or prints a document in another application. Format Send Event [“”; “”; “”] Options Click Specify to display the “Send Event” Options dialog box, where you can set the following options. • For Send the message, select: • open document/application to tell FileMaker Pro to open a document file or application.
Miscellaneous script steps Examples To launch the Notepad application, select the open document/application message, click File, and specify notepad.exe. The following script step appears in the Script Definition dialog box: Send Event ["aevt"; "odoc"; "NOTEPAD.EXE"] To open a document created by another application, select the open document/application message, click File, and specify the file (for example image.bmp).
Miscellaneous script steps Flush Cache to Disk Purpose Performs an immediate flush of the FileMaker Pro internal disk cache to the computer's hard disk. Format Flush Cache to Disk Options None. Compatibility This script step is: • not supported in web publishing • not supported in a FileMaker Server scheduled script Description This operation is normally done periodically during idle time and after extensive structural changes, such as converting files and defining fields.
Miscellaneous script steps Description If this script step is associated with a button and if the file is accessed through the web, performing the script will log out the current web session. Examples The following example, used as a startup script, prevents the user from opening the database on a weekend.