Module for ActiveX management

Methods

Name Description
create Triggers a activeX left click at a given position
connect Triggers a activeX left click at a given position
disconnect Deisconnects notifications
getObject Returns a reference to an Automation object
getObject Returns a reference to an Automation object, creates it if not existing
click Simulates a mouse click, based on absolute desktop coordinates
del Delete a value or set of values from the data object
exist Tests if a value or set of values exists in the data object
exec Executes a shell command in synchronous or asynchronous mode
execRun Executes a shell command
execVBS Executes a VBScript function
formatFunction returns a function call as a string, from a list of arguments
get Returns a value or set of values in the data object
getByPath returns an object from its reference path
getActivePages Get the list of active pages for all applications
getDate Serializes a given date or current date to format “‎YYYY-MM-DD”: “‎2015-03-‎02‎”, …
getTime Serializes a given date or current date to format HH:MM:SS.mmm
getRandom Returns a random number between min (included) and max (included if maxIncluded is true, otherwise excluded)
getTimestamp Serializes a given date or current date to an String (“YYYY-MM-DD.HH:MM:SS.MS”)
highlight Highlights a given area during a given duration
keyStroke Sends a keyboard set of keys to the active page
keyStrokeEx Sends a keyboard set of keys to the active page (extended version)
log Generates a log message in debugger and trace file
logEvent Generates a log message in Windows Event Viewer.
messbox2Execute Executes an action on 'ctx.popup.messbox2'
off Resets a listening handler or a wait handler
on Sets a permanent or single handler to listen to a given event
once Sets a single handler to listen to a given event
polling Function used to implement asynchronous polling loops
setAutoRestart Reads a text from a file
readFile Reads a text from a file
regHotKey Declares a global shortcut ('hot key') which triggers a functional event
resolvePath Resolves a path, especially to replace patterns with run-time paths
screenshot Makes a screenshot of an application window or screen area
serialize Serializes an object to a JSON string
shellexec Launches an application
sleep Generates a synchronous wait with a given delay
tooltip
tooltipInit
unserialize Unserialize an JSON string to an object
wait Sets a timeout callback
workflow Sets a reference to a flowflow
writeFile Writes a text to a file


Base 64 encoding/decoding library

Methods

Name Description
decode Decodes a base 64 string to a buffer
decodeArrayBuffer Decodes a base 64 string to a buffer array
decodeStream Decodes a base 64 string to a binary stream
encode Encodes a string or binary array to a base 64 string
encodeArrayBuffer Encodes a buffer array to a base 64 string
encodeStream Encodes a binary stream to a base 64 string


AJAX management library

Methods

Name Description
call Creates and sends an Http Request to call a remote service or download a file
download Downloads an http/https file to a local destination


Module for Clipboard management

Methods

Name Description
get Gets clipboard textual content
set Sets clipboard textual content
enableTrack Enables/disables the monitoring of the 'Windows clipboard'


Module for Context management

Methods

Name Description
addCtx Adds a context node
delCtx Deletes a context node
exist Tests if an XML node exists, in a context tree
get Gets a context variable
getAppDesc Gets a context node as a node
getCtx Gets a context node as a node
getNode Gets a context node as an IXMLNode object
getProject Gets a node as an IXMLNode object, from the project XML tree
set Sets a context variable
setCtx Sets a context node


Class for cryptography management

Ex.:

var key = new ctx.cryptography.keyClass( { ... } );

Constructor

ctx.cryptography.keyClass [obj]

Properties

Name Type Description Default value
name {string} key name undefined
comment {string} key description undefined
usage {e.cryptography.keyUsage} key usage (encryption or signature) undefined
type {e.cryptography.keyType} key type : container or certificate (default is 'container') undefined
server {boolean} undefined
store {string} key store (for certificate) undefined
storeLocation {e.cryptography.storeLocation} key store location undefined
algorithm {e.cryptography.algorithm} cyphering algorithm undefined
publicKey {string} undefined
h1 {string} undefined
h2 {string} undefined
alias {string} undefined

Methods

Name Description
init
get
set


Constructor

ctx.cryptography.credentialClass [obj]

Properties

Name Type Description Default value
_userName {string} undefined
_password {string} undefined
name {string} undefined
comment {string} undefined
machine {boolean} undefined
user {boolean} undefined
key {ctx.cryptography.keyClass} undefined
env {e.env} undefined
server {boolean} undefined
type {e.cryptography.credentialType} undefined
persist {e.cryptography.credentialPersist} undefined

Methods

Name Description
init
get
remove
reset
set
get
set
get
set


Ex.:

var key = ctx.cryptography.key({ DefaultKey: {
  type: e.cryptography.keyType.container
}});

Constructor

ctx.cryptography.key [params]

Ex.:

var credential = ctx.credential({ default: {
  ...
}});

Constructor

ctx.cryptography.credential [params]

Methods

Name Description
searchKey
searchCredential
initKey Initializes the key
initKeys Initializes all declared keys

Properties

Name Type Description Default value
{credentials} Map of credentials undefined

Methods

Name Description
generatePassword Generates a random password
createKeyContainer Creates a key container with a private / public key pair
deleteKeyContainer Deletes an existing key container
readRegPublicKey
saveRegPublicKey Saves the public key in registry
getPublicKey Returns the public key from an existing key container
getPublicKeys Get all public keys on server or client side
savePublicKey Stores a public key in a key container (without private key)
decryptFileToFile Decrypts a cyphered file to a clear file using a private key from a key container
decryptFileToString Decrypts a cyphered file to a clear string using a private key from a key container
decryptMessage Decrypts a message using a certificate or key container
encryptFileToFile Encrypts a clear file to a cyphered file using a public key from a key container
encryptMessage Encrypts a message using a certificate or key container
encryptStringToFile Encrypts a clear string to a cyphered file using a public key
protect Encrypts a value using a key local to the user session
signEncryptMessage Signs and encrypts a message using a certificate or key container
signMessage Signs a message using a certificate or key container
unprotect Decrypts a value using a key local to the user session
verifyDecryptMessage Verifies and decrypts a signed message using a certificate or key container
verifyMessage Verifies a signed message using a certificate or key container


Class to store multi-lingual labels in objects (applications, …)

Methods

Name Description
get Gets a label from its identifier
set Sets a set of labels
addLanguage Adds supplementary languages in the label container
getLabels Gets label list
setLanguage Sets the current language
getLanguage Gets the current language


Module for Mouse management

Methods

Name Description
click Triggers a mouse left click at a given position
clickMiddle Triggers a mouse middle click at a given position
clickRight Triggers a mouse right click at a given position
clickXButton1 Triggers a click on XButton1
clickXButton2 Triggers a click on XButton1
dragAndDrop Triggers a drag&drop between two positions
dragAndDropRight Triggers a right drag&drop between two positions
move Triggers a mouse move to a given position
scrollWheel Triggers a wheel scroll with a given offset


Module for Registry management

Methods

Name Description
del Deletes a registry value or key
get Reads a registry entry
getMultiString Reads a registry multi string entry
getRoot Returns the standard registry root used to store user settings (located in “HKCU\\Software\\SAP\\Intelligent RPA\\CtxtRun\\Settings\\”)
set Writes a key or value in registry


Description

Constructor

ctx.settingClass [obj]

Properties

Name Type Description Default value
name {string} undefined
comment {string} undefined
value {*} undefined
key {ctx.cryptography.keyClass} undefined
env {e.env} undefined
server {boolean} undefined

Methods

Name Description
get
reset
set


Ex.:

var setting = ctx.setting({ default: {
...
}});

Constructor

ctx.cryptography.setting [params]


create( id, [prefix] )

Summary:

Triggers a activeX left click at a given position

Description:

Ex.:

var ie = ctx.activeX.create("InternetExplorer.Application", "ie_");

Parameters:

Name Type Description
id {string}
[prefix] {string} (Optional)

Return:

Type Description
{Object} created ActiveX


connect( activeX, prefix )

Summary:

