Altair® Monarch® Server

 

Inserting a Script for Visual Processes

To quickly generate VB.NET script for frequently used tasks, click the Insert Script button. The following options are available:

  • Add an event to the log: Select to add an event to the log. Enter the event text in the field provided.

  • Raise an alert: Select to prompt an alert to the process.

  1. In the Code field, enter the name of the alert code.

  2. In the Message field, provide an alert message.

  • Execute an external command line: Select to execute a command line application. This function allows you to specify the command line, the parameters, including Automator macros, and a timeout value for the command line. Specify the following settings:

    1. In the Command field, enter the command line text.

    2. In the Parameters field, specify the parameters to be passed to the program or batch file (you can also use the naming macros).

    3. Select one of the options:

      • No time limit: Specifies that a time limit for the command line to complete is not necessary.

Note: If the command line does not complete, Automator will wait indefinitely until it completes or is terminated.

      • Timeout after n second(s): Sets the delay before Automator terminates the command line.

    1. Click Insert to add the script.

Here is some sample code generated by the Insert Script.

If Shell("""c:\test.bat""",AppWinstyle.Hide,True,10000) <>0 Then

'TODO: Handle command timeout here.

End If

 

Note: Command lines are executed by the .NET service, which for security reasons does not allow the application to show a user interface. Please ensure that any command lines or applications you run do not require a user interface and shut themselves down after completion. In addition, be sure to specify a timeout value after which Automator will kill the offending process if you do not want Automator to hold up processing altogether. If no timeout is specified, Automator will wait forever until the command line returns. If you specify a timeout that is exceeded, then you can deal with that condition in your script.

  • Iterate through a list of input or output items — Select to run the script through a list of input or output items and specify whether you want to do it for data exceptions. Specify the following settings:

    1. Iterate through input items.

    2. Iterate through output items.

    3. Export Name — type the export element name.

  • Set the value of a runtime field: Select to specify a value for a runtime field. Specify the following settings:

    1. In the Field Name field, enter the name of the runtime field.

    2. In the Field Value field, specify the desired value for the runtime field.

    3. Select one of the following:

      • Set this value unconditionally: Sets the value unconditionally, resulting in a simple call to SetRuntimeFieldValue.

      • Set this value only if a value for this field has not already been set: Sets the value conditionally, resulting in a call to SetRuntimeFieldValue that is contingent on a return of False from HasRuntimeFieldValue.

    1. Click Insert to add the script.

  • Insert Script: Inserts the current script into the script field.

  • Cancel: Cancels any changes you have made.