Execute Command

This command executes a specified GPL program instruction as part of a specified project.  This command may be used with the /console web URL to set and get variable values.

Execute instruction, project_name, robot

Prerequisites

The project specified by project_name must be loaded and compiled. If project_name is omitted, at least one project must exist and be loaded.

Parameters

instruction

The GPL instruction to be executed. This instruction may be an assignment statement or a function reference. Only global public symbols may be directly referenced.

project_name

An optional name specifying the project in which the instruction should be executed. All symbols in instruction must be available in the project.  If this parameter is omitted, all loaded and compiled projects are searched.

robot

An optional number specifying the robot to be selected when executing instruction. If omitted, robot 1 is assumed.

Remarks

The specified instruction is executed in a thread named _Cmd_project_name where project_name is the name of the project in which the instruction is being run. If no project is specified, all projects are searched, in alphabetical order, until one is found that allows the instruction to be compiled without error.

This command may be used with the /console web URL to set and get variable values.

Unlike the Set Global command, this command allows procedures including object methods to be called.

If the instruction does not finish executing within 30 seconds, the "Timeout stopping thread" (-753) error will be generated.

Examples

Assume you have a program loaded and compiled with the following declarations:

Module GPL
          Publicl1 As Location
          Public i1 As Integer
          Public s1 As String
End Module

The following commands would be valid:

GPL: execute l1=New Location
GPL: execute l1.XYZ(100,200,300,0,-180,0)
GPL: execute i1=123
GPL: execute s1=", X="
GPL: execute Console.Writeline(CStr(i1) & s1 & CS(l1.X))

Generates 123, X=100

See Also

Console Commands | Set GlobalCommand