Triggers a activeX left click at a given position

Description:

Ex.:

var ie = ctx.activeX.create("InternetExplorer.Application");
ctx.activeX.connect(ie, "ie_");

Parameters:

Name Type Description
activeX {Object} object
prefix {string}

Return:

Type Description
{Object} ActiveX object


disconnect( activeX )

Summary:

Deisconnects notifications

Description:

Ex.:

ctx.activeX.disconnect(ie);

Parameters:

Name Type Description
activeX {Object} object

Return:

Type Description
{Object} ActiveX object


getObject( path, [id] )

Summary:

Returns a reference to an Automation object

Description:

Ex.:

var shellObj = ctx.activeX.getObject("WScript.Shell")

Parameters:

Name Type Description
path {string}
[id] {string} (Optional)

Return:

Type Description
{Object} ActiveX object


getObject( id )

Summary:

Returns a reference to an Automation object, creates it if not existing

Description:

Ex.:

var shellObj = ctx.activeX.getOrCreateObject("WScript.Shell")

Parameters:

Name Type Description
id {string}

Return:

Type Description
{Object} ActiveX object


click( X, [Y] )

Summary:

Deprecated Deprecated This feature is no longer recommended.
Simulates a mouse click, based on absolute desktop coordinates

Description:

Ex.:

var x=...;
var y=...;
ctx.click(x, y);

Parameters:

Name Type Description
X {ctx.position, number} position object or relative horizontal position (compared to desktop top left position)
[Y] {number} relative vertical position (compared to desktop top left position) (Optional)

Return:

Type Description
{string} result value


del( target, [path], [pathType] )

Summary:

Delete a value or set of values from the data object

Description:

Ex.:

ctx.del("//Data_Popup1", e.data.pathType.XPath);

Parameters:

Name Type Description
target {Object} object of the operation
[path] {string} path (Optional)
[pathType] {e.data.pathType} data path type (default is 'e.data.pathType.XPath')
(see e.data.pathType) (Optional)

Return:

Type Description
{*} returned object or value


exist( target, [path], [pathType] )

Summary:

Tests if a value or set of values exists in the data object

Description:

Ex.:

if (ScnApp.data.exist("//Data_Popup1", e.data.pathType.XPath)) { ... }

Parameters:

Name Type Description
target {Object} object to be tested
[path] {string} path (Optional)
[pathType] {e.data.pathType} data path type (default is 'e.data.pathType.XPath')
(see e.data.pathType) (Optional)

Return:

Type Description
{boolean} returned object or value


exec( command, [timeout], [callback] )

Summary:

Executes a shell command in synchronous or asynchronous mode

Description:

This function can be used to execute treatments, in synchronous or asynchronous mode It is based on 'WScript.Shell.Exec' method : see https://msdn.microsoft.com/en-us/library/ateytk4a(v=vs.84).aspx for more details

Using asynchronous mode is recommended to perform long or CPU consuming treatments without interupting Contextor execution, with timeout management.

  • asynchronous mode : a callback is provided, called when treatment is finished.

An object is returned by function (and passed to callback in asynchronous mode):

Attribute Description
processId {number} process Id. Can be used to distinguish diiferent treatments launched in parallel.
async {boolean} asynchonous (true) or synchonous (false) mode
exitCode {number} process exit code
duration {number} process approximative duration in seconds
timeout {boolean} 'true' if function failed in timeout (always 'false' in synchonous mode)
output {string} process output
error {string} error string
var command = '...';
var timeout = ...
ctx.exec(command, timeout, function(obj) {
  // called when treatment is finished
  // obj = {exitCode=..., output=..., error=...};
  ...
});
  • synchronous mode : no callback is provided, the result object is returned by the function
var command = '...';
var timeout = ...
var obj = ctx.exec(command);
// obj = {exitCode=..., output=..., error=...};

Ex.:

// returns the result of 'ipconfig /all' command, in synchronous mode
var obj = ctx.exec('ipconfig /all');
 
// performs a network copy, in asynchronous mode
var command = 'robocopy "z:\\..." "c:\..." /MIR';
var res = ctx.exec(command, 30, function(obj) {
  ...
});

You can use 'snippets' to accelerate development :

  • ctx.exec + 'TAB' :
ctx.exec(command, 60, function(obj) {
  ...
});

Parameters:

Name Type Description
command {string} command line
[timeout] {number} timeout delay in seconds (default is 60 s) (Optional)
[callback] {function(Object)} callback called with result object. (Optional)

Return:

Type Description
{Object} result object


execRun( command, [style], [bWaitResult] )

Summary:

Executes a shell command

Description:

This function can be used to execute treatments, waiting or not termination It is based on 'WScript.Shell.Run' method : https://msdn.microsoft.com/en-us/library/d33x48a9(v=vs.84).aspx for more details

var command = '...';
var res = ctx.execRun(command, 0, false);

Ex.:

// performs a network copy
var command = 'robocopy "z:\\..." "c:\..." /MIR';
var res = ctx.execRun(command, 0);

Parameters:

Name Type Description
command {string} command line
[style] {number} value indicating the appearance of the program's window. 0=hidden, 1=shown, … (Optional)
[bWaitResult] {boolean} if true, waits for the command to finish (false by default) (Optional)

Return:

Type Description
{number} result


execVBS( code )

Summary:

Executes a VBScript function

Description:

The function should be defined in a '.vbs' or '.vb' file included in the solution

Ex.:

  • Create a file containing VBS functions :

File utils.vbs :

Function myFunction(a, b)
  ...
  myFunction = ...
End Function
 
Function sendEmail(ToAddress, MessageSubject, MessageBody)
  ...
  sendEmail = ...
End Function

Note: You should define 'Function' functions only, not 'Sub' functions

  • Include the file in the project :
<SCRIPTS>
  <SCRIPT Name="Utils VBS" Src="utils.vbs" Type="vbscript" />
</SCRIPTS>
  • Call the functions from your JS code :
res = ctx.execVBS('sendEmail("support@sap.com", "test mail subject", "This is a test email !")');

Parameters:

Name Type Description
code {string} VBScript code

Return:

Type Description
{string} result value


formatFunction( args )

Summary:

returns a function call as a string, from a list of arguments

Description:

Ex.:

  var code = ctx.formatFunction(myFunction, "value", true, { a: 2, b: "b", c: false});
  // code =

Parameters:

Name Type Description
args {Array} list of arguments

Return:

Type Description
{string} result


get( target, [path], [pathType], [format] )

Summary:

Returns a value or set of values in the data object

Description:

Ex.:

var val = ScnApp.data.get("//Data_Popup1", e.data.pathType.XPath);

Parameters:

Name Type Description
target {Object} object to be read
[path] {string} path (Optional)
[pathType] {e.data.pathType} data path type (default is 'e.data.pathType.XPath')
(see e.data.pathType) (Optional)
[format] {e.data.format} data format type (see e.data.format) (Optional)

Return:

Type Description
{*} returned object or value


getByPath( path, [root] )

Summary:

returns an object from its reference path

Description:

Ex.:

var style = ctx.getByRef('e.item.style.Blue');

Parameters:

Name Type Description
path {string} object reference path
[root] {Object} root object (if omitted, the JScript engine root object is used) (Optional)

Return:

Type Description
{*} nested object


getActivePages( )

Summary:

Get the list of active pages for all applications

Description:

Ex.:

var pages = ctx.getActivePages();

Return:

Type Description
{Array<ctx.page>} active page array


getDate( [date], [separator] )

Summary:

Serializes a given date or current date to format “‎YYYY-MM-DD”: “‎2015-03-‎02‎”, …

Description:

Ex.:

var txt = ctx.getDate(); // result is : "‎2015-03-‎02‎"

Parameters:

Name Type Description
[date] {Date} date to be serialized (if omitted, current date is used) (Optional)
[separator] {string} separator (default is '-') (Optional)

Return:

Type Description
{string} str formatted string, or an empty string if invalid


getTime( [date], [separator], [noMs] )

