PROGRAM

Concept Link IconSee also Concept Link IconExample

Executed, load, unload or stop a program or function.

WebVue support - Yes.

Mode Mnemonic Syntax
0 STOP 1
1 START 1, 3
2 IS_LOADED 1
3 PRELOAD 1, 3
4 UNLOAD 1
5 EXECUTE 1
9 FUNCTION 2
10 IS_FUNCTION 2

Syntax 1

IntVal = PROGRAM(Mode, ProgName, Branch) ;

Return type: INTEGER.

Argument

Meaning

ProgName

The name of a program.

Branch

The branch for the program.

Execution

Mode

Mnemonic

Action

0

STOP

Stop the execution of a program and unload it.

Fails if the program is not loaded

1

START

Load a program and execute it.

Fails if the program is already loaded. Use Execute instead.

2

IS_LOADED

Test if a program is loaded.

3

PRELOAD

Load a program.

Fails if the program is already loaded

4

UNLOAD

Unload a program.

Fails if the program is not loaded

5

EXECUTE

Execute a program.

Fails if the program is not loaded

    Return: 1 if successful, else 0 (program does not exist...)

Syntax 2

IntVal = PROGRAM(Mode, ProgName, Branch, Function[Farg]) ;

Return type: INTEGER.

Argument

Meaning

ProgName

The name of a program.

Branch

The branch for the program.

Function

The name of a function in the program ProgName.

Farg

Optional. From 1 to 8 arguments, comma-separated, up to 2,047 characters. Type STR.

Execution

Mode

Mnemonic

Action

9

FUNCTION

Runs the specified function.

If the name of the function is not specified then the Main function is executed.

Return: 1 if successful, 0 if the program is not loaded.

10

IS_FUNCTION

Check whether the function exists.

Return: 1 if successful, 0 if the function does not exist.

The name of the branch is not accessible in the Main function of the program.

The function must be pre-loaded before it can be executed. If the function call is to include a branch, the program must be first pre-loaded with the same branch.

Syntax 3

IntVal = PROGRAM(Mode, ProgName, Branch, [, Dynamic]);

Return type: INTEGER.

Argument

Meaning

ProgName

The name of a program.

Branch

The branch for the program.

Dynamic

Optional. 0 for normal operation, 1 for dynamic load.

Execution

Mode

Mnemonic

Action

1

START

Load a program and execute it. If the optional parameter Dynamic is 1, the program is loaded and started even if a copy of it is already loaded.

3

PRELOAD

Load a program. If the optional parameter Dynamic is 1, the program is loaded even if a copy of it is already loaded.

 

 

Return: 1 if successful, else 0.

Example

IF(PROGRAM("IS_LOADED", "prog1", "")==0) THEN
PROGRAM("START", "prog1", "");
ENDIF

For further examples, select the Example link above.