Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5d

Application v 5.25a

  

 

Chapter FourFlow Control (continued)

RunScript Function

Overview

The RunScript loads a specified script and runs the script from an optional entry point. Optional parameters can be passed to the target script. After processing the target script is unloaded.

Syntax/Parameters

Syntax

int = RunScript ( string name, [string function], [parameters ...] );

Parameters

name

A string containing the name of the script to run. If name contains a qualified path, that file is loaded and run from that location. If the path is not qualified, it is resolved using the calling scripts main module path.

function

A string containing the name of the function to run. If omitted or empty, the default entry point is located and run.

parameters

Zero or more optional parameters to pass to the script. Variables cannot be passed by reference. When parameters are employed, the function parameter must be provided. However, it can be a simple "" empty string. Handles cannot be passed.

Return Value

Returns an int containing the return value from the script or the function. The type of return value cannot be determined without calling the GetLastError function. If the last error value is ERROR_NONE, then the script executed and the return value of the RunScript function is the value returned from the script. Otherwise, the last error and return value will match as an error code.

It is important to note that an error can be the result of a syntax error, undefined symbol, or other runtime error on behalf of the target script.

Remarks

The RunScript function loads the script and runs it from the specified point. The execution thread is passed to the other script and will remain there until that script returns or exits. Errors will stop the called script and return execution to the calling script.

The most common error code is script ERROR_FILE with additional information such as ERROR_FILE_NOT_FOUND. If there are syntax errors in the target script, an ERROR_SYNTAX error will be returned with the code of last script error.

RunScript will always return an error log retrievable using the GetLastErrorLog function. Under optimal circumstances, the log will only contain the run header and time. If the script uses the default log, the GetLastDefaultLog function will return a handle to that log. If the default log was not employed, GetLastDefaultLog will return NULL_HANDLE. Note that both log handles will be immediately closed when the next non-error processing SDK function is executed.

Related Functions

Platform Support

Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL

Legato IDE, Legato Basic