Summary:

Serializes a given date or current date to format HH:MM:SS.mmm

Description:

Ex.:

var txt = ctx.getTime(); // result is : "17:16:48.299"

Parameters:

Name Type Description
[date] {Date} date to be serialized (if omitted, current date is used) (Optional)
[separator] {string} separator (default is ':') (Optional)
[noMs] {boolean} if true, no milliseconds in timestamp (Optional)

Return:

Type Description
{string} str formatted string, or an empty string if invalid


getRandom( min, max, [maxIncluded] )

Summary:

Returns a random number between min (included) and max (included if maxIncluded is true, otherwise excluded)

Description:

Ex.:

var random = ctx.getRandom(1, 10, true);

Parameters:

Name Type Description
min {number} minimum value
max {number} maximum value
[maxIncluded] {boolean} separator (default is ':') (Optional)

Return:

Type Description
{number} result


getTimestamp( [date], [isFilename], [separator], [noMs] )

Summary:

Serializes a given date or current date to an String (“YYYY-MM-DD.HH:MM:SS.MS”)

Description:

Ex.:

var txt = ctx.getTimestamp(); // result is : "2014-11-04.17:16:48.299"

Parameters:

Name Type Description
[date] {Date} date to be serialized (if omitted, current date is used) (Optional)
[isFilename] {boolean} filename usage : if 'true', invalid filename characters are modified (':' replaced by '.') (Optional)
[separator] {string} separator between date and time (default is '.') (Optional)
[noMs] {boolean} if true, no milliseconds in timestamp (Optional)

Return:

Type Description
{string} str formatted string, or an empty string if invalid


highlight( pos, [timer], [visible], [async], [color] )

Summary:

Highlights a given area during a given duration

Description:

Ex.:

var pos = { x:..., y:..., ...};
ctx.highlight(pos, 1000);

Parameters:

Name Type Description
pos {ctx.position} position object (see ctx.position)
[timer] {number} highlight duration and wait in ms (0 by default) (Optional)
[visible] {boolean} if false, the highlight is removed (true by default) (Optional)
[async] {boolean} if true, and a timer is set, the function is asynchronous (it returns immediately and highlight is removed asynchronously after timer) (true by default) (Optional)
[color] {number} default color ('ctx.options.highlightColor' by default) (Optional)

Return:

Type Description
{string} result value


keyStroke( value, [timer] )

Summary:

Sends a keyboard set of keys to the active page

Description:

Ex.:

ctx.keyStroke(e.key.Ctrl+e.key.Shift+'A');

Parameters:

Name Type Description
value {string} key sequence
[timer] {number} delay after key sequence (default is 100 ms) (Optional)

Return:

Type Description
{string} execution result


keyStrokeEx( value, [timer] )

Summary:

Sends a keyboard set of keys to the active page (extended version)

Description:

This is an extended version of keyStroke. Differences are:

a) Use method SendKeys from the ActiveX "WScript.Shell", instead of the Win32 API SendInput
b) less keys available (eg: the 'Windows' key, or the 'Contextual Menu' key)

Ex.:

ctx.keyStrokeEx(e.key.Ctrl+e.key.Shift+'A');

Parameters:

Name Type Description
value {string} key sequence
[timer] {number} delay after key sequence (default is 100 ms) (Optional)

Return:

Type Description
{string} execution result


log( mess, [type], [label], [options] )

Summary:

Generates a log message in debugger and trace file

Description:

Ex.:

ctx.log('function failed with error : ' + res, e.logIconType.Error);

Parameters:

Name Type Description
mess {*} message to be displayed (text or object)
[type] {e.logIconType} icon type (see 'e.logIconType' values).
Default value is e.logIconType.info. (Optional)
[label] {*} optional secondary message (text or object) (Optional)
[options] {Object} optional trace level (Optional)

Return:

Type Description
{string} result value


logEvent( message, [type] )

Summary:

Generates a log message in Windows Event Viewer.

Description:

Example:

ctx.logEvent( "Function failed with error: " + res, e.logEventType.Error );

Parameters:

Name Type Description
message {string} Message to be displayed
[type] {e.logEventType} Icon type (by default, e.logEventType.information). See e.logEventType (Optional)

Return:

Type Description
{string} Result value


messbox2Execute( action, [P1], [P2], [P3], [P4], [P5] )

Summary:

Executes an action on 'ctx.popup.messbox2'

Parameters:

Name Type Description
action {string} action name
[P1] {string, number} parameter 1 (Optional)
[P2] {string, number} parameter 2 (Optional)
[P3] {string, number} parameter 3 (Optional)
[P4] {string, number} parameter 4 (Optional)
[P5] {string, number} parameter 5 (Optional)

Return:

Type Description
{string} result value


off( obj )

Summary:

Resets a listening handler or a wait handler

Description:

Ex.:

var obj = LinkedIn.events.evWaitSubscription.on(function(ev) {...});  // sets event listening
...
ctx.off(obj);  // resets event listening


Ex.:

var obj = ctx.wait(function(ev) {...}, 1000);  // sets a 1000 ms wait
...
ctx.off(obj);  // resets event listening

Parameters:

Name Type Description
obj {Object} object provided by 'ctx.on()' or 'ctx.once()' for the corresponding handler

Return:

Type Description
{boolean} result true false


on( event, func, [immediateCondition], [context], [single], [delay], [noStepReset], [contextEvent] )

Summary:

Sets a permanent or single handler to listen to a given event

Description:

Note: : this method should not be directly used, in the general cas, rather use application/page/item method:

  • application : application.on({ event, function(ev) { … }});
  • page : application.page.on({ event: function(ev) { … }});
  • item : application.page.item.on({ event: function(ev) { … }});

Ex.:

// event provided as an event object
ctx.on(LinkedIn.events.START, function(ev) {...});
...
ctx.on(LinkedIn.pHome.events.LOAD, function(ev) {...}, LinkedIn.pHome.exist, this, true);

Parameters:

Name Type Description
event {ctx.event} event name, provided as an event object or a selector string
func {function(ctx.event)} callback to be called on event reception
[immediateCondition] {boolean, function()} if defined, function to be called immediately : if it returns a 'true' result, the 'func' callback is executed (Optional)
[context] {Object} context object to be called with the callback (Optional)
[single] {boolean} if 'true', sets a single listening on the event (otherwise, a permanent listening) (Optional)
[delay] {number} optional delay to wait before calling the callback (default is 0) (Optional)
[noStepReset] {boolean} if 'true', and handler is set in a step, it is not reset on step exit (Optional)
[contextEvent] {ctx.event} context event, provided as callback parameter (Optional)

Return:

Type Description
{Object} an object to be provided to 'ctx.off()' to disable listening


once( event, func, [immediateCondition], [context], [delay], [noStepReset] )

Summary:

Sets a single handler to listen to a given event

Description:

Ex.:

ctx.once(LinkedIn.addEvent({ evStart : ''}), function(ev) {...});  // sets event listening

Parameters:

Name Type Description
event {ctx.event} event name, provided as an event object or a selector string
func {function(ctx.event)} callback to be called on event reception
[immediateCondition] {boolean, function()} if defined, function to be called immediately : if it returns a 'true' result, the 'func' callback is executed (Optional)
[context] {Object} context object to be called with the callback (Optional)
[delay] {number} optional delay to wait before calling the callback (default is 0) (Optional)
[noStepReset] {boolean} if 'true', and handler is set in a step, it is not reset on step exit (Optional)

Return:

Type Description
{Object} an object to be provided to 'ctx.off()' to disable listening


polling( options )

Summary:

Function used to implement asynchronous polling loops

Description:

The 'ctx.pollingOptions' object is composed of the following parameters :

Attribute Description
delay delay (in ms) between each iteration (default: 100 ms)
nbMax max. number of loops to wait before calling 'fail' method (default: 1)
test test function called during each iteration (default: returns 'false')
- if it returns 'false', the loop carries on
- if it returns 'true', the 'done' function is called
done function called when 'test' function returned 'true' (default: empty)
fail function called at the end of the loop, if 'nbMax' iterations were reached (default: empty)

