krn.RunScript
Executes a VBScript or JavaScript on the server. The script text is determined in the following order: parameter Script, parameter ScriptFile, file list.
If the script is empty and only parameters are passed, only the server-side before/after events are triggered.
This is a generic job: any input parameters can be passed and the server can return any output parameters and files.
1. Input Parameters
| Name | Type | Required | Description |
|---|---|---|---|
|
INT |
Yes |
Currently not supported — pass |
|
STRING |
Yes |
Script text to execute. Can be empty if |
|
STRING |
Yes |
Context name. Empty = default name is used. |
|
BOOLEAN |
Yes |
|
|
BOOLEAN |
Yes |
|
|
BOOLEAN |
No |
|
|
STRING |
No |
Name of the entry point function. Default: |
|
STRING |
No |
Name of a script file in the |
|
STRING |
No |
Name of the script for debugging purposes. |
|
INT |
No |
V8 inspector control (JavaScript only). |
any |
any |
No |
All additional parameters are forwarded as input parameters to the job and the server-side events. |
2. Input Files
Any files can be passed. The script or the server-side events can process them and return custom files in the response.
3. Output Parameters
| Name | Type | Description |
|---|---|---|
|
variable |
Return value of the script. The type depends on the script ( |
any |
any |
The script and the server-side events can set any additional output parameters. |
4. Eval and Exec
Exec mode (Eval=false): The script is executed as a function block. The return value of the entry point function (default: Main) is returned as $ScriptResult$.
Function Main()
Main = 42
End Function
Eval mode (Eval=true): The script text is evaluated as an expression. The result is returned as $ScriptResult$.
5. Return Value
(INT): 0 = Job successful, otherwise error code.
| If all logic resides in server-side before/after events and no script text is needed, prefer using krn.EmptyJob instead. |
6. See Also
krn.EmptyJob — Generic job without script execution, controlled only via events.