Two Special Events

Each of the available Event Control Scripts in the Event List, except for the top two, refer to a very specific event. The "event" Functions and Subs is used to specify custom scripts that can be attached to multiple other scripts. The event OnAutoSelectedEvent is used to add custom scripting at regular intervals called by the application.

ClosedFunctions and Subs Event

The script associated with the Functions and Subs event list item isn’t really an event script at all. It is a script into which you place functions and subroutines that you want to be accessible to all the other event scripts associated with the same data source. You can also use the Functions and Subs script to declare variables that other event control scripts need to access. (These are not quite "global" variables, as they can only be accessed by event control scripts for the same data source, and not by other scripts associated with other data sources.) Below is a list of tasks often performed and items often placed in the Functions and Subs script:

ClosedOnAutoSelectedEvent

When the Type of Visual Basic Script is set to Event Control Scripts, this event is called with the same frequency that scripts are called when the Type is set to Multi-Line Script.

When using regular multi-line scripts, BarTender analyzes the design of both your script and template(s) according to some preset rules and determines the ideal times for the script to get called. The general goal is to evaluate how your document has its serialization opportunities and copies options set, and then call the multiple-line script often enough to supply the document with new data as needed, but no more often than necessary. In contrast, when the Type of Visual Basic Script is set to Event Control Scripts, you can explicitly specify which events you want to launch your scripts. The OnAutoSelectedEvent lets you write a script that gets called at those "ideal" times determined by BarTender with regular multi-line scripts, even though you may also be using other scripts tied to specific events.