Ex.:

// waits for the appearance of an Ajax object in a page (during 6 * 500 ms)
ctx.polling({
  delay: 500,
  nbMax: 6,
  test: function() { return MyAppli.MyPage.btValidate.exist(); },
  done: function() {
   // object is present
  },
  fail: function() {
    // object is absent
  }
});

You can use 'snippets' to accelerate development :

  • ctx.polling + 'TAB' :
ctx.polling({
  delay: 100,
  nbMax: 10,
  test: function() {
    return false;
  },
  done: function() {
    // add code here
  },
  fail: function() { }
});

Parameters:

Name Type Description
options {ctx.pollingOptions} object describing the polling options (delay, max iteration count, …)

Return:

Type Description
{Object} an object to be provided to 'ctx.off()' to disable polling


setAutoRestart( enable )

Summary:

Reads a text from a file

Description:

Ex.:

ctx.setAutoRestart(true);

Parameters:

Name Type Description
enable {boolean} enables (true) or disables (false) auto restart


readFile( filename )

Summary:

Reads a text from a file

Description:

Ex.:

var txt = ctx.readFile('c:\\temp\\files.txt');

Parameters:

Name Type Description
filename {string} output filename

Return:

Type Description
{string} read text string (empty if file not found)


regHotKey( shortcut, event )

Summary:

Declares a global shortcut ('hot key') which triggers a functional event

Description:

The list of pre-defined keys for shortcut definition is defined in enumeration : e.key

Ex.:

// hot key 'Ctrl + F3' to trigger 'evStartTreatment' event
ctx.regHotKey(e.key.Ctrl + e.key.F3, GLOBAL.events.evStartTreatment);

Parameters:

Name Type Description
shortcut {string} shortcut definition
event {ctx.event} event name to be triggered

Return:

Type Description
{string} result value


resolvePath( path )

Summary:

Resolves a path, especially to replace patterns with run-time paths

Description:

Possible patterns :

  • %CurrentURL% : ctx.options.path.bin,
  • %CurrentDir% : ctx.options.path.log,
  • %ExecDir% : ctx.options.path.exec,
  • %ServerURL% : ctx.options.path.server

Ex.:

var path = ctx.resolvePath("%CurrentURL%\\html\\index.html");
// resolves 'path' with project local folder

Parameters:

Name Type Description
path {string} path to be resolved

Return:

Type Description
{string} resolved path


screenshot( [obj] )

Summary:

Makes a screenshot of an application window or screen area

Description:

Capture is saved in a '.png' file.

Different options are possible according to the object parameters :

  • {string} Appli, InstanceAppli, Page, InstancePage : used to specify page name and parent application
  • {string} Id : used to capture a ctx.popup (ctx.popup.messbox or ctx.popup.messbox2)
  • {string} HWND : used to capture a window based on its Window Handle (hWnd)
  • {string} File : filename . If omitted, name is generated on the format YYYYMMDD_HHMMSS_MS.png (ex.: 20150113_230806_416.png). File is generated in ctx.options.path.log + '\Pictures'
  • {string} X, Y, CX, CY : specify area position to be captured
  • {boolean} RawSnapshot : if 'true', makes 'raw snapshot', rather than 'print screen' mode.

Ex.:

// capture a declared page
ctx.screenshot({
  Appli: 'Google',
  InstanceAppli: 1002,
  Page: 'pGoogle'
});
// capture a ctx.popup.messbox or ctx.popup.messbox2, mention the target filename
ctx.screenshot({
  Id:'google',
  File: 'c:\\temp\\google.png'
});
// capture a page in raw mode
ctx.screenshot({
  Appli: 'Google',
  Id:'pVersion',
  RawSnapshot: true
});
// capture a fix area
ctx.screenshot({
  Id:'google',
  X:50,
  Y:30,
  CX:200,
  CY:100
});
// make a full screen capture
ctx.screenshot();

Parameters:

Name Type Description
[obj] {Object} parameters (Optional)

Return:

Type Description
{string} result value


serialize( data, [doEscape], [addPrefix], [space], [isShort] )

Summary:

Serializes an object to a JSON string

Description:

Ex.:

var txt = ctx.serialize( { name:'Ford', firstname:'John' }, false, false);
// result is : "{\"name\":\"Ford\",\"firstname\":\"John\"}"

Parameters:

Name Type Description
data {*} object, string, number to be serialized
[doEscape] {boolean} if 'true', escapes all control characters (“\b” → “\\b”, “\”“ → “\\\””, “\\” → “\\\\”, …) (Optional)
[addPrefix] {boolean} if 'true' and 'data' is an object, adds a prefix to automate unserialisation (Optional)
[space] {number, string} causes the resulting string to be pretty-printed (Optional)
[isShort] {boolean} if 'true', serialize using short description (default is 'true') (Optional)

Return:

Type Description
{string} formatted string


shellexec( file, [parm], [dir], [flag] )

Summary:

Launches an application

Description:

Ex.:

ctx.shellexec("%programfiles(x86)%\\Skype\\Phone\\Skype.exe", "/callto:echo123");

Parameters:

Name Type Description
file {string} command line to be executed. Standard system variables can be used ('%programfiles(x86)%', '%temp%', …)
[parm] {string} optional argument for the command line (Optional)
[dir] {string} working directory (Optional)
[flag] {string} display mode whan application is started : Show, Hide, Maximized, Minimized… Default value is e.launchFlag.Show.
See e.launchFlag enumeration for a complete list of flags (Optional)

Return:

Type Description
{string} result value


sleep( timer )

Summary:

Generates a synchronous wait with a given delay

Description:

Ex.:

ctx.sleep(500); // waits 500 ms

Parameters:

Name Type Description
timer {number} timer value in ms (default is 100 ms)

Return:

Type Description
{string} result value


tooltip( obj )

Parameters:

Name Type Description
obj {Object} tooltip object


tooltipInit( obj )

Parameters:

Name Type Description
obj {Object} tooltip object


unserialize( data, [isObject] )

Summary:

Unserialize an JSON string to an object

Description:

Ex.:

var obj = ctx.unserialize("{\"name\":\"Ford\",\"firstname\":\"John\"}");
// result is : { name:'Ford', firstname:'John' }

Parameters:

Name Type Description
data {string, Object} JSON string to be unserialized
[isObject] {boolean} if 'true', forces unserialization to an object (Optional)

Return:

Type Description
{*} string, or unserialized object


wait( callback, delay, [noStepReset] )

Summary:

Sets a timeout callback

Description:

Ex.:

// call function after a 5 s delay
var id = ctx.wait(function(ev) {
  // add code here...
}, 5000);

You can use 'snippets' to accelerate development :

  • ctx.wait + 'TAB' :
ctx.wait(function(ev) {
  ...
}, 0);

Parameters:

Name Type Description
callback {function(ctx.event)} callback to be called
delay {number} timer value in ms (default is 100 ms)
[noStepReset] {boolean} if 'true', and handler is set in a step, it is not reset on step exit (Optional)

Return:

Type Description
{Object} an object to be provided to 'ctx.off()' to disable wait


workflow( name, id )

Summary:

Sets a reference to a flowflow

Description:

Ex.:

ctx.workflow('scCreateContact', 'b876f81a-5471-4845-bccf-818f87e02e15');

Parameters:

Name Type Description
name {string} workflow name
id {string} reference


writeFile( filename, text, [bEnd], [bCR] )

Summary:

Writes a text to a file

Description:

Ex.:

ctx.writeFile('c:\\temp\\files.txt', result, true);

Parameters:

Name Type Description
filename {string} output filename
text {string} string to be written
[bEnd] {boolean} if true, write at the end of the file (Optional)
[bCR] {boolean} if true, adds a carriage return (Optional)

Return:

Type Description
{string} result value


decode( input, [isBinary] )

Summary:

Decodes a base 64 string to a buffer

Description:

// decode a base 64 string
var sContent = ctx.base64.decode(ev.data);

Parameters:

Name Type Description
input {string} base 64input string to be decoded
[isBinary] {boolean} if true, the input string is considered as raw, and is not encoded/decoded in UTF8 (Optional)

Return:

Type Description
{*} decoded string or object


decodeArrayBuffer( input )

Summary:

Decodes a base 64 string to a buffer array

Description:

 

Parameters:

Name Type Description
input {string} input string or byte array to be encoded in base 64

Return:

Type Description
{*} decoded array


decodeStream( input )

Summary:

Decodes a base 64 string to a binary stream

Description:

 

Parameters:

Name Type Description
input {string} base 64input string to be decoded

Return:

Type Description
{*} decoded binary stream


encode( input, [isBinary] )

Summary:

Encodes a string or binary array to a base 64 string

Description:

var txt = "馆驻 الممل Федера";
var txt64 = ctx.base64.encode(txt); // contains '6aaG6am7INin2YTZhdmF2YQg0KTQtdC00LXRgNCw'

Parameters:

Name Type Description
input {Object, string} input string or byte array to be encoded in base 64
[isBinary] {boolean} if true, the input string is considered as raw, and is not encoded/decoded in UTF8 (Optional)

Return:

Type Description
{string} encoded string


encodeArrayBuffer( input )

Summary:

Encodes a buffer array to a base 64 string

Description:

:!: Caution: this function can only be injected and executed in a Web page, it can't be directly used in a project script.

 

Parameters:

Name Type Description
input {ArrayBuffer} input string or byte array to be encoded in base 64

Return:

Type Description
{string} encoded string


encodeStream( input )

Summary:

Encodes a binary stream to a base 64 string

Description:

 

Parameters:

Name Type Description
input {Object} input binary stream to be encoded in base 64

Return:

Type Description
{string} encoded string


call( params )

Summary:

Creates and sends an Http Request to call a remote service or download a file

Description:

This function encapsulates HttpRequest management:

  • SOAP, REST GET/PUT/POST/DEL request types,
  • asynchronous answer analysis,
  • header / body formatting (form or json based),
  • optional user/login management,
  • …,

The syntax and approach are similar to jQuery ajax() Method.

The function is called with a 'ctx.ajaxParams' object :

method {e.ajax.method} type of request ('GET', 'PUT', 'POST', …). Default is 'GET'
url {string} URL to be called (mandatory)
data {Object|string} data to be sent (optional)
async {boolean} value indicating whether the request should be handled asynchronous or not. Default is true
contentType {e.ajax.content|string} data type to be sent : 'form', 'json', 'xml', 'html', … Default is 'json'
dataType {e.ajax.content} data type expected for the response : 'form', 'json', 'xml', 'html', … Default is 'html'
id {number} identifier (optional)
localFile {string} local file URL, only used when downloading a file
username {string} user name (optional)
password {string} password (optional)
timeout {number} local timeout (in milliseconds) for the request (optional)
headers {Array<Object>} set of headers definitions to be included in the request (optional). Format is:
header: [
{ type: e.ajax.header.cacheControl, value: e.ajax.cache.noCache },
{ type: …, value: … }
]
(see e.ajax.header and e.ajax.cache)
requestType {e.ajax.requestType} request type (client (Web browser JS engine) or server (Interactive JS engine)). Default is 'e.ajax.requestType.server' (optional)
responseType {e.ajax.responseType} data type of the response associated with the request. Default is (e.ajax.responseType.DOMString) (optional)
context {Object} “this” value for the callback functions (optional)
success {function(Object, string, Object)} callback called when the call is finished successfully. Format is: 'success(result, status, xhr)'. Mandatory to get a result
error {function(Object, string, string)} callback called in case of error (optional). Format is: 'error(xhr, status, error)'.


Ex. : Search in Salesforce proxy server all accounts in 'Technology' industry

var data = {
  filter: "Industry='Technology'",
  sort: '-Name'
}
ctx.ajax.call({
  method: e.ajax.method.get, // it is implicit
  url: 'https://salesforceproxy.com/accounts',
  data: data,
  contentType: e.ajax.content.form, // input data are added in URL: '...?...&...'
  success: function(res, status, xhr) {
    // res contains an array of accounts
    for (var i in res) {
      var account = res[i];
      //...
    }
  },
  error: function(xhr, status, statusText) {
    ctx.log(' ctx.ajax.call  error: ' + statusText);
  }
});

Parameters:

Name Type Description
params {ctx.ajaxParams} Request parameters

Return:

Type Description
{ctx.ajaxParams} Request parameters


download( source, destination, [params], [callback] )

Summary:

Downloads an http/https file to a local destination

Description:

Ex. : Search in Salesforce proxy server all accounts in 'Technology' industry

 

Parameters:

Name Type Description
source {string} source URL
destination {string} destination local file
[params] {ctx.ajaxParams, function(boolean)} optional options (see 'ctx.ajax.call' for possible values), or callback (Optional)
[callback] {function(string)} callback to be called (string parameter gives the local filename (empty if failed)) (Optional)

Return:

Type Description
{ctx.ajaxParams} Request parameters


get( )

Summary:

Gets clipboard textual content

Description:

Ex.:

var text = ctx.clipboard.get();

Return:

Type Description
{string} text clipboard content


set( value )

Summary:

Sets clipboard textual content

Description:

Ex.:

ctx.clipboard.set('Hello world');

Parameters:

Name Type Description
value {string} clipboard content

Return:

Type Description
{string} execution result


enableTrack( enable, [event] )

Summary:

Enables/disables the monitoring of the 'Windows clipboard'

Description:

Once enabled, an event is sent to the application or process each time the clipboard content is modified

Ex.:

// enable clipboard tracking
ctx.clipboard.enableTrack(true, 'evClipboard');

Parameters:

Name Type Description
enable {boolean} enables ('true') or disables ('false') clipboard monitoring
[event] {ctx.event} event sent to the application or process each time the clipboard content is modified ('evClipboard' if omitted) (Optional)

Return:

Type Description
{string} result value


addCtx( variable, model, iModele, [xPath] )

Summary:

Adds a context node

Parameters:

Name Type Description
variable {string} variable name (can contain a relative or absolute xPath)
model {string} XML string as a model
iModele {string} TBC
[xPath] {string} optional xPath ('*' if omitted) (Optional)

Return:

Type Description
{string} result value


delCtx( variable, [xPath] )

Summary:

Deletes a context node

Description:

Ex.:

var obj = ctx.context.delCtx('//GLOBAL/User');

Parameters:

Name Type Description
variable {string} variable name (can contain a relative or absolute xPath)
[xPath] {string} optional xPath ('*' if omitted) (Optional)

Return:

Type Description
{string} result value


exist( xPath )

Summary:

Tests if an XML node exists, in a context tree

Description:

Ex.:

if (ctx.context.exist('//PROCESS[Name="GLOBAL"]')) { ... }

Parameters:

Name Type Description
xPath {string} node xPath

Return:

Type Description
{boolean} result : 'true' if node exists


get( variable, [xPath] )

Summary:

Gets a context variable

Description:

Ex.:

ctx.options.path.bin = ctx.context.get('//WkMng_Info/CurrentURL');

Parameters:

Name Type Description
variable {string} variable name (can contain a relative or absolute xPath)
[xPath] {string} optional xPath ('*' if omitted) (Optional)

Return:

Type Description
{string} read value


getAppDesc( nature )

Summary:

Gets a context node as a node

Description:

Ex.:

var obj = ctx.context.getAppDesc(e.nature.WEB);

Parameters:

Name Type Description
nature {e.nature} application nature

Return:

Type Description
{string} result node


getCtx( variable, [xPath] )

Summary:

Gets a context node as a node

Description:

Ex.:

var obj = ctx.context.getCtx('//GLOBAL/Xc_MessBoxHtml');

Parameters:

Name Type Description
variable {string} variable name (can contain a relative or absolute xPath)
[xPath] {string} optional xPath ('*' if omitted) (Optional)

