• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 13. Multi-User Files on a Network > Creating an Opening Script

Creating an Opening Script

Automating repetitive tasks is always good, particularly if they involve several steps that would keep you glued to the screen instead of doing something productive. Although you can wade through FileMaker's startup screens and dialog boxes, it's more efficient to create a single startup script to open several multi-user files automatically.

To create an opening script:

1.
Start FileMaker. When the Open File dialog box appears, click Cancel. Choose File > New Database.

2.
When the Create New File dialog box appears, give the new database a descriptive name like NetStart (Figure 13.4). Click Save.

Figure 13.4. You can create a new database that only opens files from the network.


When the Define Fields dialog box appears, just click Done.

3.
Choose File > Open (Ctrl+O/Command-O). In the Open File dialog box, click the Hosts button.

4.
When the Hosts dialog box appears, make sure that all of the databases you want the script to open are available on the network (Figure 13.5). Open them if they're not. To close the dialog boxes, click Cancel twice.

5.
Choose Scripts > ScriptMaker. In the Define Scripts dialog box, type a name for the script (ours is called Opener). Click Create.

6.
In the Script Definition dialog box, click Clear All to clear the default script.

7.
In the script step list on the left, scroll down to Files and double-click Open (Figure 13.6). In Options, click the Specify/Specify File button (Figure 13.7).

Figure 13.6. The Open step can open files from the host or server.


Figure 13.7. Specify the file you want to open by clicking the Specify (Win)/Specify File (Mac) box.


8.
In the Open File dialog box, click the Hosts button. When the Hosts dialog box appears, double-click the name of the first file you want to have the script open (Figure 13.8).

Figure 13.8. In the Hosts dialog box, select files for the script will open.


9.
In the script step list on the left, scroll up to the Control section and double-click If.

10.
In Options, click the Specify button to bring up the Specify Calculation dialog box.

11.
Click the View drop-down list on the right and choose Status functions (Figure 13.9). In the Status functions list, double-click Status (CurrentError) (Figure 13.10).

Figure 13.9. Choose Status functions from the View list to see the complete set of status functions.


Figure 13.10. This status function captures any error FileMaker encounters while running the script.


12.
Click to the right of the parentheses. From the Operators list, double-click the = sign. Type 100 to the right of the equal sign (Figure 13.11). Click OK to return to the Script Definition dialog box.

Figure 13.11. Status (CurrentError) will return error 100 if the specified file is not found on the network.


The error code 100 is the “File is missing” error.

13.
In the script step list on the left, scroll down to Files and double-click Open.

This If statement says that if the file you want to open is missing, the Open File dialog box will appear so you can manually locate the file.

14.
If there are other files you want this script to open, you'll have to duplicate this first group of steps and edit them. Click on the first step, hold the Shift key down and click on the last step to select the group (Figure 13.12). Click the Duplicate button (Figure 13.13).

Figure 13.12. Select multiple steps by holding down the Shift key while selecting.


Figure 13.13. Duplicate the selected steps so you don't have to add them manually.


15.
Double-click the new Open step (Figure 13.14). In the Open File dialog box that appears, click the Hosts button. When the Hosts dialog box appears, double-click the name of the next file you want to have the script open.

Figure 13.14. The new Open step can be edited to open another file.


16.
Repeat Steps 14 and 15 for as many other files as you need to open at startup.

17.
In the step list on the left, scroll to the Files section and double-click Close (Figure 13.15).

Figure 13.15. The Close step will close any open file you specify.


The Close step closes whatever file you specify. If you don't specify a file name, it closes the database of the script in which it was used.

18.
In Options, click Specify/Specify File. When the Open Files dialog box appears, double-click the name of the new database in which you are creating the script (Figure 13.16).

Figure 13.16. Select the database you just created.


If you are not sure how the script will work, you can leave out this Close script step (Steps 17 and 18) so you can more easily return to the script to make changes.

19.
Click OK to save the script and then Done to finish.

20.
Choose Edit > Preferences > Document. The Document Preferences dialog box will appear with the General tab selected. In the When opening section, click Perform script. In the script drop-down list, choose the script you just created (Figure 13.17). Click OK.

Figure 13.17. Set the script to run on startup in the Preferences > Document options.



PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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