Using Script Editor

Use the Script Editor to create or edit a script file, save a script file to the local disk of a , or load a script file from a disk. Use the information in this topic to build scripts and understand command syntax.

Opening the Script Editor

To open the Script Editor, perform these steps:

  1. Select a in the Tree view or the Table view.
  2. Select either Tools >> Execute Script or, from the right mouse pop-up menu, select Execute Script.

The Script Editor opens, and it has two views:


Note:

Use the splitter bar that divides the window between the Script view and the Output view to resize the views.

Building Scripts and Adding Comments

Keep these guidelines in mind when you build scripts:

You can add comments to scripts to explain the purpose of the command statements. Keep these guidelines in mind when you add comments to the scripts:

Single-line comments start with two forward slashes (//).

Example – The comment The following command assigns hot spare drives. is included for clarification and is not processed by the Script Editor.

//The following command assigns hot spare drives.

set drives [1,2 1,3] hotspare=true;


Important:

You must end a comment starting with // and an end-of-line character, which you insert by pressing Enter. If the script engine does not find an end-of-line character in the script after processing a comment, an error message appears, and the script execution is ended. This error commonly occurs when a comment is placed at the end of a script and the user did not press Enter.

Multi-line comments are surrounded by the characters /* and */.

Example – In the following example, the comment The following command assigns hot spare drives. is included for clarification and is not processed by the Script Editor:

/* The following command assigns hot spare drives.*/

set drives [1,2 1,3] hotspare=true;


Important:

Start the comment with /* and end it with */. If the script engine does not find both a starting comment notation and an ending comment notation, an error message appears, and the script execution is ended.

Using the show Statement

Use the show statement to embed comments in a script that will appear in the Output view during script execution.

Example – The inclusion of a Show “setting controller mode” statement in your script results in the showing of setting controller mode in the Output view when this line is processed during script execution.

File Options in the Script Editor

File Options in the Script Editor

Task Action
Open a new script Select File >> New Script .

The Script view is cleared for new script input, and the Output view is cleared.

Edit an existing script
  1. Select File >> Load Script .
  2. In the Load Script dialog, select the script file that you want to edit, and click OK.

The Load Script dialog closes, and the selected script file is loaded into the Script view.

Save the script in the Script view without prompting for a new file name Select File >> Save Script .


Note:

If you exit the Script Editor without saving a modified script, you are prompted to save the script before exiting.

Save the script in the Script view with a new file name
  1. Select File >> Save Script As .
  2. In the Save Script As dialog, select the a subdirectory folder, name the script file, and click Save.


Note:

You can specify any file extension, but the Save Script As dialog, by default, shows files with a .scr extension. The Script Editor does not automatically append the .scr extension to the end of a file.

The Save Script As dialog closes, and the script file is saved in the selected directory.

Save the script execution results to a local file
  1. Select File >> Save Output As .
  2. In the Save Output As dialog, select the a subdirectory folder, name the output file, and click Save.


Note:

You can specify any file extension, but the Save Output As dialog, by default, shows files with a .txt extension. The Script Editor does not automatically append the .txt extension to the end of a file.

The Save Output As dialog appear, and the output file is saved in the selected directory.

Edit Options in the Script Editor

Edit Options in the Script Editor

Task Action
Cut selected text from the script in the Script view Select Edit >> Cut .
Copy the selected text from the Script view or the Output view to the system memory Select Edit >> Copy .
Paste information from system memory into the script Select Edit >> Paste .
Clear the text in the Script view Select Edit >> Clear Script .
Clear the text in the Output view Select Edit >> Clear Output .
Select all of the text in the Script view Select Edit >> Select All .
Tool Options in the Script Editor

Tool Options in the Script Editor

Task Action
Verify the script command syntax Select Tools >> Verify Syntax .

The Script Editor engine parses the statements in the script file, one line at a time, and verifies that they have the correct syntax. Any syntax errors appear in the Output view, which report the line number of the error and a description of the error. If the Script Editor encounters a syntax error, no further syntax verification is performed on the script. Fix the syntax error, and rerun the Verify Syntax command to validate the error correction and to check the remainder of the statements in the script.

Execute the currently loaded script Select either Tools >> Verify and Execute or Tools >> Execute Only . Both options show an error message if a syntax error is encountered, but the Tools >> Verify and Execute option checks the script a line at a time for correct syntax before the script is executed. It provides syntax error feedback in the Output view.

The Script Editor engine parses the command statements in the script file, interprets and converts the statements to the appropriate commands, and sends the commands to the storage subsystem controller. If a syntax error is encountered, the execution stops, and an error message appears. Fix the error, and run the Verify Syntax option or the Verify and Execute option to validate the error correction.


Important:

If an execution error occurs, the script might not continue to execute depending on the included On Error script statement. The On Error Stop statement stops the script if an execution error is encountered. The On Error Continue statement lets the script continue even after an execution error is encountered. This statement is the default setting.

Interpreting the Script Execution Results

During script execution, messages appear in the Output view starting with this phrase:

Executing script...

After a successful script execution, this message appears:

Script execution complete.

If an error occurs during the parse phase, an error appears in the Output view, which gives the line and column number and a description of the syntax error.

Example – If you type this statement in a script:

set controller[a] mod = active;

Then the resulting syntax error appears in the Output view as follows:

Encountered "mod" at line 2, column 19

Was expecting one of...

"mode"...

"availability"...

"NVSRAMbyte"...

If an error occurs during execution, a message appears in the Output view, which states that the command failed and reports a description of the error.

Example – If you enter this statement in a script:

set logicalDrive [three] userLabel="OneOne";

The resulting error and command line that caused the error appear in the Output view as follows. In this example, the command could not be sent to the storage subsystem because it was in an state.

Unable to change the logical drive user label using the Set Logical Drive command at line 1

Error - 1 - Could not communicate with the storage subsystem to complete this request.

The command at line 1 that caused the error is:

set logical drive [three] userLabel="OneOne";


Important:

Certain execution errors, including the inability to communicate with the storage subsystem, always cause script execution to halt. When this happens, execution stops even if you have used the On Error Continue statement.

Related Links: