Welcome to the AccuZIP6 5.0 Scripting Tutorial! It is highly recommended that you first complete the Introductory Tutorial in the Getting Started section prior to completing this tutorial. The Basic Tutorial will give you a firm understanding of the program functions, and will make automating those functions much simpler. If you already have a working knowledge of AccuZIP6, then the Introductory Tutorial may not be necessary. This scripting tutorial will demonstrate how to automate the same processes that were used in the Introductory Tutorial, with the only difference being right in the beginning. When scripting, you do not launch from the Open/Create Window, and there's no option for the Open/Create Window in the script editor, so we'll use File>Open List to open a new list. Let's get started!
With AccuZIP6 5.0 open, close the Open/Create Screen if it appears, as well as any active files. Click on Special>Script. The Scripts Window will appear. For more information on the Script Window and button descriptions, see Introduction to Scripting.
With the Scripts Window open, click the Create button . A new script will be created in the Script List window, which you can then click on and rename as desired. For the purposes of this tutorial, we'll renamed it "Tutorial". Press Enter on your keyboard when finished renaming and the script will have the new name showing in the highlighted bar, as shown below:
TIP! |
Give your scripts appropriate names that make sense to you. By default, it uses a date/time stamp naming convention, but rename it to something that will remind you of what the process does. A client that requires a consistent process be used every time is a perfect example of how scripting can save you time. Create a script, rename it to your client's name and run it whenever their jobs come in! |
Once you've renamed your script, it will still be highlighted in the Scripts window. Click the Edit button to open up the script editor, as shown below:
This is the window that you'll become very familiar with if you're going to be scripting. The layout is fairly basic; select a menu, and then choose the menu item you'd click on if you were running AccuZIP6 5.0 manually. Any time you're scripting a process in AccuZIP6 5.0, the first event you'll want to create is opening a data source.
In the Menu pull-down, select File. Then, in the Menu Item pull-down, select Open List.
Click the "Add to Event Sequence" Button .
Click on the Edit Default Menu Items button . You'll then see the Open List window, just as if you were actually opening a list at this time:
Click on the open button under step number 1, "Select the Input File". For the purposes of this tutorial, we'll be using the demo file located in the C:\Program Files\AccuZIP6 5.0\Demo folder:
Browse to the Demo folder (C:\Program Files\AccuZIP6 5.0\Demo by default) and select the file named "demofile.csv". Click OK.
The file name and path will appear in the Open Setup screen, and the program will note that the file has been determined to be a Comma-Separated Text file. Much like the standard tutorial, we will now proceed to map the fields.
The file that we are opening contains a Header Record. In this case, manual field mapping is not necessary, because the field names appear in the first record in the file. This is called a Header Record. When you have a Header Record in your file that matches the Auto Field Maps table, you can simply check the Use Header check box and the field names in the first record are used as the AccuZIP6 field names for the database.
Click the "Use Header" checkbox on the right side of the window.
TIP! |
One of the key features available within the scripting environment that you won't find through manual use of the software is the "Auto" checkbox. While in the script editor, you'll be able to check the box, which allows the script to run the event(s) automatically. If you want an event to run without any interaction from the user, check the "Auto" checkbox. If you wish to have the script pause briefly and wait for input from the user, leave the box unchecked. In this tutorial, we'll set each event up to run automatically. |
Click the "Auto" checkbox in the lower right-hand corner of the Open Setup window.
Click "Save" on the Open Setup window to return to the Script Editor, which now has a single "Open List" event listed:
Congratulations! You've just created your first automated event within the AccuZIP6 5.0 Scripting Engine. Each event that you add will follow the same set of instructions: selecting a menu, a menu item, adding the selected event to the Event Sequence, modifying the settings, and lastly saving the event. We can now set up the rest of the events for the tutorial!
From the Menu pull-down, select Special.
From the Menu Item pull-down, choose Optimize Database.
Click on the "Add to Event Sequence" button .
Click on the "Edit Menu Item Defaults" button . The Optimize Database window will be presented with the default options, as shown:
For more information on the optimize database options, see Optimizing the Database.
For the purposes of this tutorial, we'll leave the default options selected.
Click the "Auto Run" checkbox in the lower left-hand corner of the window.
Click Save and you'll be returned to the Script Editor once more. You'll now have two events listed: Open List and Optimize Database.
We're halfway there, now! As you can see, using the scripting engine within AccuZIP6 5.0 is very simple, yet very powerful. At this point, you should probably start to feel comfortable with the repetition of steps to add events to the sequence and settings modification. If you still have questions, feel free to review earlier steps, or visit our Online Chat for clarification!
Continuing with the Scripting Tutorial, we'll now move on to Validating and Presorting.
From the Menu pull-down, select Special.
From the Menu Item pull-down, select Validate Records.
Click the "Add to Event Sequence" button .
Click on the "Edit Menu Item Defaults" button . You'll be presented with the Validate Records window:
As with previous steps, the default options (with the exception of the Auto Run option) will be fine for the purposes of this tutorial. If you desire clarification or information on the options available, see Validating the Data.
In the Validate Records event for a script, you'll have to do something new: saving the settings. In the lower middle portion of the window, you'll see the "Saved Settings" area. To run a script with a validation event automatically, you'll have to create a saved setting for AccuZIP6 5.0 to use. To do so, perform the following steps:
Under the Saved Settings section, click on the "Create New Settings" button . The cursor will be placed into the text box directly above the row of buttons, allowing you to type in a name for your new settings.
Type "Tutorial" (without the quote marks) and then click the Save Settings button . The Saved Settings area should now resemble the following image:
Click the "Auto Run" checkbox in the lower right-hand corner of the window.
Click the Save button in the upper right-hand corner of the Validate Records window to return to the Script Editor. You should now see three events, as shown:
We'll now create the last tutorial event, the Presort event.
From the Menu pull-down, select Sort.
From the Menu Item pull-down, select Presort Mail.
Click the "Add to Event Sequence" button .
Click on the "Edit Menu Item Defaults" button . You'll be presented with the Presort Mail window. We'll be using the same demo settings from the Introductory Tutorial. If you have previously completed the tutorial, you will already have a saved setting named "Demofile" listed in the Saved Settings pull-down. If not, set up the window as shown in the following diagram:
If you haven't previously completed the Introductory Tutorial, that's okay! You'll just have a few extra steps to take at this point.
Under the Saved Settings section of the Presort Setup window, click the Create New Settings button . The cursor will move to the Saved Settings text box.
Type "Demofile" (without the quotes) and then click the Save Settings button .
Performing the previous two steps will create the saved settings that the script editor needs to process the presort automatically.
Click the "Auto Run" checkbox in the lower left hand corner of the screen.
Click the Save button to return to the Script Editor window one last time. It should now appear as shown:
Congratulations, you have created your first automated script within AccuZIP6 5.0! Now it's time to save the script and run it to view the results of the tutorial. If all previous steps were performed, you will be allowed to return to the Scripts window and simply click "Run Script", at which point AccuZIP6 5.0 will run through the import, optimization, validation, and presort events. You'll be presented with the Print Presort window, as if you had just manually processed a file!
Click the large Save button in the Script Editor window to return to the Scripts window:
The tutorial script will already be highlighted for you.
Click the Run button to view your work! You'll see AccuZIP6 5.0 process the four steps automatically, at which point you'll be presented with a notification that the script completed successfully.
You can then open up My Computer on a Windows PC to navigate to the C:\Program Files\AccuZIP6 5.0\Demo\Presort Folder location to see the resulting files that were generated.
Congratulations on creating your first automated script within AccuZIP6 5.0!!! It is recommended that you experiment with the settings before attempting to run a live job, but if you require assistance with scripting, or even general technical support, you can easily reach our highly trained technical support staff via any of the options listed in our contact information.