Scripting

Scripting

Scripting 

Advanced GUI Automation

Description

Advance GUI Automation step is used to write a script for Desktop GUI automation workflow. Sometimes desktop control with accessor locators doesn’t react well as is unable to perform the action. At such times this step can be very useful to perform desktop element actions. 

Advance GUI Automation automatically gets the desktop handle once it is placed after Desktop Start step in a workflow.   

Configurations

No

Field Name

Description

1

Enable Web Capability

Enable checkbox 


You can select any one Web Browser Name from the given list. 



Left Pane:


2

Get Input Fields

By clicking on this it will give a list of all input fields that can be used as a part of GUI Automation Script.


Code Snippets: Common Use


3

Sample Code

Double click Sample Code to populate quick start sample code in the GUI Automation Script right hand pane. Here you will find an example to make fields available to next step.


Partial pseudo code for making multiple fields available to next step,

  var FieldName = "FieldName";

  var FieldValue = "FieldValue";

  

  var FieldName2 = "FieldName2";

  var FieldValue2 = "FieldValue2";

  

  return "<<>>"+FieldName+"::"+FieldValue+"<<>>;<<>>"+FieldName2+"::"+FieldValue2+"<<>>"; 


Implement Try-Catch

Quick start sample for try-catch code.


Code Snippets: Action APIs



Mouse Events: _xy

Sample code to perform position based actions.


Mouse Events: _click

Sample code to perform click action.


Write to Console:



Write Value to Console

This option allows you to create output fields from a Script which can be used in subsequent steps.





Right Pane:


4

GUI Automation Script

Write the Script in the space provided.


Following, is a sample Script showing how to set value and click a button.

In this case the code sets values of username and password and clicks a login button.


  1. Windows Automation


_setMode("WINDOWS");

_selectWindow("Sample Application");

_setValue(_textbox("username"),”AutomationEdge”);

_setValue(_passwprd("password"),”AutomationEdge”);

_click(_button("/Login/"))


  1. Browser Automation


_setMode("BROWSER");

var $id=_launchNewBrowser("https://www.google.com/");

_wait(5000);

_selectBrowser($id)

_highlight(_div(0));



Execute Autoit Script

Description

Execute Autoit Script is a step in the Scripting Plugin for Process Studio WorkflowsAutoit script can be executed in this step.

Configurations

No.

Field Name

Description

1

Step name

Specify the name of the step as it appears in the workflow workspace. This name has to be unique in a single workflow.


Left Navigator:


1

Get Input Fields

Shows the fields from input stream

2

Write to Console: Write Value to Console

Writes output values to console


Right Hand Side:


1

Autoit Script Tab

A workspace area to write the Autoit Script.

Execute Powershell Script

Description

Execute Powershell Script is a step in the Scripting Plugin for Process Studio WorkflowsThis step is used to execute PowerShell Script. This step can be used to leverage the Python programming language (and its extensive package-based support for scientific computing) 


Configurations

No.

Field Name

Description

1

Step name

Name of the step as it appears in the workflow workspace. This name has to be unique in a single workflow.


Left Navigator:


1

Get Input Fields

Shows the fields from input stream

2

Write to Console: Write Value to Console

Writes output values to console


Right Hand Side:


1

Powershell Script Tab

It has a workspace area to write Powershell Script.


Execute Python Script

Description

Execute Python Script is a step in the Scripting Plugin for Process Studio WorkflowsThis step is used to execute Python Script.

Prerequisites:

  1. Install Anaconda, Minimum version 4.2.0
  2. No need for separate python installation, Anaconda takes care of python installation.
  3. Anaconda should be in the PATH. 

  1. This can be conveniently achieved by enabling “Anaconda in PATH” checkbox during Anaconda installation else,
  2. Manually set Anaconda in the PATH environment variable by adding the following to the path
  3. <ANACONDA_BASE>; <ANACONDA_BASE>\Library\mingw-w64\bin; <ANACONDA_BASE>\Library\usr\bin; <ANACONDA_BASE>\Library\bin; <ANACONDA_BASE>\Scripts;


Configurations

Configure Tab: 

No.

Field Name

Description

1

Step name

Specify the name of the step as it appears in the workflow workspace. This name has to be unique in a single workflow.


Row Handling:


2

No. of rows to process

Select No. of rows to process for row handling from input steps data frames from the following,

  1. All
  2. Row by Row or
  3. Batch: If batch is selected a value needs to be provided in the size field.

3

Reservoir Sampling

