Basic Configuration of the Node.js® Interface

WinccoaManager Interface in JavaScript

For accessing WinCC OA functionality in TypeScript or JavaScript an instance of the WinccoaManager class must be created. This is done by using import(TypeScript) or require(JavaScript)

In case additional classes should be used, they must be stated within the import/require Block, see example below.

TypeScript - import WinccoaManager class

// import WinCC OA interface
import { WinccoaManager } from 'winccoa-manager';
const winccoa = new WinccoaManager();

JavaScript - require WinccoaManager class

// require WinCC OA interface
const { WinccoaManager } = require('winccoa-manager');
const winccoa = new WinccoaManager();

TypeScript - import multiple classes

import { WinccoaManager, WinccoaSecurityEventId, WinccoaError } from 'winccoa-manager';
const winccoa = new WinccoaManager();

Syntax Manager Options

The WinCC OA JavaScript Manager for Node.js allows additional parameters to be passed to Node.js as well as TypeScript/JavaScript by assigning them to the manager parameters.

These must follow a defined order to be transmitted to the corresponding components:

[Node.js Command-line Options] [WinCC OA Manager Parameters] <Script Name> [JavaScript Parameters]
Node.js-Command line Options
Command line options, which are directly forwarded to Node.js, see also Supported Node.js® Command line Options.

Node.js parameters must be stated with double dashes "--".

WinCC OA Manager Parameters
General WinCC OA manager parameters, see General options.

The following options are supported to specify the project:

  • -proj <project name>
  • -currentproj
  • -config <config file>
  • Environment variables (PVSS_II_PROJ)
Note:
The -num option (manager number) is optional. It is only required if the manager should be displayed in the Console. One-time execution managers (e.g. for ASCII import/export) do not need to specify -num.
Script Name

The path/name of the TypeScript/JavaScript script which should be executed by the manager.

The path for the script must be relative to the nodejs directory of the project or an absolute path to the script file.

TypeScript/JavaScript Parameters

To pass parameters to the script for TypeScript/JavaScript, these must be added at the end after the script name.

Access to the parameters is done via the process.argv constant.

Persistent manager with debugging

--inspect -num 42 mymodule/index.js arg1 arg2

The WinCC OA JavaScript Manager for Node.js will be started in the Debugging Modus with the Node.js option --inspect.

The WinCC OA manager starts with manager ID "42" and the parameters arg1 and arg2 are passed to the started script mymodule/index.js.

One-time execution with -currentproj

-currentproj mymodule/import.js

The WinCC OA JavaScript Manager for Node.js is started using the currently active project. No manager number is specified since this is a one-time execution (e.g. an ASCII import).