ScriptMaker - File Maker

Our last task in is to create our first script, or automated procedure, in Company.fp5. Go up to the Scripts menu and select ScriptMaker, which will bring up the following Define Scripts window, where you can build automated procedures using ScriptMaker, FileMaker’s own built-in macro utility.

Script Maker

At this point, it might be neat for you to build an open script, or, a script that runs whenever someone opens Company.fp5. An open script is handy for controlling what a user first sees when opening a database. It helps prevent them from ending up in “no man’s land” on some strange layout they aren’t familiar with.

The first thing to do to create an open script is type the name of the script in the Script Name box. Call it, simply, “Open.” Make sure the Include in Menu box is unchecked. (Including a script in the Scripts menu would allow you to be able to access a script using a shortcut key like CONTROL-1/COMMAND-1.) Click the Done button or press ENTER/RETURN.

Next you’ll see the Script Definition window for our new open script. In the left box, you’ll see a scrollable list of all possible script steps that can make up a script. A script step is one procedure in a series of procedures that occurs, in the order in which you arrange them, whenever you trigger a script to run.

In the right box, you will see all of the script steps for this script. Note that FileMaker may create six script steps for you whenever you create a new script.

The first thing you will always find yourself doing when developing a script’s definition window is immediately clicking the Clear All button in a new script to get rid of these default script steps so that you may start from a clean slate. Click Clear All now.

So what do you want your open script to do? For now, let’s keep it simple.

Let’s say that you just want the database to go to a certain layout, maximize the window so that the database takes up the whole screen, go into browse mode so that the database is ready to receive data and show all records in case there was a small found set isolated the last time the user left the database.

Creating a script that does all this is actually a snap. In fact, it only requires four script steps. The first script step you want to add is Go to Layout []. This step is in the scrolling list of script steps toward the top under the heading of Navigation. Double-click this step and you’ll see it automatically added to the script definition. The step you just added will be highlighted, and you will notice below the script definition that there are a few options available to you. Simply specify your first layout in the Layout drop-down menu (it’s probably called Layout #1) in the Options area.

The next script step to add is the one that maximizes the window. For this you want the Toggle Window step, found further down the script step list under the Windows heading. Double-click Toggle Window. You will have another dropdown menu of options (where you specify how you want to toggle the window) and you should select Maximize.

The last two steps are Enter Browse Mode [] (found under the Navigation heading) and Show All Records, under Sort/Find/Print. You don’t have to specify any options for these script steps.

When you are finished defining this script, it should look like this:

Script Maker

Now all that’s left to do is to specify this script as the open script for this database. Select Edit > Preferences > Document and click OK to save the script. Then click Done to leave Define Scripts. Select Access Edit > Preferences > Document and go to the General tab. Under “When opening ‘Company.fp5,’” click the Perform script button and select our open script from the drop-down menu.

That’s it! You’ve created an open script for Company.fp5 and set up the trigger event that will run the script (a user opening the database).

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd Protection Status

File Maker Topics