Enable checkbox to randomly sample rows from an incoming data stream. If checkbox is enabled a value needs to be provided in the size field. Random seed field is also enabled and user can provide a value.

4

Random seed

Random seed is enabled only if Reservoir checkbox is enabled.

Provide a value to use for seeding the random number generator. Repeating a workflow with a different value for the seed will result in a different random sample being chosen.


Options:


5

Include Input Fields as Output Fields checkbox

Enable this checkbox to include incoming fields as output fields.


Input Frames:


6

Step name

Input step name are visible here in a dropdown list. Data from input steps is available as a Data frame.

7

Pandas frame name

Provide Pandas frame name for step name above. Or else use system generated name (for e.g. ps_data0)


Python Script: 

Field Name

Description

Load Script from file at Runtime

Enable checkbox to load python script dynamically from a file at runtime.

Script file Location and Browse button

Browse for the python script file.

Manual Python Script

It is a free textbox where user can write Python Script.

Python Variables to get

Provide output variable name or frame name from the python script. 

Continue on unset variables

Enable checkbox to specify: Don’t raise an error if specified variables are not set in python after script has executed.


Output Fields: 

No.

Field Name

Description

1

Output Fields:


1

Name

Get the name of python output fields.

2

Type

Provide the data type of the field above.


Buttons:


1

Vars to Fields

Click button to get Python frame.

2

Get Frame Fields

Click button to the Frame fields.

3

Include frame row index as an output field checkbox

Enable checkbox to Include frame row index as an output field.



Execute SQL script

Description

Execute SQL script is a step in the Scripting Plugin for Process Studio Workflows. You can execute SQL scripts with this step, either once, during the initialization phase of the workflow, or once for every input-row to the step. 

However, because of the scripting/dynamic nature of the step, it does not use prepared statements and thus is not intended to work fast or optimal. For good performance turn to dedicated steps like Table Output (insert into), Table Input (Select), Update, Delete, etc.



Configurations

No.

Field Name

Description

1

Step name

Specify the name of the step; This name has to be unique in a single workflow

2

Connection

Select a database connection to use

3

SQL script to execute

Specify the SQL to execute. Separate statements by; and use question marks as place holders for parameter. 
Note: This step does not use prepared statements by default; therefore the given parameters have to be enclosed correctly. Numeric values do not need to be enclosed, but all others e.g. Strings need to be enclosed with quotes or double quotes depending on the database dialect. 

4

Execute for each row?

Enable checkbox to execute the SQL for each incoming row. In this case parameters can be used. When this option is unchecked, the SQL statement is executed at the step initialization phase.

6

Execute as a single statement

This option does not split the statements by; and will send the whole SQL to the database.

7

Variable substitution

In case you want to use variables in the SQL, e.g. ${table_name}, this option needs to be checked.

8

Bind parameters?

Check this option to bind parameters using prepared statements, otherwise this step will perform a literal string replacement of the parameters. 

9

Quote Strings?

This option adds quotes around the string according to the database dialect and also escapes special characters like CR, LF and the quote character itself. 

10

Parameters

The list of used parameters that will replace the question marks in the query in the given order. So the first question mark will be replaced by the first parameter, the second question mark by the second parameter etc. 
Note: If you need the same parameter multiple times in your query, you need to use multiple question marks. Using a "Select Values" step you can duplicate field values within the "Select & Alter" tab by selecting the value once and renaming it a second or third time.

11

Field to contain insert stats (Optional)

Specify a field name to hold the number or records that where inserted. 

12

Field to contain update stats

Specify a field name to hold the number or records that where updated.  

13

Same as insert stats, but for deleted rows.

Specify a field name to hold the number or records that where deleted. 

14

Same as insert stats, but for read rows.

Specify a field name to hold the number or records that where read.


Execute VB Script

Description

Execute VB Script is a step in the Scripting Plugin for Process Studio Workflows

Execute VB Script Step allows you to execute any VB Script. One can write the script to the space given right and side Under VB Script Tab.

 


Configurations

No.

Field Name

Description

1

Step name

Specify the name of the step; This name has to be unique in a single workflow


Left Panel:


1

Get Input Fields

By clicking on this it will give a list of all input fields that can be used as a part of VB Script.

2

Write to Console:

Under this option there are two sub options:


  1. Create StdOut Object

This option allows you to create one new stdout object for VB Script. To use this option, users must have wscript.exe on their respective machines and the path of wscript.exe must be stored in Path Variable.


  1. Write Value to Console

This option allows you to create output fields from VB Script which can be used in subsequent steps.


Right Panel:


1

VB Script

Write the VB Script in the space provided.


