User manual
Table Of Contents
- Preface Learning how to use FileMakerPro
- Chapter 1 FileMaker Pro basics
- Chapter 2 Adding and viewing data
- Chapter 3 Finding and sorting information
- Finding records
- Finding text and characters
- Finding exact matches in text fields
- Finding numbers, dates, and times
- Finding ranges of information
- Finding data in related fields
- Finding records that match multiple criteria
- Finding empty or non-empty fields
- Finding duplicates
- Finding all records except those matching criteria
- Hiding records from a found set and viewing hidden records
- Viewing, repeating, or changing the last find
- Sorting records
- Finding records
- Chapter 4 Previewing and printing information
- Chapter 5 Creating a database
- Chapter 6 Creating and managing layouts and reports
- Chapter 7 Customizing layouts
- Chapter 8 Working with related files
- Chapter 9 Protecting databases with passwords and groups
- Chapter 10 Creating scripts to automate tasks
- About scripts
- Creating scripts: an overview
- About ScriptMaker steps
- Control script steps
- Navigation script steps
- Sort, find, and print script steps
- Editing script steps
- Fields script steps
- Records script steps
- Windows script steps
- Files script steps
- Spelling script steps
- Open Menu Item script steps
- Miscellaneous script steps
- Changing scripts
- Duplicating, renaming, or deleting scripts
- Importing scripts
- Listing scripts in the Scripts menu
- Using buttons with scripts
- Example of a ScriptMaker script
- Chapter 11 Using formulas and functions
- Chapter 12 Importing and exporting data
- Chapter 13 Sharing databases on a network
- Chapter 14 Publishing databases on the Web
- About publishing databases on the Web
- How users work with databases on the Web
- What you need to publish databasesontheWeb
- Publishing databases on the Web: an overview
- Enabling FileMaker Pro Web Companion
- Configuring FileMaker Pro WebCompanion
- Enabling Web Companion sharing
- Setting up browser views
- Testing your published database
- About browser views for web publishing
- Chapter 15 Using ODBC with FileMakerPro
- Appendix A Customizing FileMaker Pro
- Appendix B Backing up and recovering files
- Appendix C FileMaker Pro Quick Reference (Windows)
- Appendix D FileMaker Pro Quick Reference (Mac OS)
- Index
Creating scripts to automate tasks
10-3
Creating scripts: an overview
Whether your FileMaker Pro scripts are simple or complex, you will
find that it is easier to create them if you:
1 plan the script before you define it.
1 perform certain operations, like Find requests and Sort order,
before you open ScriptMaker, thus making it easier to store the
parameters for these requests. See “Storing settings before creating a
script” on page 10-4 for more information.
Once you have a clear idea of how your script will be constructed and
have stored any necessary settings, you are ready to define the script.
Planning scripts
Just as you wouldn’t attempt to write a report without an outline, you
shouldn’t attempt to write a script without some forethought and
planning. Consider these points before defining a script:
1 What do you want to accomplish? Can you separate the job into
smaller tasks? If so, define a subscript for each small task, and then
define a script that performs the subscripts. It’s usually easier to
design and test several small subscripts than one complex script. This
modular approach also lets you reuse your subscripts in other scripts.
1 Is all the data you need in one file, or will the script operate on
more than one file? If you’re using multiple files, which ones should
the script open? Where should you define the script?
1 How will users perform the script? (See “Using buttons with
scripts,” on page 10-12.)
1 Will the script contain steps for print setup (Windows), page setup
(Mac OS), printing, importing, finding, sorting, or exporting? If so,
what settings should you store before defining the script? (See
“Storing settings before creating a script,” on page 10-4.)
1 Which fields and layouts will the script need? Some steps require
a field to be on the current layout (like Go to Field, Insert Text, Insert
Calculated Result, and Replace), while others, such as Set Field,
don’t. Use Go to Layout to switch to a layout that has the fields your
script requires.
1 Should the script switch among modes? For example, use Enter
Browse Mode before modifying data in fields and records, and use
Enter Find Mode before setting up a find request or finding data.
1 Should the script work on all records in the database, the current
found set, or a specific set of records? What if no records are found?
Use one of the find or omit steps to set up the correct records.
1 Which record should the script start with? For example, when
using the Loop step, decide whether the loop starts at the first or last
record, a specific record, or the current record in a found set. Use
Go to Record/Request/Page to select a starting record.
1 How should the script advance through multiple fields and
records? Use navigation steps to move through a found set.
1 Should the records be sorted before the script processes them? If
you use the Loop step, use Sort or Unsort before the loop to order
your records properly.
1 When should the script finish? After all records have been
processed? After a specified condition has been met? Use the If step
to perform a task when the script reaches a specified condition.
1 How will you document your script design? Use the Comment step
to make your scripts readable and understandable. This is especially
important if others will be maintaining a database that you create.
1 How will you test your script? Use the Pause/Resume Script step
to pause at specific points in your script. For example, if you are
testing a script with a Loop step, placing a Pause/Resume Script step
in the middle of the loop may allow you to see if your loop is working
as intended. You can remove the Pause/Resume script step when
your script is working properly.