Creating and editing scripts

You have several options for creating scripts:

  • Script Editor type script syntax in the Script Editor window
  • Command log copy script syntax from the command log
  • Script Recorder record the syntax for commands as you execute them
  • Syntax capture insert the syntax for commands as you select them in the user interface without executing them
  • Table history copy script syntax from the history of an output table

You can use these options in combination. For example, you could begin a script by copying syntax from the command log, and then add additional lines of syntax directly in the Script Editor window.

To edit an existing script in Analytics, you must use the Script Editor.

You also have the option of using a text editor of your choice, and copying and pasting syntax into an Analytics script.

Syntax auto-completion

As you type syntax in the Script Editor, Analytics provides auto-completion for ACLScript commands and keywords, and automatic on-screen help for function parameters.

You can turn off auto-completion by selecting Disable auto complete in scripts in the Interface tab in the Options dialog box (Tools > Options). On-screen help for function parameters cannot be disabled.

Import scripts or snippets from ScriptHub

Another option for creating scripts is to make use of the content in ScriptHub. ScriptHub is a web-based library of Analytics scripted items developed by Galvanize employees and the Galvanize user community. As part of your subscription, you can download and use any of the content in ScriptHub.

For more information, see Importing from ScriptHub.

Create or edit a script in the Script Editor

You can create or edit scripts by typing the required ACLScript syntax directly into the Script Editor, or by using one of the other supported methods for entering syntax.

Note

When you create or edit a script you must ensure that each ACLScript command is entered on a separate line.

Create a script from the command log

You can copy log entries from the Log tab in the Navigator as the starting point for creating a new script, or to add to an existing script. The syntax of each command previously executed in Analytics is recorded in an individual log entry.

You can select the following types of log entries and copy them to a new or existing script:

  • individual entries
  • a series of entries associated with a table
  • larger groups of entries associated with a session or a time period

Create a script with the Script Recorder

The Analytics Script Recorder allows you to create a script by recording your actions as you work with tables and commands in the Analytics user interface. The advantage of using the Script Recorder to create scripts is that you do not need to manually enter the required syntax for each ACLScript command, or even know the syntax.

Only commands are captured by the Script Recorder. As a general rule, if the command appears in the command log, it can be captured by the Script Recorder.

Tip

The Script Recorder is also a useful tool for learning ACLScript. You can record a series of analysis steps using the Script Recorder and then view the resulting script to see the series of commands and syntax required to reproduce the behavior in a script.

Create a script with syntax capture

Syntax capture allows you to use Analytics menus and dialog boxes to automatically insert ACLScript syntax into a script.

Create a script from table history

You can create a script based on the history associated with an Analytics output or results table.

For example, if you add a monthly inventory table to an Analytics project and extract relevant divisions and items to a new table, you could script this process based on the table history associated with the first output table you created.

Each table created as the output of an Analytics command keeps a record of the commands used to create the table, including commands that create any intermediate tables between the original Analytics table and the output table. You can copy this table history to a new script that you can then use to automate creation of subsequent output tables.