Execute row SQL script

Description

Execute row SQL script is a step in the Scripting Plugin for Process Studio WorkflowsExecute SQL script for every input-row to this step (not). An input field can be used to specify the SQL to execute or it can specify a file that contains the SQL to execute.  This step is similar to Execute SQL script but does not have the option to execute SQL during the initialization phase of the workflow.


Configurations

Select & Alter Tab: 

No.

Field Name

Description

1

Step name

Specify the name of the step as it appears in the workflow workspace. This name has to be unique in a single workflow.

2

Connection

Select a database connection to use

3

Commit

Specify the number of rows to send before doing a database commit

4

SQL field name

The field that either contains the SQL to execute or optionally specifies the path to a file that contains SQL to execute

5

Read SQL from file

If checked, then the SQL field name option specifies a file that contains SQL to execute, otherwise the SQL field name option specifies the actual SQL to execute.

6

Field to contain insert stats(optional)

Specify a field name to hold the number or records that where inserted. 

7

Field to contain update stats

Specify a field name to hold the number or records that where updated.  

8

Field to contain delete stats

Specify a field name to hold the number or records that where deleted. 

9

Field to contain read stats

Specify a field name to hold the number or records that where read.




Formula

Description

Formula is a step in the Scripting Plugin for Process Studio Workflows. The Formula step can calculate Formula Expressions within a data stream. It can be used to create simple calculations like [A]+[B] or more complex business logic with a lot of nested if / then logic.

When you press on the Formula cell entry, the formula editor window opens and gives you help on the available functions: The formula editor window does a direct check on the syntax and the field names supplied. In case of an error you get the error message for the instance.


Configurations

No.

Field Name

Description

1

Step name

Name of the step as it appears in the workflow workspace. This name has to be unique in a single workflow.


Fields:


1

New Field

Specify a new field in the data stream. If you want to overwrite an existing field, you need to define the field here and in the "Replace value" option.

2

Formula 

Build the Formula using the editor and a tree of available functions.

3

Value Type 

Specify data type for the field.

4

Length

Specify the length,

  1. For Number: Total number of significant figures in a number; 
  2. For String: total length of string; 
  3. For Date: length of printed output of the string.

5

Precision

Specify the precision,

  1. For Number: Number of floating point digits; 
  2. For String, Date, Boolean: unused.

6

Replace value

Select a field from the drop down list when you want to replace a field.




Modified Java Script

Description

Modified Java Script is a step in the Scripting Plugin for Process Studio WorkflowsIt is an easy, expression based user interface for building JavaScript expressions. This step also allows you to create multiple scripts for each step. 

Please keep in mind that this step has performance disadvantages due to the fact that it is interpreting the JavaScript. Please see the other steps in the 'Scripting' section when performance is critical for you.

Configurations

Java Script Functions Section

This section provides a tree view of your available scripts, functions, input fields and output fields.

No.

Tree View

Description

1

Transform Scripts

It displays a list of scripts you have created in this step

2

Transform Constants

a list of pre-defined, static constants including SKIP_WORKFLOW, ERROR_ WORKFLOW, and CONTINUE_ WORKFLOW

3

Transform Functions*

It contains a variety of String, Numeric, Date, Logic and specialized functions you can use to create your script. To add a function to your script, simply double-click on the function or drag it to the location in your script that you wish to insert it.

4

Input Fields

A list of inputs coming into the step. Double-click or use drag and drop to insert the field into your script.

5

Output Fields

A list of outputs for the step.



Java Script Section

This section is where you edit the script for this step. You can insert functions, constants, input fields, etc. from the tree control on the left by double-clicking on the node you wish to insert or by dragging the object onto the Java Script panel.


There are two versions of the javascript engine: the 2.5 version and the 3 version. If "compatibility mode" is checked (and by default it is), javascript works like it did in version 2.5. Obviously the new version should be used if possible so uncheck "compatibility mode" if you can.


Fields Section

The Fields table contains a list of variables from your script including the ability to add metadata like a descriptive name.

No.

Column

Description

1

Field Name

Variable Name

2

Rename to

Rename 

3

Type

String, Date, Boolean, Integer, BigNumber, Binary, Timestamp, Internet Address

4

Length

Specify the length,

  1. For Number: Total number of significant figures in a number; 
  2. For String: total length of string; 
For Date: length of printed output of the string.

5

Precision

No. of digits after decimal.

Specify the precision,

  1. For Number: Number of floating point digits; 

For String, Date, Boolean: unused.

6

Replace value ‘Fieldname’ or Rename to’

