When you run a script in Analytics, each command in the script is processed in sequence until the end of the script is reached.
You cannot continue working in Analytics while the script is running, and you can run only one script at a time. However, using the DO SCRIPT command, you can create scripts that call and run other scripts.
While a script is running, Analytics displays the processing status and the name of the script, or subscript, in the status bar.
When the script finishes running, an icon appears in the status bar indicating if the script ran successfully to completion , or failed . If a script fails, the line where the error occurs is automatically highlighted in the Script Editor.
If necessary, you can stop the processing of a script by pressing the Esc key, or by closing Analytics.
Run a script from the main menu
There are two different ways to run a script from the main menu:
- Applications menu choose a specific script name from a custom menu
For more information, see Adding custom items to the Analytics main menu.
- Tools option access a pick list of all the scripts in a project
- Select Tools > Run Script.
- In the Do Script dialog box, select the script to run from the list of available scripts in the project.
- If you want to specify a condition that must evaluate to true in order for the script to run, do one of the following:
- enter a logical expression in the If text box
- click If to
create a logical expression using the Expression Builder
The logical expression is evaluated just once to determine if the script should run. If the expression evaluates to false the script does not run.
- Click OK.
Run a script from the Overview tab
In the Overview tab in the Navigator, right-click the script in the treeview and select Run.
Run a script from the Script Editor
Open the script in the Script Editor, and click Run in the Script Editor toolbar.
If you have made changes to a script in the Script Editor, the changes are automatically saved when you run the script.
Run a script from the Windows command line
You can run a script from the Windows command line, or from a batch file (*.bat), which allows you to schedule the script using a utility such as Windows Task Scheduler and run it unattended.
The command line syntax uses this basic form:
acl_executable_path_and_filename acl_project_path_and_filename </vVarName=value> /bScript_name </min>
The command line syntax below opens Sample Project.ACL and runs a script called Calculate_Median_Value.
"C:\Program Files (x86)\ACL Software\ACL for Windows 14\ACLWin.exe" "C:\Users\username\Documents\ACL Data\Sample Data Files\Sample Project.ACL" /vv_table_name="Ap_Trans" /vv_field_name="Invoice_Amount" /bCalculate_Median_Value
Command line syntax
Specify the full paths to the Analytics executable and the Analytics project, including the file name and the file extension. Enclose the path in quotation marks if the path includes any spaces.
Specifies the path to the Analytics executable file, and the executable file name (ACLWin.exe).
"C:\Program Files (x86)\ACL Software\ACL for Windows 14\ACLWin.exe"
Specifies the path to the Analytics project file, and the file name of the project (*.acl) containing the script.
"C:\Users\username\Documents\ACL Data\Sample Data Files\Sample Project.ACL"
Specifies variable names and assigns values. The variables are automatically initialized when the Analytics project opens.
Do not enter a space between the /v switch and the variable name. For example, for the variable v_table_name :
The data type of an assigned value must match the data type of the variable in the script. If the data types are mismatched, an "Expression type mismatch" error occurs and the script fails.
Use quotation marks to qualify character values, and backquotes to qualify datetime values.
Specifies the name of the script to run.
Do not enter a space between the /b switch and the script name.
|Specifies that Analytics is minimized when it opens.|
Guidelines for creating a script that runs unattended
|Avoid user interaction||
Do not include any of the following user interaction commands:
Instead, specify any required variables, and assign values, using the command line syntax explained above.
|Suppress confirmation dialog boxes||
Add the SET SAFETY OFF command at the beginning of the script so that files can be overwritten as necessary without displaying a confirmation dialog box. Add the SET SAFETY ON command at the end of the script to restore the default behavior.
Add the OK parameter after any command, such as DELETE or RENAME, that normally displays a confirmation dialog box.
|Exit Analytics||End the script with the QUIT command to exit Analytics.|
Run a script from a Windows shortcut
You can run a script from a Windows shortcut.
- Create a shortcut for Analytics.
- Right-click the shortcut and select Properties.
- In the Target field, enter the appropriate command line syntax (see above).
- Click OK.
- Double-click the shortcut to run the script.