Return:

Type Description
{Object} result node


getNode( [xPath] )

Summary:

Gets a context node as an IXMLNode object

Description:

Ex.:

var obj = ctx.context.getNode('//GLOBAL/User');

Parameters:

Name Type Description
[xPath] {string} optional xPath ('*' if omitted) (Optional)

Return:

Type Description
{Node} XML node object


getProject( [xPath] )

Summary:

Gets a node as an IXMLNode object, from the project XML tree

Description:

Ex.:

var obj = ctx.context.getProject('//PROCESS[Name="GLOBAL"]');

Parameters:

Name Type Description
[xPath] {string} optional xPath ('*' if omitted) (Optional)

Return:

Type Description
{Node} XML node object


set( variable, value, [xPath] )

Summary:

Sets a context variable

Description:

Ex.:

ctx.context.set('//GLOBAL/Name', 'Ford');

Parameters:

Name Type Description
variable {string} variable name (can contain a relative or absolute xPath)
value {string} value to be set
[xPath] {string} optional xPath ('*' if omitted) (Optional)

Return:

Type Description
{string} result value


setCtx( variable, action, model, iModele, [xPath] )

Summary:

Sets a context node

Description:

Ex.:

var obj = ctx.context.setCtx('//GLOBAL/User', 'XML', '<User><Name></Name><Firstname></Firstname></User>');

Parameters:

Name Type Description
variable {string} variable name (can contain a relative or absolute xPath)
action {string} type of creation (TBC)
model {string} XML string as a model
iModele {string} TBC
[xPath] {string} optional xPath ('*' if omitted) (Optional)

Return:

Type Description
{string} result value


init( [obj] )

Parameters:

Name Type Description
[obj] {Object} (Optional)

Return:

Type Description
{ctx.cryptography.keyClass}


get( [callback] )

Parameters:

Name Type Description
[callback] {function(e.error, string, Object)} (Optional)

Return:

Type Description
{ctx.cryptography.keyClass}


set( function(e.error, )

Parameters:

Name Type Description
function(e.error, {} string, Object) } [callback]

Return:

Type Description
{ctx.cryptography.keyClass}


init( [obj] )

Parameters:

Name Type Description
[obj] {Object} (Optional)

Return:

Type Description
{ctx.cryptography.credentialClass}


get( function(e.error, )

Parameters:

Name Type Description
function(e.error, {} string, Object) } [callback]

Return:

Type Description
{ctx.cryptography.credentialClass}


remove( function(e.error, )

Parameters:

Name Type Description
function(e.error, {} string, Object) } [callback]

Return:

Type Description
{ctx.cryptography.credentialClass}


reset( )

Return:

Type Description
{ctx.cryptography.credentialClass}


set( function(e.error, )

Parameters:

Name Type Description
function(e.error, {} string, Object) } [callback]

Return:

Type Description
{ctx.cryptography.credentialClass}


get( )


set( userName )

Parameters:

Name Type Description
userName {string}


get( )


set( password )

Parameters:

Name Type Description
password {string}


searchKey( keyObjOrName, [criteria] )

Parameters:

Name Type Description
keyObjOrName {*}
[criteria] {Object} Search criteria (Optional)

Return:

Type Description
{ctx.cryptography.keyClass}


searchCredential( credentialObjOrName, [criteria] )

Parameters:

Name Type Description
credentialObjOrName {ctx.cryptography.credentialClass, string}
[criteria] {Object} search criteria (Optional)

Return:

Type Description
{ctx.cryptography.credentialClass}


initKey( keyObjOrName, [serverSide] )

Summary:

Initializes the key

Description:

Ex.:

var res = ctx.cryptography.initKey('CtxtKey1');

Parameters:

Name Type Description
keyObjOrName {ctx.cryptography.keyClass, string} key object or name
[serverSide] {boolean} false='client side', true='server side' (default is false) (Optional)

Return:

Type Description
{ctx.cryptography.keyClass} initialized key (null if invalid)


initKeys( [serverSide] )

Summary:

Initializes all declared keys

Description:

Ex.:

 

Parameters:

Name Type Description
[serverSide] {boolean} false='client side', true='server side' (default is false) (Optional)


generatePassword( [length] )

Summary:

Generates a random password

Description:

Ex.:

var passsword = ctx.cryptography.generatePassword(16 ); //

Parameters:

Name Type Description
[length] {number} password length (Optional)

Return:

Type Description
{string} result


createKeyContainer( keyObjOrName )

Summary:

Creates a key container with a private / public key pair

Description:

Ex.:

var res = ctx.cryptography.createKeyContainer(ctx.cryptography.keys.MyKey);

Parameters:

Name Type Description
keyObjOrName {string, ctx.cryptography.keyClass} key name or object

Return:

Type Description
{boolean} result


deleteKeyContainer( keyObjOrName )

Summary:

Deletes an existing key container

Description:

Ex.:

var res = ctx.cryptography.deleteKeyContainer( "CtxtKey1", e.cryptography.storeLocation.CurrentUser );

Parameters:

Name Type Description
keyObjOrName {string, ctx.cryptography.keyClass} Key name or object

Return:

Type Description
{boolean} Result


readRegPublicKey( keyObjOrName, prefix )

Parameters:

Name Type Description
keyObjOrName {string, ctx.cryptography.keyClass} key name or object
prefix {string}

Return:

Type Description
{ctx.cryptography.keyClass}


saveRegPublicKey( keyObjOrName, prefix )

Summary:

Saves the public key in registry

Parameters:

Name Type Description
keyObjOrName {string, ctx.cryptography.keyClass} key name or object
prefix {string}

Return:

Type Description
{ctx.cryptography.keyClass}


getPublicKey( keyObjOrName )

Summary:

Returns the public key from an existing key container

Description:

Ex.:

var res = ctx.cryptography.getPublicKey('CtxtKey1', e.cryptography.storeLocation.currentUser, e.cryptography.keyUsage.signature);

Parameters:

Name Type Description
keyObjOrName {string, ctx.cryptography.keyClass} key name or object

Return:

Type Description
{ctx.cryptography.keyClass} key object


getPublicKeys( [serverSide] )

Summary:

Get all public keys on server or client side

Description:

Ex.:

 

Parameters:

Name Type Description
[serverSide] {boolean} false='client side', true='server side' (default is false) (Optional)

Return:

Type Description
{Array<ctx.cryptography.keyClass>} key array with valid public keys


savePublicKey( keyObjOrName, [publicKey] )

Summary:

Stores a public key in a key container (without private key)

Description:

Ex.:

var publicKey = "...";
var res = ctx.cryptography.setPublicKey('CtxtKey1', publicKey, e.cryptography.storeLocation.CurrentUser);

Parameters:

Name Type Description
keyObjOrName {string, ctx.cryptography.keyClass} key name or object
[publicKey] {string} public key as a binary string (Optional)

Return:

Type Description
{string} result


decryptFileToFile( inputFile, outputFile, keyObjOrName, [password] )

Summary:

Decrypts a cyphered file to a clear file using a private key from a key container

Description:

Ex.:

var res = ctx.cryptography.decryptFileToFile(inputFile, outputFile, "", 'CtxtKey1', e.cryptography.storeLocation.LocalMachine);

Parameters:

Name Type Description
inputFile {string} input file
outputFile {string} output file
keyObjOrName {string, ctx.cryptography.keyClass} key name or object
[password] {string} optional password value used if cyphering is enabled (Optional)

Return:

Type Description
{string} result


decryptFileToString( inputFile, keyObjOrName, [password] )

Summary:

Decrypts a cyphered file to a clear string using a private key from a key container

Description:

Ex.:

var str = ctx.cryptography.decryptFileToString(inputFile, 'myPassword', 'CtxtKey1', e.cryptography.storeLocation.LocalMachine);

Parameters:

Name Type Description
inputFile {string} input file
keyObjOrName {string, ctx.cryptography.keyClass} key name or object
[password] {string} optional password value used if cyphering is enabled (Optional)

