API.RWS. RAPID

The API.RWS.RAPID namespace provides RAPID-related interfaces that are not supported by the OmniCore SDK.

Methods

getCycleMode() → {Promise.<string>}

Gets the current cycle mode of the program execution.

Returns:

The current cycle mode.

Type: 
Promise.<string>
Example
const cycleMode = await API.RWS.RAPID.getCycleMode();

getDataTypeProperty(typeUrl) → {Promise.<any>}

Gets the properties of the specified RAPID data type

Parameters:
NameTypeDescription
typeUrlstring

The URL of the data type.

Returns:
Type: 
Promise.<any>
Example
await API.RWS.RAPID.getDataTypeProperty('robtarget');

getDataTypeStructure(typeUrl) → {Promise.<any>}

Get the data structure of the specified RAPID data type

Parameters:
NameTypeDescription
typeUrlstring

The URL of the data type.

Returns:
Type: 
Promise.<any>
Example
await API.RWS.RAPID.getDataTypeStructure();

getModuleText(moduleName, taskName) → {Promise.<any>}

Gets the RAPID module text.

Parameters:
NameTypeDescription
moduleName*

The module name.

taskName*

The task name.

Returns:

An object containing the structure { change-count, module-length, module-text?, file-path?, _title, _type, }

Type: 
Promise.<any>
Example
const moduleText = await API.RWS.RAPID.getModuleText('MyModule', 'T_ROB1');

getPointersInfo(taskNameopt) → {Promise.<any>}

Gets the information of program pointers

Parameters:
NameTypeAttributesDescription
taskNamestring<optional>

The task name.

Returns:
Type: 
Promise.<any>
Example
const pointersInfo = await API.RWS.RAPID.getPointersInfo('T_ROB1');

getRecordTypes(task) → {Promise.<any>}

Gets the RECORD data list.

Parameters:
NameTypeDescription
taskstring

The task name.

Returns:
Type: 
Promise.<any>
Example
await API.RWS.RAPID.getRecordTypes()

getServiceRoutines(exturl, allread) → {Promise.<any>}

Gets the service routines.

Parameters:
NameTypeDescription
exturlstring

External URL for the service routines.

allreadboolean

Indicates whether to include all the readable routines.

Returns:
Type: 
Promise.<any>

getTaskChangeMonitor(taskName) → {Promise.<object>}

Gets an instance of a API.RAPID.TaskChangeMonitor class

Parameters:
NameTypeDescription
taskNamestring

Task name

Returns:
  • API.RAPID.TaskChangeMonitor
Type: 
Promise.<object>
Example
let taskChangeMonitor = await API.RWS.getTaskChangeMonitor();
const taskchangeCb = function (data) {
   console.log('RAPID is changed');
 };
taskChangeMonitor.addCallbackOnChanged(taskchangeCb);
taskChangeMonitor.subscribe()

getVariableRawValue(moduleName, variableName, taskName) → {Promise.<string>}

Gets the raw value of a RAPID variable.

Parameters:
NameTypeDescription
moduleNamestring

The module name.

variableNamestring

The variable name.

taskNamestring

The task name.

Returns:
Type: 
Promise.<string>
Example
await API.RWS.RAPID.getVariableRawValue('TestModule', 'TestVariable', 'T_ROB1');

loadModule(path, replaceopt, taskNameopt, requestMshopt) → {Promise.<any>}

Loads a module from the HOME directory of the controller into the specified task.

Parameters:
NameTypeAttributesDescription
pathstring

Path to the module file in the HOME directory (including the file extension).

replaceboolean<optional>

If the value is 'true', existing module in RAPID with the same name will be replaced.

taskNamestring<optional>

The task name.

requestMshboolean<optional>

Edit mastership needs to be requested before loading the module.

Returns:
Type: 
Promise.<any>
Example
let url = `${this.path}/${this.name}${this.extension}`;
await API.RWS.RAPID.loadModule(url, true, 'T_ROB1');

movePPToCursor(moduleName, taskName, line, column) → {Promise.<any>}

Moves the program pointer to a specified cursor position.

Parameters:
NameTypeDescription
moduleNamestring

The module name.

taskNamestring

The task name.

linestring

Number of the line to which the pointer is desired.

columnstring

Number of the column to which the pointer is desired.

Returns:
Type: 
Promise.<any>
Example
await API.RWS.RAPID.movePPToCursor('MyModule', 'T_ROB1', '10', '5');

setCycleMode(mode) → {Promise.<any>}

Sets the cycle mode for the program execution.

Parameters:
NameTypeDescription
modestring

Cycle mode, e.g., 'once' or 'forever'.

Returns:
Type: 
Promise.<any>
Example
await API.RWS.RAPID.setCycleMode('forever');

setModuleText(moduleName, text, taskNameopt) → {Promise.<any>}

Sets the content of a RAPID module.

Parameters:
NameTypeAttributesDescription
moduleNamestring

The module name.

textstring

The new content of the module.

taskNamestring<optional>

The task name.

Returns:
Type: 
Promise.<any>
Example
await API.RWS.RAPID.setModuleText("Module1",`MODULE Module1\r\nPROC proc1()\r\nTPWrite "123";\r\nENDPROC\r\nENDMODULE`), 'T_ROB1');

setModuleTextInRange(moduleName, text, startRow, startCol, endRow, endCol, taskNameopt, replaceModeopt) → {Promise.<any>}

Sets the content of a RAPID module within a specified range.

Parameters:
NameTypeAttributesDescription
moduleNamestring

The module name.

textstring

The new content to insert.

startRownumber

Start row of the range.

startColnumber

Start column of the range.

endRownumber

End row of the range.

endColnumber

End column of the range.

taskNamestring<optional>

The task name.

replaceModestring<optional>

Replace mode, e.g., 'Replace'.

Returns:
Type: 
Promise.<any>
Example
await API.RWS.RAPID.setModuleTextInRange(
  'MyModule',
  'TPErase;',
  5,
  1,
  10,
  1,
  'T_ROB1',
  'Replace'
);

setPPToRoutine(moduleName, routineName, taskNameopt) → {Promise.<any>}

Sets the program pointer to a specified routine.

Parameters:
NameTypeAttributesDescription
moduleNamestring

The module name.

routineNamestring

Routine's name.

taskNamestring<optional>

The task name.

Returns:
Type: 
Promise.<any>
Example
await API.RWS.RAPID.setPPToRoutine('MyModule', 'MainRoutine', 'T_ROB1');

syncPers(moduleName, taskNameopt) → {Promise.<any>}

Synchronizes the value of persistent variables in a specified module.

Parameters:
NameTypeAttributesDescription
moduleNamestring

The module name.

taskNamestring<optional>

The task name.

Returns:
Type: 
Promise.<any>
Example
await API.RWS.RAPID.syncPers('MyModule', 'T_ROB1');

unloadModule(moduleName, taskNameopt, requestMshopt) → {Promise.<any>}

Unloads a RAPID module.

Parameters:
NameTypeAttributesDescription
moduleNamestring

The module name.

taskNamestring<optional>

The task name.

requestMshboolean<optional>

Edit mastership needs to be requested before unloading the module.

Returns:
Type: 
Promise.<any>
Example
await API.RWS.RAPID.unloadModule('MyModule', 'T_ROB1');