nkScript Object

In ogScript, use the nkScript object to control NK Router OGLML tags used in Switchboard virtual control panels. Functions in the nkScript object are typically set through a user interface.

The nkScript global object is only accessible in OGLML contexts that have been declared as having the NK Router context type or are beneath such a context in the OGML document hierarchy.

To call a general-purpose function, use:

nkscript.functionname (parameters);

For example:

nkscript.setHost (Server01);

The following table lists the functions of the nkscript object.

Function

Parameters

Returns

Description

doSwitch

N/A

Boolean

Equivalent of calling:

doSwitch(getActiveDst(), getActiveSrc(), getLevelMask());

doSwitch

Int [Dst],

Int [Src], Long [Levels]

Boolean

Do a switch on the active IPS to route the given dst to the given src on the given levels.

getActiveDst

N/A

Int

Get the active dst number

(0-indexed). Returns -1 if there is no active destination.

getActiveDstName

N/A

String

Get the name of the active dst (from the switchboard configuration).

Returns null if there is no active destination.

getActiveIPS

N/A

String

Get the serial number of the active IPS

getActiveIPSName

N/A

String

Get the name of the active IPS

getActiveSrc

N/A

Int

Get the active src number

(0-indexed). Returns -1 if there is no active source.

getActiveSrcName

N/A

String

Get the name of the active src (from the switchboard configuration).

Returns null if there is no active source.

getLevelMask

N/A

Long

get the current level mask (as a bit field)

isLevelActive

Int [Level Num]

Boolean

Is the current level active. Equivalent to asking:

levelMask & (1 << levelNum) != 0;

isMCFlag

N/A

Boolean

Is the Machine Control flag set.

isProtected

N/A

Boolean

Is the active destination protected.

isProtectedByMe

N/A

Boolean

Is the active destination protected by this virtual panel.

isSrcActive

Int [Src]

Boolean

Is the given source active on the active destination any level.

isSrcActive

Int [Dst],

Int [Src], Long [Levels]

Boolean

Is the given source active on the given destination on the given level mask.

isVirtual

N/A

boolean

Is virtual routing in use (for switch commands and status requests).

setActiveDst

Int [Dst]

Boolean

Set the active destination (0-indexed).

setActiveIPS

String [Serial]

boolean

Set the IPS with the given serial number as the active IPS to receive commands and send status.

Deactivate any currently active IPS.

setActiveSrc

Int [Src]

N/A

Set the active source (0-indexed).

setLevelActive

Int [Level Num]

boolean

Set the given level as active.

setLevelMask

Long [Level Mask]

N/A

Set the complete level mask bitfield.

setMCFlag

Boolean

Boolean

Set the Machine Control flag to true or false.

setProtected

Boolean

Boolean

Request the router to protect the active destination.

setVirtual

Boolean

Boolean

Set virtual routing on/off for switch commands and status requests.

verifyConfiguration

N/A

Boolean

Re-activate the current IPS.