Return:

Type Description
{string} clear value


decryptMessage( input, keyObjOrName, [password] )

Summary:

Decrypts a message using a certificate or key container

Description:

Ex.:

var str = ctx.cryptography.decryptMessage(
  crypt,
  'My',
  'Ctxt exchange',
  '',
  e.cryptography.algorithm.PKCS_12,
  e.cryptography.storeLocation.LocalMachine);
});

Parameters:

Name Type Description
input {string} input value
keyObjOrName {string, ctx.cryptography.keyClass} key name or object
[password] {string} optional password value used to encrypt (only usable for a container key, not with a certificate) (Optional)

Return:

Type Description
{string} decrypted value (null if failed)


encryptFileToFile( inputFile, outputFile, keyObjOrName, [password] )

Summary:

Encrypts a clear file to a cyphered file using a public key from a key container

Description:

Ex.:

var res = ctx.cryptography.encryptFileToFile(inputFile, outputFile, "", 'CtxtKey1', e.cryptography.storeLocation.LocalMachine);

Parameters:

Name Type Description
inputFile {string} input file
outputFile {string} output file
keyObjOrName {string, ctx.cryptography.keyClass} key name or object
[password] {string} optional password value used if cyphering is enabled (Optional)

Return:

Type Description
{string} result


encryptMessage( input, keyObjOrName, [password] )

Summary:

Encrypts a message using a certificate or key container

Description:

Ex.:

var str = "......";
var crypt = ctx.cryptography.encryptMessage(
  str,
  'My',
  'Ctxt exchange',
  '',
  e.cryptography.algorithm.PKCS_12,
  e.cryptography.storeLocation.LocalMachine);
});

Parameters:

Name Type Description
input {string} input value
keyObjOrName {string, ctx.cryptography.keyClass} key name or object
[password] {string} optional password value used to encrypt (only usable for a container key, not with a certificate) (Optional)

Return:

Type Description
{string} encrypted value (null if failed)


encryptStringToFile( input, outputFile, keyObjOrName, [password] )

Summary:

Encrypts a clear string to a cyphered file using a public key

Description:

Ex.:

var str = "......";
var res = ctx.cryptography.encryptStringToFile(str, outputFile, 'myPassword', 'CtxtKey1', e.cryptography.storeLocation.LocalMachine);

Parameters:

Name Type Description
input {string} input file
outputFile {string} output file
keyObjOrName {string, ctx.cryptography.keyClass} key name or object
[password] {string} optional password value used if cyphering is enabled (Optional)

Return:

Type Description
{string} result


protect( input, [password] )

Summary:

Encrypts a value using a key local to the user session

Description:

Ex.:

var cyphered = ctx.cryptography.protect(obj.login, password);

Parameters:

Name Type Description
input {string} clear input value
[password] {string} optional password value used to encrypt (Optional)

Return:

Type Description
{string} cyphered value


signEncryptMessage( input, keyObjOrName )

Summary:

Signs and encrypts a message using a certificate or key container

Description:

Ex.:

var str = "......";
var crypt = ctx.cryptography.signEncryptMessage(
  str,
  'My',
  'Ctxt exchange',
  '',
  e.cryptography.algorithm.PKCS_12,
  e.cryptography.storeLocation.LocalMachine);
});

Parameters:

Name Type Description
input {string} input value
keyObjOrName {string, ctx.cryptography.keyClass} key name or object

Return:

Type Description
{string} signed value (null if failed)


signMessage( input, keyObjOrName )

Summary:

Signs a message using a certificate or key container

Description:

Ex.:

var str = "......";
var crypt = ctx.cryptography.signMessage(
  str,
  'My',
  'Ctxt exchange',
  '',
  e.cryptography.algorithm.PKCS_12,
  e.cryptography.storeLocation.LocalMachine);
});

Parameters:

Name Type Description
input {string} input value
keyObjOrName {string, ctx.cryptography.keyClass} key name or object

Return:

Type Description
{string} signed value (null if failed)


unprotect( input, [password] )

Summary:

Decrypts a value using a key local to the user session

Description:

Ex.:

// read cyphered entry
obj.login = ctx.cryptography.unprotect(cyphered, password);

Parameters:

Name Type Description
input {string} cyphered input value
[password] {string} optional password value used to decrypt (Optional)

Return:

Type Description
{string} clear value


verifyDecryptMessage( input, keyObjOrName )

Summary:

Verifies and decrypts a signed message using a certificate or key container

Description:

Ex.:

var str = ctx.cryptography.verifyDecryptMessage(
  crypt,
  'My',
  'Ctxt exchange',
  '',
  e.cryptography.algorithm.PKCS_12,
  e.cryptography.storeLocation.LocalMachine);
});

Parameters:

Name Type Description
input {string} input value
keyObjOrName {string, ctx.cryptography.keyClass} key name or object

Return:

Type Description
{string} clear value (null if failed)


verifyMessage( input, signature, keyObjOrName )

Summary:

Verifies a signed message using a certificate or key container

Description:

Ex.:

var str = ctx.cryptography.verifyMessage(
  crypt,
  'My',
  'Ctxt exchange',
  '',
  e.cryptography.algorithm.PKCS_12,
  e.cryptography.storeLocation.LocalMachine);
});

Parameters:

Name Type Description
input {string} input value
signature {string} signature
keyObjOrName {string, ctx.cryptography.keyClass} key name or object

Return:

Type Description
{boolean} verification result (false if verification failed)


get( id, [lang] )

Summary:

Gets a label from its identifier

Description:

Ex.:

var txt = GLOBAL.labels.get('mainTitle', e.language.English);

Parameters:

Name Type Description
id {string} label identifier
[lang] {string} language (default language if omitted) (Optional)

Return:

Type Description
{string} label


set( obj )

Summary:

Sets a set of labels

Description:

Ex.:

// manage mono-language
GLOBAL.labels.buttons.set( { ok:'OK', cancel:'Cancel', close:'Close' });
// manage multi-languages
GLOBAL.labels.buttons.set( { ok: {en:'OK', fr:'OK'}, cancel: {en:'Cancel', fr:'Annuler'}, close: {en:'Close', fr:'Fermer' } } );

Parameters:

Name Type Description
obj {Object} object


addLanguage( obj )

Summary:

Adds supplementary languages in the label container

Description:

Ex.:

GLOBAL.labels.addLanguage({English: 'en', French: 'fr'}); // adds 'English' and 'French' languages

Parameters:

Name Type Description
obj {Object} language abbreviation and name, ex.: {English: 'en', French: 'fr'}


getLabels( )

Summary:

Gets label list

Description:

Ex.:

var list = GLOBAL.labels.getLabels();
// returns { 'en': 'English', 'fr': 'Français', ... };

Return:

Type Description
{Object} label list


setLanguage( lang )

Summary:

Sets the current language

Description:

Ex.:

GLOBAL.labels.setLanguage(e.language.English); // selects english as current language

Parameters:

Name Type Description
lang {string} language


getLanguage( )

Summary:

Gets the current language

Description:

Ex.:

var lang = GLOBAL.labels.getLanguage(); // lang = 'en'

Return:

Type Description
{string} current language


click( X, [Y], [doubleClick] )

Summary:

Triggers a mouse left click at a given position

Description:

Ex.:

// double click on item1
var pos = myAppli.pMyPage.item1.getRect();
ctx.mouse.click(pos, 0, true);

Parameters:

Name Type Description
X {ctx.position, number} position object or relative horizontal position (compared to desktop top left position)
[Y] {number} relative vertical position (compared to desktop top left position). If 'X' is a 'ctx.position' object, this parameter is ignored (Optional)
[doubleClick] {boolean} triggers a double click if this parameter is set (Optional)


clickMiddle( X, [Y], [doubleClick] )

Summary:

Triggers a mouse middle click at a given position

Description:

Ex.:

// middle click on item1
var pos = myAppli.pMyPage.item1.getRect();
ctx.mouse.click(pos, 0, true);

