![]() ![]() |
GoFiler Legato Script Reference
Legato v 1.6c Application v 6.1a
|
Table of Contents | < < Previous | Next >> |
Chapter Four — Flow Control (continued)
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 and the results stored.
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 executed script or the RunScript function. Since the called script can return integer values with the ERROR_BIT set, the error status of the run cannot be determined without using the IsError or IsNotError functions (without the return value) or checking using the GetLastError function.
On success, the last error will contain the data type of the data returned by the called script. For non-integer values, the return value will be ERROR_NONE. For integer based values, the return value will be a 32-bit integer. Use the GetReturned. functions to retrieve other data type. See Remarks below.
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 normally (or exits using the exit statement).
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. For script errors, the last error message will contain the last message from the script error log.
On normal exit, if not overridden by the called script, the last error will contain the returned data type:
Definition | Bitwise | Description | ||||
SVT_BASE_MASK | 0x000F0000 | Mask for Type | ||||
SVT_BASE_UNDEFINED | 0x00000000 | Type is Not Defined (auto) | ||||
SVT_BASE_INTEGER | 0x00010000 | Signed Integer (64 bit) | ||||
SVT_BASE_FLOAT | 0x00030000 | Floating Point (64-bit) | ||||
SVT_BASE_ASTRING | 0x00050000 | ANSI 8-bit String | ||||
SVT_BASE_WSTRING | 0x00060000 | Wide 16-bit String | ||||
SVT_BASE_HANDLE | 0x00070000 | Handle/Etc Types | ||||
SVT_BASE_VOID | 0x00090000 | Void |
The following functions can be used to retrieve not int values: GetReturnedFloat GetReturnedInteger GetReturnedString and GetReturnedWString.
If the called script performs a SetLastError on exit, the code and message will be passed through as the last error code (modified) and last error message. To avoid a message from the called script being interpreted as an error, the top bit, ERROR_BIT (0x80000000), is stripped off.
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
Page revised 2025-06-16
Table of Contents | < < Previous | Next >> |
© 2012-2025 Novaworks, LLC. All rights reserved worldwide. Unauthorized use, duplication or transmission is prohibited by law. Portions of the software are protected by US Patents 10,095,672, 10,706,221 and 11,210,456. Novaworks, GoFiler™ and Legato™ are registered trademarks of Novaworks, LLC. EDGAR® is a federally registered trademark of the U.S. Securities and Exchange Commission. Novaworks is not affiliated with or approved by the U.S. Securities and Exchange Commission. All other trademarks are the property of their respective owners. Use of the features specified in this language are subject to terms, conditions and limitations of the Software License Agreement.