• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Q&A

Q1:Are there guidelines for writing good FileMaker scripts?
A1: Two guidelines apply to all programming tools, including ScriptMaker. First, document your work with comments in the script. Don't rely on your memory—or on written documentation separate from the script. Second, make each script as self-contained as possible and have it do one logical operation. By focusing each script on one task, you may be able to reuse the script in other contexts. A master script can then perform several tasks simply by calling Perform script steps.

You can further refine your script architecture by separating interface steps, such as dialogs, from noninteractive processing. A common method is to write a script that gathers parameters and information from a user and then passes control to a second script that performs the work. You'll see how to use parameters to implement this structure in Hour 16.

If you do this, adopt a consistent naming convention for your scripts. One such naming convention uses pairs of names. A script called Enter Budget Amount might be the interactive script, one that queries the user for the data using a dialog. It could then call a script called Do Enter Budget Amount, which is not interactive but does the database update. Alternatively (or in addition), you can flag scripts that are interactive by using names such as Enter Budget Amount Interactive or Enter Budget Amount HI (for human interface). Knowing which scripts require user intervention helps to prevent cases in which you reuse a script that winds up stalling at 2:00 a.m. because no one is there to click a button.

And finally, remember that any script that can generate an error message in a dialog—custom dialog or standard FileMaker dialog—is potentially interactive. If you capture all potential errors and dispose of them without a dialog, your script is truly noninteractive and safe to run unattended.

Q2:If you attach scripts to text buttons (such as Print This Report), how do people know that they are buttons to click?
A2: You can specify that the pointer changes to a pointing hand when it moves over the button, but that requires the user to know to move the pointer over it. In the templates, the area at the top of the layout is devoted to buttons. In this way, users come to know that this is a control area, not a data area. You can use any technique that you want to isolate a control area, but being consistent helps your users divine what is data and what is a button.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint