Using Script Parameters for Multipurpose Scripts
A major reason to build scripts is to automate repetitive tasks. But script writing itself can become repetitive. FileMaker Pro 7 takes a significant step toward scripting freedom with the addition of the Script Parameter function. It allows you to perform one script using different criteria, depending on how you call the script. As a result, you can write a single script for multiple purposes.In this example, we write a single script that attaches to buttons that navigate to different layouts. The script uses a Go to Layout step, with the layout name specified as the script parameter.
To create a multipurpose script
1 .Choose Scripts > ScriptMaker (Control+Shift+S/Command+Shift+S).2 .When the Define Scripts dialog box appears, click New. In the Edit Script dialog box, type Go to Different Layouts as the script name.3 .In the script step list, double-click Go to Layout. In the Specify drop-down list in Script Step Options, choose Layout Name by calculation (Figure 9.66).
Figure 9.66. The Layout Name by calculation option allows you to choose a layout using the script parameter.

Figure 9.67. In this example, Get(ScriptParameter) returns the name of the specified layout.
[View full size image]

Figure 9.68. The text in the script parameter must match the layout name.

Figure 9.69. Changing the text in the script parameter option changes the layout the button targets.

Window Script Options
When you're scripting, you can take control of the FileMaker window by using a Windows script. Doing so allows you to improve your users' experience, and helps you keep your database window looking and feeling consistent no matter which platform it's viewed on.Windows script steps control every aspect of the window experience, from Set Zoom Level, which lets you set the magnification of a window to a defined percentage, to Set Window Title, which allows you to rename any window using custom text.Adjust Window is a particularly flexible step, with many options to customize window behavior:Minimize.
Turns the window into a Task Bar icon (Windows) or Dock icon (Macintosh).Hide.
Makes the current database window invisible. This is equivalent to choosing Hide Window in the menu bar.Maximize.
Resizes the window to fill the full screen.Restore.
Returns the window to the size it was before minimizing.Resize to Fit.
Adjusts the size of the windows to show all of the elements (fields, text and graphics).
Perhaps the most powerful option is Move/Resize Window, which allows you to specify exactly how big the open window will be and where it will appear, allowing you to save space on small screens or position a window at a specific x/y coordinate (Figure 9.70).
Figure 9.70. By defining the window size and x/y coordinates of the States window, you can precisely position the window on the screen.

