Creating interactive scripts
You can create interactive scripts that prompt the user for input. Unlike standard scripts that run uninterrupted, interactive scripts pause their execution until required information is provided by the user.
The benefit of interactivity
Interactivity helps you write scripts that are flexible, with broader applicability. You do not need to specify all the input information in advance, which requires that you know information like table and field names, and typically results in scripts that are single-purpose, or narrow in focus.
Using script interactivity, you can gather input information using one or more dialog boxes when the user runs the script. For example, you could use interactivity to gather any of the following input:
- user name and password
- table and field names
- file names
- amount thresholds
- date ranges
- identifiers such as merchant codes, branch codes, and vendor and customer IDs
- command parameters
Sequencing interactivity
Whenever possible, you should place all interactive dialog boxes at the beginning of a script so that the remainder of the script can run without interruption.
If interactive dialog boxes occur mid-script, the user may no longer be attending the script execution at the point that input is required, and the script remains stalled until the input is provided.
Three methods for creating interactivity
Analytics provides three methods for creating interactivity in scripts. Each method is associated with an Analytics command.
The ACCEPT and PASSWORD commands can only be created using ACLScript syntax. The DIALOG command can be created using ACLScript syntax, or the syntax can be autogenerated using the Dialog Builder, a visual utility.
Command | Description |
---|---|
ACCEPT command |
The ACCEPT command creates the default interactive dialog box, which supports two methods of user input:
You can create separate dialog boxes that prompt for one item at a time, or you can create one dialog box that prompts for multiple items. |
The DIALOG command creates a custom interactive dialog box. Custom dialog boxes support more advanced layout options, and five methods of user input:
You can create separate dialog boxes that prompt for one item at a time, or you can create one dialog box that prompts for multiple items. |
|
PASSWORD command |
The PASSWORD command creates a simple dialog box with a single field for entering a password. When a user enters a password, the characters are displayed as asterisks (*) in the dialog box. The password is retained in memory of the duration of the Analytics session, but it does not appear in either the script or the log. |