Select Y/N to accept ‘Rename to’.


Buttons

1

Get Variables button

Retrieves a list of variables from your script.

2

Test script button

Use this button to test the syntax of your script.


*Transform Functions:  Transform functions are broadly classified as below,

No.

Function

Description

1

String Functions

This has several JavaScript String functions.

2

Numeric Functions

This has several JavaScript Numeric functions.

3

Date Functions

This has several JavaScript Date functions.

4

Logic Functions

This has several JavaScript Logic functions.

5

Special Functions

This has several Contains a mix of utility functions.

6

File Functions

This Category has several, functions that do simple verifications or actions related to files and folders—for example, fileExist() or createFolder().




Regex Evaluation

Description

Regex Evaluation is a step in the Scripting Plugin for Process Studio WorkflowsThis step matches the String value of an input field against a text pattern defined by a regular expression. Optionally, you can use the regular expression step to extract particular substrings from the input text field matching a portion of the text pattern into new output fields. This is known as "capturing".  

Configurations

Settings Tab: 

No.

Field Name

Description

1

Step name

Specify the name of the step as it appears in the workflow workspace. This name has to be unique in a single workflow.

2

Field to evaluate

Specify the name of the field from the incoming stream which is to be matched against the regular expression

3

Result Fieldname

Specify the name of the result output field (boolean). This field will be added to the output stream and indicate whether the value of the input field matched the regular expression (Y/N). 

4

Create fields for capture groups 

Enable this if you want to create new fields based on capture groups in the regular expression. Capturing groups are those parts of the regular expression pattern which are enclosed in a pair of left and right parenthesis. If this option is enabled, substrings of the input field value corresponding to the capturing groups in the regular expression will be extracted and stored in new output fields. If this option is enabled, the "Capture group fields" grid needs to define one field for each capturing group. 

5

Replace previous fields

This option is available in case the "Create fields for capture groups" option is enabled. When the "Replace previous fields" option is checked, fields created for capturing groups will replace existing fields in the incoming stream with the same name. If not enabled, new fields will be added to the output stream for each capturing group field.

6

Regular expression

Put here the regular expression to match. See the java.util.regex.Pattern javadoc for reference documentation of the particular regular expression syntax used by this step.

7

Use variable substitution

Enable this if your regular expression contains variable references. By enabling this, variable references will be expanded to their value before evaluating the regular expression pattern.

8

Capture group fields 

Here you can specify the new fields for any substrings captured by the regular expression from the input string. If the "Create fields for capture groups" option is enabled, you need to use this grid to enter a field definition corresponding to each capturing group in the regular expression. The order of the fields is the same as the order of the capturing groups in the regular expression. The columns in the grid allow you to change to the required data type right away. 


Content Tab: 

No.

Field Name

Description

1

Ignore differences in Unicode encodings

Enable checkbox to ignore differences.

Note: This may improve performance, but be sure your data only contains US ASCII characters.

2

Enables case-insensitive matching

By default, case-insensitive matching assumes that only characters in the US-ASCII charset are being matched. Unicode-aware case-insensitive matching can be enabled by specifying the 'Unicode-aware case...' flag in conjunction with this flag.

3

Permit whitespace and comments in pattern

When enabled, the step will ignore whitespace and embedded comments starting with # through the end of the line. 
In this mode, you must use the \s token to match whitespace. (If this option is not enabled, any whitespace characters appearing in the regular expression are matched as-is). 

4

Enable dotall mode

When enabled, the expression '.' matches any character including the line terminator. By default, this expression matches any character except line terminators.

5

Enable multiline mode

When enabled, the expressions '^' and '$' match just after or just before, respectively, a line terminator or the end of the input sequence. By default, these expressions only match at the beginning and the end of the entire input sequence.

6

Enable Unicode-aware case folding

When enabled, in conjunction with the Case-insensitive flag, case-insensitive matching is done in a manner consistent with the Unicode standard. By default, case-insensitive matching assumes that only characters in the US-ASCII charset are being matched.

7

Enables Unix lines mode

When enabled, only the line terminator is recognized in the behavior of '.', '^', and '$'.


User defined Java Class

Description

User defined Java Class is a step in the Scripting Plugin for Process Studio WorkflowsThis step allows you to enter User Defined Java Class to drive the functionality of a complete step.  In essence, this step allows you to program your own step.