Parameters:

Name Type Description
X {ctx.position, number} position object or relative horizontal position (compared to desktop top left position)
[Y] {number} relative vertical position (compared to desktop top left position). If 'X' is a 'ctx.position' object, this parameter is ignored (Optional)
[doubleClick] {boolean} triggers a double click if this parameter is set (Optional)


clickRight( X, [Y], [doubleClick] )

Summary:

Triggers a mouse right click at a given position

Description:

Ex.:

// right click on item1
var pos = myAppli.pMyPage.item1.getRect();
ctx.mouse.clickRight(pos);

Parameters:

Name Type Description
X {ctx.position, number} position object or relative horizontal position (compared to desktop top left position)
[Y] {number} relative vertical position (compared to desktop top left position). If 'X' is a 'ctx.position' object, this parameter is ignored (Optional)
[doubleClick] {boolean} triggers a double click if this parameter is set (Optional)


clickXButton1( )

Summary:

Triggers a click on XButton1

Description:

Ex.:

ctx.mouse.clickXButton1();


clickXButton2( )

Summary:

Triggers a click on XButton1

Description:

Ex.:

ctx.mouse.clickXButton2();


dragAndDrop( X, X2, [Y], [Y2] )

Summary:

Triggers a drag&drop between two positions

Description:

Ex.:

var pos = myAppli.pMyPage.item1.getRect(); // source
var pos2 = myAppli.pMyPage.item2.getRect(); // destination
ctx.mouse.dragAndDrop(pos, pos2);

Parameters:

Name Type Description
X {ctx.position, number} position object or relative horizontal position (compared to desktop top left position) for the source
X2 {ctx.position, number} position object or relative horizontal position (compared to desktop top left position) for the target
[Y] {number} relative vertical position (compared to desktop top left position). If 'X' is a 'ctx.position' object, this parameter is ignored (Optional)
[Y2] {number} relative vertical position (compared to desktop top left position). If 'X' is a 'ctx.position' object, this parameter is ignored (Optional)


dragAndDropRight( X, X2, [Y], [Y2] )

Summary:

Triggers a right drag&drop between two positions

Description:

Ex.:

var pos = myAppli.pMyPage.item1.getRect(); // source
var pos2 = myAppli.pMyPage.item2.getRect(); // destination
ctx.mouse.dragAndDrop(pos, pos2);

Parameters:

Name Type Description
X {ctx.position, number} position object or relative horizontal position (compared to desktop top left position) for the source
X2 {ctx.position, number} position object or relative horizontal position (compared to desktop top left position) for the target
[Y] {number} relative vertical position (compared to desktop top left position). If 'X' is a 'ctx.position' object, this parameter is ignored (Optional)
[Y2] {number} relative vertical position (compared to desktop top left position). If 'X' is a 'ctx.position' object, this parameter is ignored (Optional)


move( X, [Y] )

Summary:

Triggers a mouse move to a given position

Description:

Ex.:

var pos = myAppli.pMyPage.item1.getRect(); // source
ctx.mouse.move(pos);

Parameters:

Name Type Description
X {ctx.position, number} position object or relative horizontal position (compared to desktop top left position)
[Y] {number} relative vertical position (compared to desktop top left position). If 'X' is a 'ctx.position' object, this parameter is ignored (Optional)


scrollWheel( offset )

Summary:

Triggers a wheel scroll with a given offset

Description:

Ex.:

ctx.mouse.scrollWheel(-200);

Parameters:

Name Type Description
offset {number} wheel scroll offset (can be positive or negative)


del( key, [root] )

Summary:

Deletes a registry value or key

Description:

For more details about the function, see RegDelete Method

Remarks:

  • Specify a key-name by ending 'key' with a final backslash.
  • Do not include a final backslash to specify a value name.

Ex.:

// delete value and key
ctx.registry.del("HKCU\\Software\\ACME\\FortuneTeller\\MindReader"); // delete the value 'MindReader'
ctx.registry.del("HKCU\\Software\\ACME\\FortuneTeller\\"); // delete the key 'FortuneTeller'
// other syntax
ctx.registry.del("Software\\ACME\\FortuneTeller\\MindReader", e.registry.root.CurrentUser); // delete the value 'MindReader'
ctx.registry.del("Software\\ACME\\FortuneTeller\\", e.registry.root.CurrentUser); // delete the key 'FortuneTeller'

Parameters:

Name Type Description
key {string} Registry key to be deleted
[root] {e.registry.root} selects the Registry Root key (see e.registry.root), if it's not mentioned in the key name. Default is 'Current User' (Optional)


get( key, [root] )

Summary:

Reads a registry entry

Description:

For more details about the function, see RegRead Method

Remarks:

  • Specify a key-name by ending 'key' with a final backslash.
  • Do not include a final backslash to specify a value name.
  • When you specify a key-name (as opposed to a value-name), the method returns the default value.

Ex.:

// read entry
data.IEVersion = ctx.registry.get("HKLM\\SOFTWARE\\Microsoft\\Internet Explorer\\Version");
// other syntax
data.IEVersion = ctx.registry.get("SOFTWARE\\Microsoft\\Internet Explorer\\Version", e.registry.root.LocalMachine);

Parameters:

Name Type Description
key {string} Registry key to be set
[root] {e.registry.root} selects the Registry Root key (see e.registry.root), if it's not mentioned in the key name. Default is 'Current User' (Optional)

Return:

Type Description
{*} read value (undefined if not found)


getMultiString( key, [root] )

Summary:

Reads a registry multi string entry

Description:

For more details about the function, see RegRead Method

Remarks:

  • Specify a key-name by ending 'key' with a final backslash.
  • Do not include a final backslash to specify a value name.
  • When you specify a key-name (as opposed to a value-name), the method returns the default value.

Ex.:

// read entry
data.IEVersion = ctx.registry.get("HKLM\\SOFTWARE\\Microsoft\\Internet Explorer\\Version");
// other syntax
data.IEVersion = ctx.registry.get("SOFTWARE\\Microsoft\\Internet Explorer\\Version", e.registry.root.LocalMachine);

Parameters:

Name Type Description
key {string} Registry key to be set
[root] {e.registry.root} selects the Registry Root key (see e.registry.root), if it's not mentioned in the key name. Default is 'Current User' (Optional)

Return:

Type Description
{*} read value (undefined if not found)


getRoot( [section], [key] )

Summary:

Returns the standard registry root used to store user settings (located in “HKCU\\Software\\SAP\\Intelligent RPA\\CtxtRun\\Settings\\”)

Description:

Ex.:

var entry = ctx.registry.getRoot("SSO");
// entry = "HKCU\\Software\\SAP\\Intelligent RPA\\CtxtRun\\Settings\\SSO\\"

Parameters:

Name Type Description
[section] {string} Optional sub section (Optional)
[key] {string} Optional key name (Optional)

Return:

Type Description
{string} read value


set( key, value, [root], [type] )

Summary:

Writes a key or value in registry

Description:

Creates a new key, adds another value-name to an existing key (and assigns it a value), or changes the value of an existing value-name.

For more details about the function, see RegWrite Method

Remarks:

  • Specify a key-name by ending 'key' with a final backslash.
  • Do not include a final backslash to specify a value name.

Ex.:

ctx.registry.set(root + "\\Login", obj.login, e.registry.root.CurrentUser, e.registry.type.String);

Parameters:

Name Type Description
key {string} Registry key to be set
value {*} value to be set
[root] {e.registry.root} selects the Registry Root key (see e.registry.root), if it's not mentioned in the key name. Default is 'Current User' (Optional)
[type] {e.registry.type} selects the value type (see e.registry.type). Default is 'string' (Optional)


get( function(e.error, )

Parameters:

Name Type Description
function(e.error, {} string, Object) } [callback]


reset( )

Return:

Type Description
{ctx.settingClass}


set( function(e.error, )

Parameters:

Name Type Description
function(e.error, {} string, Object) } [callback]