Configuring the Script Component

You use the Script Component Editor to configure scripts that operate on the parameters in your model.

  1. Double-click the Script component icon .

    The Script Component Editor appears.

  2. From the Script Component Editor, select the desired scripting language (Jython or DynamicJava) from the Language list.

  3. Type your script in the upper portion of the editor.

    The editor provides full undo/redo capability as well as cut/copy/paste functionality. You can right-click the text in the editor to access the functionality or use standard shortcuts, such as Ctrl-C and Ctrl-V.

  4. Create a new parameter, as desired:

    • Click to create a new parameter. The Add Parameter dialog box appears, and you define attributes of the parameter, such as its name and type. For information about the different parameter modes that are available, see About the Script Component. For more information about parameters, see the “Using Parameters” section of the Isight User’s Guide.

    • Click to create a new parameter as a member of a selected aggregate parameter. An aggregate parameter is a collection of parameters of different types and can contain scalars, arrays, and other aggregate parameters. The  button is available only if an aggregate parameter is selected in the Parameters list.

  5. To include a parameter in your script, do one of the following:

    • Select the parameter from the Parameter list, and click the button.

    • Type the name of the parameter directly in the script. The editor recognizes existing parameters and colors them green. If you type a parameter name in your script that does not match an existing parameter, the Script Component Editor assumes that it is a script variable, and it will not be initialized to anything or stored.

    • Type a portion of a parameter name or a global variable in the upper portion of the editor, and press CTRL+SPACE to complete the name. If more than one parameter name matches the portion you type, a menu appears allowing you to select the correct parameter. If you press CTRL+SPACE without typing any letters first, a list of all parameters and global variables appears.

    These referenced parameters are colored green in the script. For more information on other colors used by the Script component, see Understanding Color Coding in Scripts. You cannot edit a parameter name once it has been recognized and colored green; you must delete the parameter reference and insert another one.

    You do not have to define a script variable before you use it provided that the first reference is an assignment. Predefined script variables are underlined. The component provides predefined variables that you can use in your script, such as the directory in which the component is executing. The predefined variables are described in Global Variables for Script, Prologue, and Epilogue.

  6. If necessary, alter the Script Type setting in the Parameter list using the menu that appears when you click the corresponding column.

    The available types are described in About Parameters Within Scripts.

  7. Click Test Script to execute your script.

    The editor makes a copy of all of the parameters and runs the script in a test environment.

    The status bar at the bottom of the editor displays messages about the script.

    • Syntax errors are highlighted in pink. The highlighting is removed when you edit the script.

    • Values assigned to parameters are displayed in the status bar. The status bar attempts to shows all script errors but is limited in the number of characters it can display.

    • Click to open the Script Messages dialog box and get more information on a syntax error or to display errors that do not fit on the status bar. The Script message dialog also shows any messages printed with the Jython print statement, or any messages logged using the jobLog predefined variable.

    Tip: Leave the Script Messages dialog box open at all times when creating your scripts. This dialog box is cleared each time you click Test Script and is populated with messages as they are generated by the component.

  8. Click OK to save your changes and to close the Script Component Editor.