Note: The goal is to allow users to define methods and logic with as little as code as possible, executed as fast as possible.  For this the Janino project libraries that compile Java code in the form of classes at runtime are used.  Not 100% Java. The first thing to know is that Janino and as a consequence this step doesn't need the complete Java class, only the class body: the imports, constructors and methods needed.  So to drive the point home, the step doesn't need the full class declaration.  The developers of this step selected this approach over the definition of the full class since it was possible to hide a lot of technical details and methods from the user this way.

If you need to do a lot of Java development it is advised to do this in a Java IDE like Eclipse, not inside this step. You can always expose your Java code to this step by throwing it in a jar file and by placing that library in the classpath of Process Studio (libext/ folder).

Configurations

No

Section

Description

1

Classes & Code Fragments*

It is a navigator from where you can choose Classes & Code Fragments such as code snippets, Web Driver, Logging, Input/Output/Info fields.

2

Class Code

It contains the body of the class.

3

Fields Tab

You can define all the new fields you want in the output of the step in the "Fields" tab.

4

Parameters Tab

Suppose you have a nice piece of code, and you’d like it to become more generic. Step parameters may be a useful tool in this context. As an example I’d like to provide a regular expression and a field name as parameters. The step should check whether the specified field matches the regex and output a 1 or 0 to a result field.

5

Info Steps Tab

Sometimes it’s necessary to combine the input of multiple steps. Possibly assigning roles to them. A stream lookup step is a classic example. This is where info steps come into play: they are input steps that are explicitly read from. Their rows are not returned by calls to getRow(). It’s easy to utilize info steps on a user defined java class step. Just attach them to the step and define them as info steps in the UDJC step UI. Reading rows from the info steps is as easy as calling getRowsFrom().

6

Target Steps Tab

It is possible to direct rows to different target steps using the user defined java class step. In a regular case a call to putRow() takes care of passing on a row to the next step(s). Process takes care of the rest. Now if you’d like to direct rows to specific steps, you’d define all possible target steps and call putRowTo(), specifying the output row set explicitly instead.

* Classes & Code Fragments



No.

Tree Structure

Description


Code Snippets:


1

Common Use

It provides the common methods such as main method.

2

Step Status

It provides methods for getting/setting and incrementing input and output lines of the step

3

Step Logging

It provides methods for logging at different level of details at step level.

4

Step/Row Listener

It provides methods for row level and step level listeners.

5

Row Manipulation

It provides methods for getting metadata of input and output rows and row manipulation.

6

Uncommon Use

This package contains the uncommon classes needed to define and execute workflows.


Web Driver:


1

Get Web Driver

This method is used to specify the Web Driver


Logging:

Logging option is used to log some extra information in the agent log file.

1

Info

It provides methods for ‘Info’ level logging at workflow level. 

The log can be specified ,

WithIdentifier:

Double clicking this option allows you to specify log message and its relevant identifier through which information can be searched in agent log file. Or

WithWorkflowInstanceId:

This option also allows info level logging but uses WorkflowRequestId instead of custom identifier.

2

Error

It provides methods for ‘Error’ level logging at workflow level. 

The error log can be specified

WithIdentifier or

WithWorkflowInstanceId

3

Exception

It provides methods for ‘Exception’ level logging at workflow level. 

It allows to log exceptions at,

Info or

Error 

4

Input fields:

Most of the time, working with input and output fields is the most important thing you'll be doing in your UDJC code.  As such, there are a number of ways to handle the manipulation of fields provided by ‘row manipulation’ code snippets. 

5

Output fields:

These are the step output fields

6

Info fields:

These are fields from the stream


User Defined Java Expression

Description

User Defined Java Expression is a step in the Scripting Plugin for Process Studio Workflows. This step allows you to enter User Defined Java Expressions as a basis for the calculation of new values.

Configurations

No.

Field Name

Description

1

Step name

Specify the name of the step as it appears in the workflow workspace. This name has to be unique in a single workflow.

2

New Field

The new field in the data stream. If you want to overwrite an existing field, you need to define the field here and in the "Replace value" option.

3

Java Expression 

Specify the Java Expression

4

Value Type 

Specify the data type.

5

Length

For Number: Total number of significant figures in a number; For String: total length of string; For Date: length of printed output of the string.

Specify the length,

  1. For Number: Total number of significant figures in a number 
  2. For String: total length of string
  3. For Date: length of printed output of the string.

6

Precision

For Number: Number of floating point digits; For String, Date, Boolean: unused.

No. of digits after decimal.

Specify the precision,

  1. For Number: Number of floating point digits;
  2. For String, Date, Boolean: unused.

7

Replace value

Select a field from the drop down list when you want to replace a field.




      Links to better reach 

            Bot Store

             EPD