new Task(task)
This class represents a RAPID Task. It includes some usefull ready-to-use functionalities based on the the OmniCore SDK. This class cannot be directly instantiated. Therefore the API.RAPID.getTask() method instead.
| Name | Type | Description |
|---|---|---|
task | object | A RWS.RAPID task object. |
- Source
- See
const task = await API.RAPID.getTask('T_ROB1');
const modules = await task.searchModules();Methods
(async) getModule(module) → {Promise.<object>}
Gets a module. This will retrieve the properties of the module from the controller and initialize the object.
| Name | Type | Description |
|---|---|---|
module | object | The name of the module |
- Source
- See
A RWS module object.
- Type:
- Promise.<object>
const task = await API.RAPID.getTask('T_ROB1');
await task.getModule("MainModule")(async) getValue(module, variable) → {Promise.<object>}
Gets the value of a RAPID variable.
| Name | Type | Description |
|---|---|---|
module | string | The module containing the variable. |
variable | string | The variable name |
- Source
- Type:
- Promise.<object>
// get the variable value of RAPID variable n1 in MainModule
const task = await API.RAPID.getTask('T_ROB1');
await task.getValue("MainModule", "n1")(async) getVariableInstance(module, variable, subscribe) → {Promise.<object>}
Gets a RWS Data object variable
| Name | Type | Default | Description |
|---|---|---|---|
module | string | The module containing the variable | |
variable | string | The variable name | |
subscribe | boolean | true |
- Source
- See
API.RAPID.Variable object
- Type:
- Promise.<object>
const task = await API.RAPID.getTask('T_ROB1');
await task.getVariableInstance("MainModule", "aa")(async) loadModule(path, replace)
Load a module from the controller HOME files
| Name | Type | Default | Description |
|---|---|---|---|
path | string | Path to the module file in the HOME directory (included extension of the module). | |
replace | boolean | false | If true, it will replace an existing module in RAPID with the same name |
- Source
let url = `${this.path}/${this.name}${this.extension}`;
await task.loadModule(url, true);(async) searchModules(isInUseopt, filteropt) → {Promise.<Array.<RWS.Rapid.SymbolSearchResult>>}
Searchs for available modules
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
isInUse | boolean | <optional> | false | Only return symbols that are used in a RAPID program, i.e. a type declaration that has no declared variable will not be returned when this flag is set to true. |
filter | string | <optional> | Only symbols in the string pattern (not case-sensitive) |
- Source
- Type:
- Promise.<Array.<RWS.Rapid.SymbolSearchResult>>
const task = await API.RAPID.getTask('T_ROB1');
await task.searchModules()(async) searchProcedures(module, isInUseopt, filteropt) → {Promise.<Array.<RWS.Rapid.SymbolSearchResult>>}
Searchs for procedures contained in a module
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
module | string | null | Module where the search takes place | |
isInUse | boolean | <optional> | false | Only return symbols that are used in a RAPID program, i.e. a type declaration that has no declared variable will not be returned when this flag is set true. |
filter | string | <optional> | Only symbols in the string pattern (not case-sensitive) |
- Source
- Type:
- Promise.<Array.<RWS.Rapid.SymbolSearchResult>>
const task = await API.RAPID.getTask('T_ROB1');
await task.searchProcedures()(async) searchRoutines(module, isInUseopt, filteropt) → {Promise.<Array.<RWS.Rapid.SymbolSearchResult>>}
Search for routines contained in a module
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
module | string | null | Module where the search takes place | |
isInUse | boolean | <optional> | false | Only return symbols that are used in a Rapid program, |
filter | filterRoutines | <optional> | See filterRoutines |
- Source
- Type:
- Promise.<Array.<RWS.Rapid.SymbolSearchResult>>
const task = await API.RAPID.getTask('T_ROB1');
await task.searchRoutines()(async) searchVariables(module, isInUseopt, filteropt) → {Promise.<Array.<RWS.Rapid.SymbolSearchResult>>}
Searchs for variables contained in a module
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
module | string | null | Module where the search takes place | |
isInUse | boolean | <optional> | false | Only return symbols that are used in a Rapid program, |
filter | filterVariables | <optional> | See filterVariables |
- Source
- Type:
- Promise.<Array.<RWS.Rapid.SymbolSearchResult>>
// list all num variables in MainModule of task T_ROB1
const task = await API.RAPID.getTask('T_ROB1');
await task.searchVariables("MainModule", false, {dataType: "num"});(async) setValue(module, variable, value) → {Promise.<object>}
Sets the value of a variable
| Name | Type | Description |
|---|---|---|
module | string | Module containing the variable |
variable | string | Variable name |
value | object | Value of the variable |
- Source
- To Do
- Valiation of value not yet applied
- Type:
- Promise.<object>
// set the variable value of RAPID variable n1 in MainModule
const task = await API.RAPID.getTask('T_ROB1');
await task.setValue("MainModule", "aa",7);(async) stopExecution(props)
Stops the RAPID execution with the settings given in the parameter object. All or any of the defined parameters can be supplied, if a value is omitted a default value will be used. The default values are: stopMode = 'stop' useTSP = 'normal'
| Name | Type | Description |
|---|---|---|
props | stopExecutionProps |
- Deprecated
- since version 1.1.0, use API.RAPID.stopExecution instead
- Source
const task = await API.RAPID.getTask('T_ROB1');
await task.stopExecution();(async) unloadModule(module)
Unloads a RAPID module
| Name | Type | Description |
|---|---|---|
module | string | Module's name |
- Source
await task.unloadModule("MainModule");Type Definitions
stopExecutionProps
Properties| Name | Type | Attributes | Description |
|---|---|---|---|
stopMode | RWS. | <optional> | Stop mode, valid values: 'cycle', 'instruction', 'stop' or 'quick_stop' |
useTSP | RWS. | <optional> | Use task selection panel, valid values: 'normal' or 'all_tasks' |
- Source