Professional Documents
Culture Documents
6 References. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 473
6.1 Commands Reference. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474
Main Window Commands. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474
Code Editor Commands. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 476
Project Tree and Script Tree Commands. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481
6.2 Code Snippets Reference. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484
6.3 File and Folder Management. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 487
6.4 Multilingual Management. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 490
Congratulations on acquiring SAP Intelligent Robotic Process Automation. If you want to create your first
automation project and your first bots, this document will guide you through this journey.
Please take the time to read About Desktop Studio [page 8], where we will present the different perspectives
of the tool.
You should also read the Capturing, Declaring and Controlling Applications [page 67] section as it contains
important information on how to identify UI elements in the applications that you would like to automate.
The business logic and sequences of actions are explained in Designing Scenarios [page 287].
You can start with the Workflow Designer, which will help you to design your first project. As projects can be
complex, a good knowledge of JavaScript is recommended to leverage the full power of Desktop Studio, deploy
jobs to Desktop Agents, and orchestrate them with Cloud Factory.
Before you start to use Desktop Studio and Desktop Agent, set up Cloud Factory and register your workstation.
For more information, see the Installation Guide.
SAP Intelligent Robotic Process Automation is a cloud solution (Cloud Factory) that works with the on-premise
components Desktop Agent and Desktop Studio.
Solution Components
Desktop Agent
Cloud Factory
• Is a software component that runs and is hosted on SAP BTP (Business Technology Platform)
• Centrally manages all common resources related to SAP Intelligent Robotic Process Automation:
• Management of environments
• Management of agents and agent groups
• Deployment of projects through packages and configurations
• Controlling of jobs, agents, and triggers
• Cloud Factory then deploys the projects, scenarios, or even jobs (both attended or unattended usage) to
Desktop Agent
Desktop Studio
Desktop Agent is one of the on-premise components that works with SAP Intelligent Robotic Process
Automation.
• Desktop Agent is installed on a workstation and has a set of connectors for different technologies that help
it control applications.
• Desktop Agent has a work manager component that receives messages from the connectors. The work
manager component decides how to handle the messages (including determining whether they are
relevant to the project) as defined by the configuration scripts.
SAP Intelligent Robotic Process Automation is used to automate parts of external applications.
Perspectives
Desktop Studio is structured according to the concept of perspectives. A perspective is a workshop dedicated
to a specific development task. Desktop Studio includes the following perspectives:
When launched, Desktop Studio opens the Main window shown below.
Purpose
The Explorer perspective provides a graphical interface for declaring applications. It lets you:
The first time you start Desktop Studio or open a project, the Explorer perspective panel appears.
Hover over each panel for a description. Click the panel for more information.
• Parameters
• Track Events
• Text
• Name
• Subtree
• Criteria
• Capture data
• Recognition
You can save your current layout by clicking View Layout Save . This layout will then be restored the
next time you start Desktop Studio. To restore this layout without restarting Desktop Studio, click View
Layout Restore .
This window lets you view or edit item, application, or page parameters. It consists of:
For more information on using this tool window, see Declaring Applications [page 249], Declaring Pages [page
252], and Declaration of Page Items [page 262].
This window lets you check/uncheck event tracking for an item, application, or page.
A description of each event is available when you hover over the checkboxes.
For more information on using this tool window, see Declaring Pages [page 252] and Declaration of Page Items
[page 262].
This tool window shows a part of the tree view associated with the item selected in the current view. It contains
up to three parent levels of this item, including all children.
Note
You can change the depth of the subtree (between 3 and 10 levels) using the slider on the left.
This tool window is synchronized with other tool windows and views: selecting a component in this tool window
selects the same component in the other tool windows/views, and vice versa.
This tool window shows all the components that have a non-empty Text property. The Text property depends
on the technology:
This tool window can be useful for detecting invisible components, such as menu items.
As in the tree display, right-clicking a component displays a context menu that lets you:
This tool window is synchronized with the other tool windows and views: selecting a component in this tool
window selects the same component in the other tool windows/views, and vice versa.
This tool window allows you to view and edit item (or application and page) criteria. It consists of:
A complete description of this tool window can be found in Criteria Management [page 269].
When you right-click a property, a context menu appears that lets you:
If you add a criterion to a property of a component that is not associated with any item, a new item is created
automatically. For a complete description of this tool window, see Criteria Management [page 269].
This tool window shows the component associated with the selected item and the corresponding recognized
components, if any. It lets you investigate recognition problems.
For a complete description of this tool window, see About the Recognition Mechanism [page 276] .
The project tree displays all of the applications, pages, and items that are declared in the current project. It lets
you:
Each node (element) in the tree has a shortcut menu with the main functions associated with that element. For
more information, see Commands Reference [page 474].
For a full explanation, see About the Recognition Mechanism [page 276].
Depending on what you selected in the project tree, the Capture panel displays one of two views:
The Application view displays a mosaic consisting of one thumbnail (1) for each page declared in the selected
application.
If a page has several captures, only the first one is displayed. To display a different one, edit the capture
properties in the capture selector (part of the Page view described below).
• Change the selected page comments using the page comment editor (3)
• Change the zoom level with the zoom slider (4)
Hover over each panel for a description. Click the panel for more information.
Here you can select the capture that is currently displayed. The capture toolbar lets you perform the following
actions:
• Make a new capture: adds a new capture (or replaces the current one)
• Lock/Unlock capture: useful for locking the selected capture during recognition
• Delete capture: delete the current capture
• Edit capture properties:
Here you can you choose the way the selected capture is displayed in the Display panel:
• A screen display
• A tree display
• A split display showing both screen and tree displays
• A source display
What is shown here depends on what you have chosen in the display selector.
Screen Display
The display panel displays the page capture. You can select any component simply by clicking on it. The
selected component is then surrounded by a blue rectangle.
For a complete description of recognition with Desktop Studio, see About the Recognition Mechanism [page
276].
Resize Panel
The resize panel lets you change the zoom level of the
screen capture:
• Using the Slider (1) of the resize panel (or using the
mouse wheel with the CTRL key pressed)
• Using the Zoom to fit (2) button to fill the display panel
with the screen capture
• Using the Reset view (3) button to restore the native
size of the screen capture
Correction Toolbar
When the captured page is displayed, you can click each item on the page, which is then surrounded by a green
rectangle. If the rectangle position is incorrect due to a general offset or a ratio error in the screen capture, you
can adjust it via the Offset and Ratio values. To do this, uncheck then check the desired value, then enter the
corrected value or use the Spin button.
Action Toolbar
Image Selector
In order to do this:
• Show the image selector by checking the Hide/Show Image Selector button (2)
• Move and size the image selector rectangle (drag&drop over the rectangle or on the sides of the rectangle)
• Right-click the image selector to display the context menu. The following menu items are displayed:
• Copy image selection
• Create new item from image selection
• Crop image to selection
Note
With the Crop image to selection command, the captured image is not cropped to the image selector
rectangle. It is cropped from the top-left corner of the image to the bottom-right corner of the image
selector rectangle.
Tree Display
The tree display shows the DOM tree (internal structure) of the capture.
• Show the full tree or only the rooted tree (for subpage captures)
• Show/hide the recognized items and subpages
The rooted tree is the Document Object Model (DOM) subtree under the root component. You cannot
associate a component that is outside of the rooted tree with an item of the page.
The display panel shows the DOM tree. Each component can be displayed in one of the following ways:
A regular component
A recognized item
A recognized page
As in the screen display, right-clicking a component displays a context menu that lets you:
This view is synchronized with the screen display: If you select a component in one display, it is also selected in
the other display.
Source Display
The source display shows the source of the capture, where available (that is, the HTML source).
The source display can help to view page elements not shown in the DOM, like JavaScript code for Web pages.
Desktop Studio provides a Workflow Designer that lets you create automation workflows. It includes:
• The Workflows window (1), which contains a list of all the declared workflows.
• The Workspace (2), where you design a workflow.
• The Activities window (3), from where you can drag activities and pages.
• The Properties window (4), where you modify activity properties.
• The Context window (5), which contains the context structure of the project.
• The Errors window, which displays any errors encountered when the workflow is built.
Purpose
The Editor perspective provides a graphical interface for developing automation scripts. It includes a powerful
code editor with:
• Syntax highlighting
• IntelliPrompt features
• Code snippets
• And much more
It also includes:
• Multi-document management
• Script compilation
• Layout personalization
You can debug your scripts with the integrated script debugger, which includes:
When you select the Editor tab, the Editor Perspective panel is displayed:
• The document editor (1). The following document editors are currently implemented:
• The code editor
• The inline help viewer,
• The document selector (3),
• Various tool windows (4,5,6,7) that can be docked around it
The script tree (2) tool window displays all of the script files included in the current project. You can use it to
open scripts for editing.
Background
Any number of scripts can be open simultaneously. Each script is loaded into its own, independent document
editor.
• Document tabs (1), (2), (3), and so on – one per open document. The document that is currently being
edited is highlighted (4)
• A selector menu (5)
Document Tab
The document tabs let you:
The selector menu is useful when you have opened more documents than the number of tabs that the selector
can display.
It lets you view all of the open documents and select one of them for editing.
Background
The code editor is used to edit script files and XML blocks.
The Editor
The editor is a powerful text editing control that is packed with features for efficient code editing, including
syntax highlighting, code outlining, block selection, IntelliPrompt, split views, zooming, and more.
Editing Features
Appearance Features
• Syntax highlighting
• Word wrap
• Whitespace display
• Optional line number, selection, outlining, ruler, and word wrap glyph margins
• Indicators (bookmarks, breakpoints, current statement, etc.)
• Four-way or two-way split views
• Animated zoom in and out, with mouse wheel support
• Squiggle lines for marking errors and spelling mistakes
• Complete support for both automatic and manual code outlining (folding), with customizable outlining
node options
• Collapse (hide) regions of text independently of the outlining feature
• Indentation guides
IntelliPrompt Features
• Completion lists that improve editing productivity and support complete word functionality
• Completion lists support filters (tabs/buttons), multiple matching algorithm options, ability to create
custom matching algorithms, matched text highlights, description tips, and much more
• Quick info tips that can show detailed information about what is under the mouse, with automated mouse
hover tracking
• Parameter info tips that can show multiple signature overloads and track the current parameter
• Code snippets that allow predefined text fragments to be inserted into the editor, and declared fields
edited
See also Code Editor Help Features [page 53] and Code Editor Commands [page 476].
Indicator Margin
The indicator margin displays various indicators:
• : bookmark indicators
• : breakpoint indicators
• : todo indicators
You can change the margin visibility with the Is Indicator Margin Visible setting in the editor perspective
settings.
You can change the margin visibility with the Is Line Number Margin Visible setting in the editor perspective
settings.
Selection Margin
The selection margin displays colored bars where code has been modified:
• Yellow bar: indicates modified code that has not yet been saved
• Green bar: indicates modified code that has been saved.
You can change the margin visibility with the Is Selection Margin Visible setting in the editor perspective
settings.
Outlining Margin
The outlining margin displays the code outlining (folding) node tree. It lets you expand and collapse nodes:
You can change the margin visibility with the Is Outlining Margin Visible setting in the editor perspective
settings.
Folder Node
Project script
Each (SDK or project) script node contains subnodes displaying a first-level code map (see Navigation Using
Code Map [page 44]).
Each tree node has a shortcut menu providing the main associated functions (see Commands Reference [page
474]).
It lets you:
The project tree contains all of the processes, applications, pages, and items declared in the current project.
• Add resources
• Select the application/page/item displayed in the page viewer
• Drag&drop application/page/item names in the current code editor (see Code Editor Help Features [page
53])
• Insert a snippet in the current code editor (see Code Editor Help Features [page 53])
Navigation
Find/Replace
Compilation
Debugging
• Breakpoints (see Debugging Your Code with Script Debugger [page 425])
• Locals (see Debugging Your Code with Script Debugger [page 425])
• Call stack (see Debugging Your Code with Script Debugger [page 425])
• Watches (see Debugging Your Code with Script Debugger [page 425])
Docking Management
Background
• Four tool window zones on the left, top, right and bottom sides.
• One document zone in the center. This document zone can be split into several document zones.
You can also open a linked docksite (by clicking View Open linked docksite in the Main Window menu
bar). This a second docksite where you can dock document editor instances and tool windows.
To do this:
• Drag the code editor tab or the tool window tab. The docking guide is displayed automatically.
• Drop the dragged tab onto the desired section of the docking guide.
To dock a document editor instance, drag the document Editor tab over a document zone.
• Onto one of the splitting guides, this action splits the document zone and moves the dragged document
editor instance to the newly created document zone
• Onto the central guide, this action moves the dragged document editor instance to the corresponding
document zone
• Outside the docking guide, this action makes the dragged document editor instance a floating instance.
Note
• If you double-click the title bar of a floating document editor instance, you move it back to its document
zone
• You can use the CTRL key to prevent the docking guide from being displayed
• Similarly, you can use the Shift key to lock the splitting guides in place, ensuring that they are not
changed or removed as you move the mouse around
• Onto the document guide, this action moves the dragged tool window as a document to the corresponding
document zone
• Onto one of the tool window zones guides, this action moves the dragged tool window to the corresponding
tool window zone
• Onto one of the splitting guides, this action splits the tool window zone and moves the dragged tool window
to the newly created tool window zone
• Outside the docking guide, this action makes the dragged tool window a floating window
Until the new layout has been saved, you can restore the previously saved layout.
Tip
• You can lock and unlock a tool window in opened mode using the pin and unpin buttons in the title bar.
• Some tool windows can be closed using the X button in the title bar.
• You can display all the available tool windows by clicking View Tool Windows from the main
menu. Check or uncheck individual tool windows to show or hide them.
• Double-click the title bar of a floating tool window to move it back to its tool window zone.
Layout Management
You can save your layout by clicking View Layout Save from the main menu. This layout will be restored
the next time you launch Desktop Studio.
To restore this layout without restarting Desktop Studio, click View Layout Restore .
Note
The editor perspective manages two independent layouts: one for debugging mode and one for editing
mode. If you save the layout while the project is running, the debugging layout is modified. Otherwise, you
modify the editing layout.
The UI Designer perspective is where you design user interfaces, such as input forms or custom pages. It
features:
When you select the UI Designer perspective tab, Desktop Studio displays the UI Designer perspective panel:
The Resources tree displays a list of the popups included in the project. It allows you to:
Add a new popup: To create a new popup, right-click the POPUPS root node of the Resources tree and select
Add a new Popup … from the context menu. This displays a dialog where you have to:
• Enter the name of the popup – this name must be unique among the popups of the project
• Choose the template that best meets your needs
Edit a popup: To edit a popup, right-click the corresponding Popup node in the Resources tree and select Edit
from the context menu. A new editor then opens in the popup editor zone.
If the popup editor is not yet open, the properties of the popup are displayed in the Properties tool window.
Delete a popup: To delete a popup, right-click the popup node in the Resources tree and select Delete from the
context menu. A confirmation message is displayed before the popup is deleted.
Each popup subtree displays the list of files used by the popup:
This list automatically includes all of the project files in the page subdirectory found in the local folder of your
project.
• Right-click the popup node in the Resources tree and select Add a new file … from the context menu
• Enter the name and the type in the displayed popup and validate
• The new file is created in the page subdirectory
• It is added to the Resources tree, which means you can edit it in the UI Designer
• Note
You can also manually add any existing file (for example, an image) as follows:
The added file appears in the Resources tree, allowing you to edit it in the UI Designer.
Note
In this case, the added file is not included in the popup.html file. If necessary, update the file manually.
Delete a file: To delete a file, you need to remove it manually in Windows Explorer. If necessary, manually
update the popup.html file to remove any “include” clauses.
The Popup subtree also contains an Items node that contains a hierarchical view of the popup items.
Add a new item: You cannot add a new item using the Resources tree. You must do it in the Designer view.
Move an item in the hierarchy: Some items are container items that accept other items as children. This
enables you to build a hierarchy of items.
You can move an item within the hierarchy using drag&drop in the Resources tree.
Delete an item: To delete an item, right-click the Item node in the Resources tree and select Delete from the
context menu. A confirmation message is displayed before the popup is deleted.
Caution
If you delete a container item that has children, the children will be deleted too.
The designer view displays the popup in an embedded Internet Explorer window. This allows you to graphically
design your popups. The toolbar contains the following items:
Design Mode
When design mode is active, each item is surrounded by a dotted rectangle with the Name property in the
top-right corner. In this mode, you can:
• A context menu is displayed showing all available items (button, edit, table, and so on). Each item is
mapped to a bootstrap component.
• Select the desired item type and validate.
• The new item is added to the Resources tree, under the Items node.
Edit an item:
With design mode active ( ), click the item in the designer view. The item properties are then displayed in the
Properties window, where you can edit them.
UI Designer uses the Bootstrap-3 framework to manage popups. That means that you cannot simply set (X,Y)
properties to choose the position of an item. Instead, you have to create a grid using row and columns items.
With design mode active ( ), right-click within the page in the design view:
• Expand the Insert grid menu item and choose a grid item to add (such as containers, rows, columns).
• The new grid item is added to the Resources tree [1] under the Items node.
The Items subtree reflects the structure of the grid. You can change this grid structure using drag&drop in the
Resources tree.
Note
This is not possible in design view. You must do it in the Resources tree.
Delete an item:
You cannot delete an item in design view. You have to do it in the Resources tree.
The editor zone allows you to edit the text files associated with the popup: settings.js, popup.html, and so on.
You can open multiple files at the same time and switch between them using the document selector (see The
Editor Perspective [page 23]).
Each file is opened in an editor that provides a wide range of features, including syntax highlighting, unlimited
undo/redo, IntelliPrompt, outlining, and zoom. For a complete description of these features, see The Code
Editor section in The Editor Perspective [page 23].
Note
By editing the settings.js file, you can change the design of your popups in JavaScript.
• Properties
• Code Map (see Navigation Features [page 44])
• Find Results (see Search Features [page 48])
The Properties tool window allows you to change the properties of popups and their items. The toolbar contains
the following items:
Edit Properties
• From the Resources tree, right-click the corresponding node and select Edit from the context menu.
• From the design view, either select the item in design mode, or right-click the item and select Edit Item or
Edit Popup from the context menu.
Refresh Mode
If auto-refresh mode is on, the design view is automatically updated each time you validate a property change
in the property grid. If not, you need to update the design view manually using the button.
Most properties are simple to edit. But some items, such as radio buttons and checkboxes, have complex
properties that are editable as arrays of objects.
Note
Docking Management
The layout of the UI Designer perspective is a DockSite comprising:
• Four tool window zones at the left, right, top and bottom
• One documents zone in the center. This zone can be split into multiple documents zones.
As in the editor perspective, the layout can be modified and saved (see Docking Management in the The Editor
Perspective [page 23]).
Related Information
Desktop Studio has an integrated debugger that lets you control the execution of automation scenarios. It
includes:
A debug session is basically a set of trace lines shown in JSON format. There is one line for each:
Additionally, it can include .png files that correspond to the screenshots captured during execution.
When a debug session is loaded into Desktop Studio, a new debugger instance is launched in embedded mode
in a new Debug perspective:
The first time the session is saved, the debugger asks you for the file path and the name of the file to save the
session.
The debugger will then automatically save the complete debug session in this file when execution ends.
Keyboard Navigation
With this feature, you can navigate through the elements of the page without using the mouse. You can activate
and use the keyboard navigation by using the Tab key. An outline appears around the focused element.
With this feature, you can navigate through the SAP Intelligent Robotic Process Automation Desktop Studio
with the help of an audio narrator. Every action is detailed by the voice (the letters you type, the elements you
select on the page...).
With this feature, users with low vision or visual disabilities can change the theme of the page to black.
Procedure
1. Select Settings
2. Change the theme to HighBlackContrast.
Note
If you set the theme to black in your Windows settings, it will automatically change the theme to black in
the SAP Intelligent Robotic Process Automation Desktop Studio.
The following features help you to navigate through Desktop Studio code.
The Code Map tool window in the Editor perspective displays the code structure of the script or the XML block
being edited in the code editor that has the focus.
It lets you:
• Navigate to the code from the code map by selecting the desired map entry. The code editor automatically
scrolls to the first line of the corresponding code block.
• Navigate from the code to the code map by right-clicking within the code editor and selecting Show in code
map from the context menu. The code map tree automatically scrolls to the corresponding map entry and
selects it.
• Scenario
• Step
• Event handler
• Function
• Callback
ACTIONS ACTION
EVENTS EVENT
CONTEXT STRUCTUREDON
Bookmarks are navigation marks that can be set anywhere in the code. Setting a bookmark on a line of code
makes it easy to return to this line later.
To set a bookmark on a line, put the cursor anywhere in the line and click the button in the navigation toolbar.
A bookmark is set and is displayed in the code editor margins. If a bookmark is already set on the line, it is
removed when you click the icon.
You can also remove all bookmarks by opening the dropdown for the bookmark icon and clicking Clear All
Bookmarks.
Navigate to a Bookmark
The Bookmarks tool window in the Editor perspective displays all the bookmarks in the current project. By
double-clicking an entry, you can navigate directly to the selected line in the script file or XML block.
You can also navigate between bookmarks using the navigation toolbar:
• To navigate to the next bookmark, select the option from the bookmark dropdown or press F2 .
• To navigate to the previous bookmark, select the option from the bookmark dropdown or press SHIFT +
F2 .
Manage To Do Items
To set a to do item in a script or an XML block, simply type a comment line containing the word TODO. When
saved, the corresponding line is shown like this:
The To Do List tool window of the Editor perspective displays the to do items in the current project.
By double-clicking an entry, you can navigate directly to the corresponding line in the script file or XML block.
Desktop Studio stores all the navigation actions in a navigation history. This lets you navigate backwards and
forwards within this history.
Navigation History
Desktop Studio stores a navigation point every time:
Note
Desktop Studio lets you navigate from a code editor to a statement definition.
• Right-click the statement and select Goto Definition from the context menu
• Or move the caret to the desired statement and press F12
The Code Tree tool window in the Editor perspective displays the JavaScript parsing tree of the script currently
being edited in the code editor that has the focus.
Find
• Select the desired string in the code editor, right-click the selection and select Find and Replace Find
from the context menu (or press Ctrl + F )
• The following Find dialog is displayed:
You can:
• Edit the search string with the Find what field (1) (or select one from the Find what history),
• Change the scope of the search via the Look in combo box (2):
• Current Document – search in the whole document
• Selection – limits the search to the current selection (if not empty)
• Change the find option using the Options checkboxes (3):
• Match whole word only lets you search for whole words rather than partial words
• Match case lets you perform a case-sensitive search
• Regular expression interprets the searched string as a regular expression rather than a literal string
To find the next occurrence of the search string, click the Find Next button:
• The code editor automatically scrolls and selects the next occurrence found
• When the end of the document is reached, the search continues from the beginning of the document
• If no other occurrence is found, the Find Next button is disabled
Quick Find
Quick find lets you search in the current code editor without opening the Find dialog:
• Select the desired string in the code editor, right-click on the selection and select Find and Replace
Quick Find Next from the context menu (or press Ctrl + F3 )
• The code editor automatically scrolls and selects the next occurrence found.
Find in Files
• Select the desired string in the code editor, right-click the selection and select Find and Replace Find in
Files from the context menu (or press Ctrl + Shift + F )
• The following Find dialog is displayed:
• Edit the search string in the Find what field (1) (or select one from the Find what history),
• Change the scope of the search in the Look in combo box (2):
• Whole Solution extends the search to all project files
• All Open Documents extends the search to all documents (script files and XML blocks) opened in the
Editor perspective,
• Current Document limits the search to the current code editor.
• Change the find options with the checkboxes (3):
• Match whole word only lets you search for whole words rather than partial words
• Match case lets you perform a case-sensitive search
• Regular expression interprets the searched string as a regular expression rather than a literal string
• Search in SDK files lets you include SDK files in your search.
• Select the desired string in the code editor, right-click the selection and select Find and Replace
Replace in Files from the context menu (or press Ctrl + H )
• The following Find dialog is displayed:
• Edit the search string in the Find what field (1) (or select one from the Find what history)
• Edit the replacement string in the Replace with field (2) (or select one from the Replace with history)
• Change the scope of the search using the Look in combo box (3):
• Whole Solution extends the search to all project files
• All Open Documents extends the search to all documents (script files and XML blocks) opened in the
Editor perspective
• Current Document limits the search to the current code editor
• Selection limits the search to the current selection (if not empty)
• Change the find options using the checkboxes (4):
• Match whole word only lets you search for whole words rather than partial words
• Match case lets you perform a case-sensitive search
• Regular expression interprets the searched string as a regular expression rather than a literal string
• Search in SDK files lets you include SDK files in your search
• The code editor automatically scrolls and selects the next occurrence found
• When the end of the document is reached, the search continues from the beginning of the document
• If no other occurrence is found, the Find Next button is disabled
• The code editor replaces the selected occurrence and automatically searches for the next occurrence
• When the end of the document is reached, the search continues from the beginning of the document
• If no other occurrence is found, the Find Next button is disabled
The Find Results tool window in the Editor perspective displays the results history of the various Find All
operations.
It consists of:
The result selector (1) displays a Results tab for each results set. Each Results tab shows the search text of its
results set.
The current results set can be changed by selecting the corresponding Results tab.
Close All But This Close the results history apart from the this results set
IntelliPrompt
IntelliPrompt displays a list of available words while you type code in the The Code Editor [page 26].
In this example, the list displays all the properties and methods of Mantis that start with "pa".
IntelliPrompt Validation
To validate a list entry:
QuickInfo Tooltip
The QuickInfo tooltip (3) is associated with the list selection. For a full description of its content, see QuickInfo
[page 54].
QuickInfo
QuickInfo displays a Help tooltip when the mouse cursor is positioned on a statement in the code editor.
Note
Snippets
Snippets are predefined code blocks that can be inserted into the code. For a complete list of snippets, see the
Code Snippets Reference [page 484].
Insert a Snippet
A snippet can be inserted in a code editor in various ways:
The snippet code block is inserted in edit mode so that it can be completed:
Sample Code
In this mode:
Note
You can insert application/page/item names in the code editor by dragging & dropping them from various tool
windows in the Editor perspective:
• Project tree
• Page viewer
The Page Viewer tool window in the Editor perspective displays a page capture.
Breadcrumb
The breadcrumb (1) lets you select the application/page/item displayed.
Capture Selector
The capture selector (2) lets you select the capture that is currently displayed.
Capture Toolbar
The capture toolbar (3) lets you perform actions on the captures:
• Make a new capture: adds a new capture (or replaces the current one)
• Lock/unlock capture: useful for locking the selected capture during recognition
• Delete capture: deletes the current capture
• Edit capture properties:
• Change the capture comment shown as a tooltip on the capture tab in the capture selector (1)
• Select the capture(s) shown in the Application view
Action Toolbar
The action toolbar (4) lets you:
You will find a full description of the image selector in The Explorer Perspective [page 9].
Resize Panel
The resize Panel (5) lets you change the zoom level of the screen capture:
• Using the Size to fit button to fill the display panel with the screen capture.
Tip
• Problems may occur when zoom factors are tuned with different values on a multiple screen
display. This is a known issue, in particular with Chrome and Firefox during capture. Capture with
Chrome and Firefox works if the window zoom factor is the same on every screen (whatever the
browser zoom factor).
There should be no issue with Win32, UI Automation, or SAP GUI applications.
Display Panel
The display panel (6) displays the current screen capture.
In this view, only the non-technical recognized items (1,2,3,4,5) are clickable (see Set Item Parameters under
Item Definition [page 263]). They are highlighted with a green rectangle.
Once selected by clicking on it, this type of item is highlighted with an orange rectangle (1).
• Edit the page: automatically navigate to the Explorer perspective to edit the current page or item
• Copy the capture screen to the clipboard
• Insert a snippet into the current code editor (see Snippets [page 54]).
Desktop Studio uses projects to enable authoring in SAP Intelligent Robotic Process Automation. All related
resources are stored in the project structure [page 60]. Once defined, the project can be deployed to SAP
Intelligent Robotic Process Automation Factory for testing purposes and later for production.
This topic provides a brief description of what project development involves in terms of phases and the
standard development cycle.
Declaration Phase
To declare elements, you need to:
• Declare applications (executable name and a set of properties for this application)
• Declare pages for each application
• Declare relevant objects (Windows class, HTML tags, and so on) for each page
• Define criteria that ensure best recognition: the criteria are key for ensuring the robustness of the object
identification
• Declare tracked technical events to which Desktop Agent must react
For more information, see The Declaration Phase: General Information [page 240].
Implementation Phase
• Development of automation scripts to meet business requirements
• Handling technical events
• Scenario implementation
• Use of declared objects and pages
A standard development cycle is used for projects in SAP Intelligent Robotic Process Automation:
Delivery and validation of functional requirement specifica The main entry point for the project
tions
Identification of the nature of applications and processes Entails exploring the applications with Desktop Studio
Detailed functional specifications of processes to assist/au Entails describing the procedures, the process steps, the
tomate nominal case, and any error cases
Detailed design Entails splitting the processes into scenarios, scripts steps,
handlers, and events
Validation and unit testing Testing the project on client applications using the inte
grated debugger
Validation phase and support Project delivery using Cloud Factory and its environments.
A group of pilot users can try out the project under real-life
conditions.
Production phase and support Productive use of the project by all users
Overview
Desktop Studio allows you to develop your own projects. Once imported in SAP Intelligent Robotic Process
Automation Factory, they become available for both attended and unattended mode using Desktop Agent.
When you create a new project, Desktop Studio automatically generates the following set of folders, which
contain the different files for the solution:
Sample Code
<root folder>
<project name>
<project name>.pscp
<project name>.pscr
app
app1.pscp
<app1>_Screens
*.html
*.png
*.xml
app2.pscp
...
archive
archive_<project name>_<version>_<date>_<time>.zip
...
bin
<project name>.psc
<project name>.debug.psc
<project name>.js
<project name>.min.js
html
*.html, *.js
...
export
<project name>_<version>
<project name>.zip
...
<project name>_<version>.zip
local
<project name>.js
html
*.htm
...
log
...
<project name>_Screens
server
html
*.htm
updatepkg
...
<project>.pscr Resource project file (optional file, only if you use the split
resources option)
bin Folder containing all JS, XML, and resource files used for
execution when testing the project with Desktop Studio. This
folder is used to generate the project-export archive
local Contains all files that will be locally deployed on the worksta
tion. These files are saved to an archive when the project
is exported. In particular, the target project file (<project
name>.psc) is generated in this folder.
server Contains all files that will be deployed on the server. It typi
cally contains mash-up Web pages that are located on the
server and launched using a Web browser. These files are
saved as-is (without compression) when the project is ex
ported.
Note
The “archive”, “bin”, “export”, “local”, “log”, and “server” folders are mandatory. You can also add other
folders to organize your project files.
Procedure
If necessary, this folder is created automatically. A subfolder containing the project files is also created at
this location.
5. Click OK to validate project creation.
The project structure is automatically created in the specified location (see Typical Structure of a Project
[page 61]).
Procedure
Procedure
Procedure
Click File Archive Project... in the menu bar to create a backup of the project.
A new archive file is created in the archive folder. The name of this file has the following format:
It contains all of the files and folders in the project structure apart from the archive and export folders.
Procedure
A new export output folder is generated in the export subfolder. Depending on the project's structure, this
folder will contain:
• The local folder in an output ZIP file, if the compression option was selected prior to generation.
• If the compression option was not selected, all files from the local folder are copied as raw data files.
• The server folder
• The key.xml markup file
Note
Exporting a project also creates a raw ZIP file in the root export folder. The name of the ZIP file is:
<project name>_<project version>.zip.
This archive can be hosted by SAP Intelligent Robotic Process Automation Factory, when needed.
Capturing and declaring applications means identifying one or more applications that you want to control.
After you have identified the applications, you then need to identify the relevant UI elements. Even though
applications can use different “flavors” of technology, they share many common patterns.
You start by locating the screens or pages that you want to use. Within a page, you then look at the UI elements
that you will later use, such as input fields, output fields, and buttons.
Another key task when capturing and declaring applications is to set criteria for all of the UI elements that you
want to manage. You define an application and its UI elements only once. If an application evolves over time and
your criteria are unable to handle the change, you simply have to refresh the capture. Usually, this is enough to
resolve any issues that may occur.
The Desktop Studio and the Desktop Agent provide a set of technology connectors for controlling purposes.
Definitions
• A screen is an HTML page displayed in a Web browser tab, in a frame or an iframe (inline frame
<iframe>/).
The DOM of a Web screen does not include the DOM of its frames or iFrames. If you need to control a
component inside a frame or iFrame, you must declare a page for it.
Note
• Internet Explorer
• Google Chrome
• Firefox
• Microsoft Edge
To control popup windows belonging to the Web browser (for example, information or error popups, “Open
file” popups), you need to:
Page Recognition
• It looks for the first declared Web application with matching criteria
• If it finds one, it looks for the first declared page of the application with matching criteria
• If it finds one, it associates the new Web screen with the page that was found and notifies a LOAD event
for this page
• Otherwise, if it is a main frame, it associates the Web application with the generic _Undefined_ Page
and notifies a LOAD event for this page
• In all cases, it keeps the Web screen under control
• Otherwise, it ignores the Web screen
For each controlled Web screen, the Web connector regularly checks whether the Web screen still matches the
application criteria:
• If not, it notifies an UNLOAD event for the associated page (if any) and releases control over the Web
screen
• If it still matches:
• If the Web screen is still associated with a Web page, it checks whether the Web screen still matches
the page criteria and if not, it notifies an UNLOAD event for the associated page
• Otherwise, it looks for the first declared page of the application whose criteria match. If it finds
such a page, it associates the Web screen being controlled with that page and issues a LOAD event
notification for the page
Note
The control frequency can be changed with the Synchro delay parameter of the application.
• A Web application loaded in one Web browser tab is considered as one instance of the Web application
• If a Web application is loaded twice in two different Web browser tabs, the Web connector regards them as
two instances of the same Web application
Note
If a Web application instance navigates to another Web application in the same tab, the Web application
instance is considered to be ended.
iFrame Capture
You must capture the iFrame as a new page to get the content of this page.
• To capture the iFrame, you can deploy the tree to find the iFrame page.
You must make sure that the iFrame page has the same criteria as the application. If the page is not recognized,
you must modify the recognition criteria of the application to make sure that they are similar:
Related Information
For general information on this topic, see Declaring Applications [page 249].
• It looks for the first declared Web application whose criteria match
• If it finds one, it looks for the first declared page of that application whose criteria match. If it finds a page, it
associates the new Web screen with that page.
• Otherwise, it ignores the Web screen
• Broad enough to match all the Web screens of the Web application
• But not too broad, to ensure they do not match the Web screens of other Web applications
You set recognition criteria using Desktop Studio (see Declaring Applications [page 249]):
• You can use the following operators on properties of type string: Any, Empty, Full, Part, start-with, end-with,
like.
• You must declare at least one recognition criterion.
• You can set multiple criteria on the same property, which are then connected by a logical OR.
One Instance per Thread Changes the way the application instances are managed
Synchro Delay Sets the Web connector recognition frequency (see Page
Recognition [page 68]). The default value is 250 millisec
onds (max 60000 ms). If it is set to 0, no regular control
is performed but dynamic Web forms will not be managed
correctly.
Use ID as Object Name If checked, Desktop Studio generates a new item name
based on the id property of the component that has the
focus.
For general information on declaring an application in Desktop Studio, see Declaring Applications [page 249].
• It looks for the first declared Web application whose criteria match
• If it finds one, it then looks for the first declared page of the application whose criteria match. If such a page
is found, the connector associates the new Web screen with that page.
• And so on.
• Broad enough to match the desired Web screen of the Web application
• But not too broad, to make sure not to match the other Web screens of the Web application
You set recognition criteria using Desktop Studio (see Criteria Management [page 269]). Using the Web
connector, you:
• can use the following operators : Full, Part, Starts, Ends, Like
• must declare at least one recognition criterion.
• can use OR to define a combination of criteria for each property
Usually, you will set a recognition criterion on the page part of the Url property.
If a Web page has no unique distinguishing property, you can use one of the following advanced declaration
methods:
Note
If you set the MustExist parameter for a multiple item, the parameter will be ignored.
Page-Based Events
The Web connector can also notify the following technical event:
RESIZE: the onresize event is emitted by the HTML window of the Web screen.
Page Parameters
Capture (Cache): If set, all Capture (Auto) parameters set on the page items will then be considered as
Capture (Cache) parameters.
For general information on declaring a page in Desktop Studio, see Declaring Pages [page 252].
Item criteria are used by the Web connector in the following way:
Once the Web connector recognizes a Web screen as a declared page, it can search the screen DOM to find the
target of each item:
• An item will target the first DOM component that matches its criteria
• If an item is multiple, it will target all of the DOM components that match its criteria.
Items are usually declared for controlling purposes. You can also use items to aid page recognition by setting
MustExist or MustNotExist parameters (see Set Page Criteria [page 72]).
You set recognition criteria using Desktop Studio (see Criteria Management [page 269]):
• You can use the following operators: Full, Part, Starts, Ends, Like
• You must declare at least one recognition criterion
• You can use OR to define a combination of criteria for each property
Usually, you will set recognition criteria for the following properties:
TAG The Web connector requires a criterion for the HTML name
(TAG) of the component : INPUT, DIV, SPAN, and so on.
When you create an item from a Web component, Desktop
Studio automatically sets this criterion. It cannot be edited
or removed.
Note
This property corresponds to the HTML property, Inner
Text. So, if a component has a text property equal to My
Text, all ancestor components also have a text property
containing My Text.
In some cases, it is not possible to recognize a targeted component merely by setting criteria for its
properties. Another component is recognized by mistake. To ensure your declaration is correct, you can
use the components pattern method described in Items Pattern Method [page 286] or the ancestor method
described in Ancestor Method [page 285] .
The ancestor method requires you to declare an additional technical item. Use it when the components pattern
method cannot be used. Sometimes, using the ancestor method means you avoid duplicating complicated
declarations of components patterns.
Example:
On a Web page with several TABLE components, you need to target the ROWS of the TABLE component which
has a column header (TH) Date.
The TR, TABLE, and TH components are not in a parent-child relationship. That means you can't directly
declare your oRow item by using the components pattern method described earlier. Instead, you must:
• First declare a technical oTable item which targets the TABLE component, using the components pattern
method
• Then declare the oRow item with the oTable item as ancestor to target the ROWcomponents
Consider the following use case: On a Web page with a table comprising two columns and two rows, you declare
an oCell Item to target the cells (TD) of the second column in the table.
The range property is calculated by the Web connector during recognition of an item. Its 0-based value
indicates the range of an HTML tag relative to an HTML node. This HTML node depends on the declaration of
the item you need to find.
You declare the oCell item using the components pattern method.
With the following oCell declaration, you cannot use the range property to target the second column because
the Web connector calculates the range values relative to the table node:
If you declare the oCell item in the following way, the Web connector calculates the range values relative to the
TR node. You can then use the range property to target the second column.
You can't use the range property as a criterion for a multiple item.
As you can see, it can be difficult to know which range value will be calculated by the Web connector. It is
advisable to use the range property only to distinguish direct children of an HTML tag. The range value given in
the Captured data is calculated in this way.
Item-Based Events
SETFOCUS Notified each time the onfocus event is issued by the tar
geted HTML component
KILLFOCUS Notified each time the onblur event is issued by the targeted
HTML component
CLICK Notified each time the onclick event is issued by the targeted
HTML component
These technical events must be explicitly tracked in order to be notified. They are notified to the page with the
name of the item in the _ItemName_ data (complemented by a possible index).
Note that tracking events is not supported (no event will be issued) for multiple items.
Must exist If set, the page will be recognized only if the item exists (for
more details, see MustExist Method [page 284])
Must not exist If set, the page will not be recognized if the item exists (for
more details, see MustNotExist Method [page 284] )
Ancestor Name of the ancestor item (for more details, see Ancestor
Method [page 285] )
Key type Can be used only for a <select> component. If set, this
tells the Web connector to consider the ‘Text’ property of
the <option> nodes of the ‘value’ attribute (see Controlling
Complex Items Using the Web Connector [page 85]Control
ling a <select> component)
GetValueMethod Allow the software to override the default ‘get’ method be
havior (see Controlling Entities Using the Web Connector
[page 78])
SetValueMethod Allow the software to override the default ‘set’ method be
havior (see Controlling Entities Using the Web Connector
[page 78])
The Web connector implements the standard control methods described in Controlling an Application [page
234]. It does not provide any additional features for controlling applications beyond these standard methods.
The Web connector implements the standard control methods described in Controlling a Page [page 232]. It
also provides additional features for controlling pages.
In Web pages, some user actions are impossible to automate using the page UI. For example, an action that is
started when the mouse hovers over a menu cannot be automated in this way.
If you can’t mimic the user action, try to automate what is triggered by this action.
To discover which event is fired and what code is executed, you can:
• Search in the Web page source using the Source Display, described in The Explorer Perspective [page 9], or
using the Web browser.
• Search in the script files used in the Web page (downloaded to the Internet temporary files directory).
• Use external tools (such as Internet Explorer Developer Tools – activated with F12 – or Visual Events).
Once you have found what you need, you can execute the corresponding JavaScript code in the Web page using
one of the following methods:
You can also execute a script directly on an item (see Execute Script on an Item Within a Web Page in
Controlling an Item Using the Web Connector [page 82]).
You can inject a JavaScript function into a Web page using one of the following methods:
injectFile Injects a JavaScript or VBScript file (or set of files) into the
page
You can then execute the injected functions using the evalScript or execScript methods.
Note
The script is injected on the client side. If the Web page reloads, its content is restored from the Web server
and the script is no longer present.
You can easily integrate these UI elements directly into the controlled Web page.
You can insert any kind of Web component into the contents of a Web page using the following methods:
Using these methods, you can specify a functional event that will be fired when the inserted component is
clicked.
Sample Code
Note
The components are injected on the client side. If the Web page reloads, its content is restored from
the Web server and the components are no longer present. You may have to insert them each time the
controlled Web page loads.
It is advisable to remove created components when Desktop Agent stops. This is particularly relevant for
injected buttons and links.
Sample Code
MyAppli.MyPage.start() ;
By default, this method uses the page’s URL that was registered when the page was captured.
Note
In general, you cannot use the same URL for a page in the development and the production phase:
You can resolve this issue by providing the right path in the start method:
Sample Code
if (ctx.options.env == e.env.dev)
MyAppli.MyPage.start('MyEnvPath') ;
else
MyAppli.MyPage.start('MyProdPath') ;
Another way to resolve this issue is to set the page’s URL for each environment using the setPath method:
Sample Code
You can also navigate from one Web page to another using the following method:
You can use the browser navigation history with the following methods:
Miscellaneous features
The Web connector implements the standard control methods described in Controlling Individual Entities
[page 226]. It also provides additional features for controlling items.
If you cannot complete a control action on an item using standard methods, the Web connector allows you to
execute JavaScript code on the targeted component within the Web page.
Sample Code
MyWebAppli.MyPage.oLogo.scriptItem(“src”);
return element.src ;
Sample Code
// get an attribute
var src = MyWebAppli.MyPage.oLogo.scriptItem ("src");
// set an attribute
MyWebAppli.MyPage.oLogo.scriptItem ("src='http://....png'");
// Fire an event
MyWebAppli.MyPage.oLogo.scriptItem ("dispatchEvent('onblur')");
This method is more powerful than the previous one. It also requires greater effort to implement, because
execScript executes a function that has the following signature:
Sample Code
where:
This function must be injected into the Web page if it is not yet present.
Sample Code
You can also get the HTML attributes of all of a page's declared items using the following page method:
Note
You can override the connector behavior by setting the GetValueMethod or SetValueMethod
parameters.
For each parameter, the value provided is the name of a JavaScript function (up to 63 characters).
The GetValueMethod function overrides the behavior of the get action. It receives the targeted component as
a parameter and must return the component value:
Sample Code
The SetValueMethod function overrides the behavior of the ‘set’ action. It receives the targeted component
and the new value as parameters and must set the component value:
Sample Code
These functions must have been injected into the running Web screen using one of the following methods:
This node lets you specify the source of a script to be injected into the page each time the connector issues a
LOAD of the page. The goal is to inject the specific method scripts (GetValueMethod and SetValueMethod)
as soon as possible to get these methods in the LOAD event for items in CaptData (which is not possible if the
scripts are injected with EXECSCRIPT).
This feature is not implemented in Desktop Studio. If required, you must create this node manually in the
corresponding PSC file.
Sample Code
<PAGE Name="o_MAIN">
<...>
<ONLOAD>
<![CDATA[
function MyGetValue( TheElement ){ return TheElement.value; }
function MySetValue( TheElement, TheValue ){ TheElement.value =
TheValue; }
]]>
</ONLOAD>
<...>
</PAGE>
Get and set actions on a <select> component are executed on the controlled application side by the Web
connector. By default, these actions are executed the following way:
• The get method returns the ‘value’ attribute of the first selected <option> node (or an empty string if no
<option> is selected)
• The set method selects the first <option> node whose value attribute matches the supplied string
You can change the connector behavior using the Key type parameter. If this parameter is set, the Text
property of the <option> node is used instead of the value attribute.
Except for <select> components, the Web connector doesn’t provide specific help for controlling complex
items such as tree, list or grid. To control complex items of these types, you need to control the elements in
their subtrees.
The content of an ActiveX control cannot be explored by the Web connector, which sees it as a black box.
Sample Code
The main difficulty is to discover the set of APIs provided by the ActiveX control:
• One way is to search the Web page files (source, scripts) to discover how the ActiveX is controlled (script
files can be found in temporary Internet files).
• Another way is to use the OleView tool to instantiate the installed ActiveX and discover exposed APIs.
• The best way is to obtain the ActiveX API reference guide (where possible).
If you cannot control the ActiveX control by these methods, you can try to use keystrokes or mouse-click (see
Controlling Individual Entities [page 226]).
• Declare the desktop application using its technology (such as Windows, Java)
• Declare the Web pages required for this application.
• is a mainframe
• matches application criteria
• doesn't match any page criteria
This _Undefined_ Page has no items, but it can be used to perform page controlling (such as navigation).
By using this page, you can avoid having to declare a page to perform this type of controlling.
So, to ignore such technical frames, set the following criterion on the CY property: CY > 0
Ccollection must be executed when the UNLOAD event notification is received. At this time, targeted
components will have been destroyed, so you cannot read item values by controlling the components.
The only way to collect this data is to set the Capture (Auto) parameter on the associated items.
• Collect the value of the item's targeted component each time a technical event is notified (not only
UNLOAD).
• Store this value in the event data.
Usually, the Web connector still has access to the Web components when it notifies the UNLOAD event.
Sometimes, certain components are inaccessible, so their value will be missing from the event data.
If you still want to collect this data, you can set the Capture (Cache) parameter of the associated item.
• Collect the targeted component value each time its onpropertychange event fires.
• Store this value in an internal cache that will be used to populate the notified technical events.
The Capture (Cache) parameter can also be set at the page level (see Page Parameters [page 73]).
All Capture (Auto) parameters set on the page's items will then be treated as Capture (Cache)
parameters.
Note that if you set the Capture (Auto) or Capture (Cache) parameter on a multiple item, the parameter
will be ignored.
For example:
• In the development phase, you control the Web application running on the test site
• In the production phase, you control the Web application running on the production site
You can manage this by setting different criteria on the Domain or Url property. These criteria will be combined
together using the OR logical operator (see Criteria Management [page 269])
For multiple items, the Desktop Agent connector targets all occurrences of the recognized components.
You can then use the appropriate index value in a script to target the desired occurrence.
On a Web Screen with a TABLE, you declare an oCell Item to target the cells (TD) of the Date column, knowing
that the user can change the order of the columns.
Under Windows 7 and Internet Explorer 8 in protected mode, each tab runs in a dedicated process, and popups
are managed by threads of this process.
A dedicated extension:
Desktop SDK provides an extension to simplify control of Siebel software. To activate this extension, simply set
the Custom Type parameter of your Web application to SIEBEL.
Internet Explorer sometimes refuses the injection and/or execution of JavaScript, or warns the user and asks
for permission:
It may append when the HTML page being controlled is from a local file, or a private network, or even a http
resource that Internet Explorer classifies as unsafe:
To work around this problem, simply include a so-called Mark of the Web in the page's HTML source:
• The URL provided in the mark will be used instead of the actual URL of the page to determine the page's
security.
• The number of characters in brackets gives the size of the specified URL
Sample Code
<html>
<!-- saved from url=(0023)http://www.sap.com -->
<input Value="ONE"/>
<input Value="TWO"/>
<input Value="THREE"/>
</html>
Using DispatchEvent
At some point, you will have to fire a specific event on a Web page. There are different ways to do that:
• fireEvent
• dispatchEvent
The first way works on Internet Explorer < 9, but for Internet Explorer >= 9 you have to use dispatchEvent.
DispatchEvent does exactly the same things, but before you use it, you have to:
You can then send the event on the current page element using dispatchEvent().
Sample Code
appli.page.execScript("var eventOnChange =
document.createEvent('HTMLEvents');" //create
"eventOnChange.initEvent('change',true,false);"); //init
appli.page.myItem.scriptItem("dispatchEvent(eventOnChange);"); //send
• Create and initialize an event directly on the web page using execScript.
• Send the event on the item we want to fire using scriptItem.
Sample Code
The following code must to be executed into the page to disable the 'flagged' elements :
Sample Code
// code injection that disables all P>a with class="button" and att disabled
MyApp.myPage.execScript("$('p > a.button:contains(\"Stop\")').on('click',
function(event){
if ($(this).attr('disabled') != undefined) {
event.preventDefault();
}
}
);");
Sample Code
Control Web Applications Developed Using Rich HTML and JavaScript Frameworks
Some Web frameworks used in Web applications use dozens of elements to mimic a native HTML element, with
styles and some controller functions.
In these cases, you can sometimes see a dropdown select menu that is in fact made with several <divs>,
an image for the down arrow, and a hidden <div> containing the options, which will be displayed when the
element is clicked.
Example:
A select menu in the Dojo + diji framework with two options found on a customer project, will be nine or more
overlapping tags without options, and all control between these tags is performed by the framework:
Sample Code
Reading
In these rich frameworks, Desktop Agent is usually fairly consistent and easy to use when it comes to reading
the value of the element - provided that you find the right HTML element to point to, including possibly in a
hidden field. That is usually done by searching in the elements, the tree or the source of the page captured in
Desktop Studio.
For example, if you want to “read” a birth date, you can just search for the element containing this value,
without really caring about the tag or mechanism used by the framework to display it to the user.
The Name or Text tool windows in the Desktop Studio explorer can be helpful in finding the value you're looking
for.
Writing
In these rich frameworks, writing a value can be much more complex than reading one. In fact, it's sometimes
not possible with the regular .set() instruction alone:
• Partly because the HTML element to be set is very specific and can differ from the one where reading is
possible.
• Partly because setting the element manually (by the end user), triggers JavaScript methods that will
sanitize or look up a value to be passed via code instead of by standard HTML methods.
Usually the challenge will lie in finding and understanding this method, which may be dynamically attached. To
find these methods should you need them, you can use:
• Visual Event 2 (a bookmarklet that is helpful, especially in older browsers, such as before Internet Explorer
11)
• Developer tools in more recent browsers - these will show you which JavaScript functions are attached
when you look at the element
• A site downloader app to search the code across all included files directly in your preferred text editor
Sometimes, depending on the application and its framework, you can use:
• A regular set method, followed by a trigger (execscript or scriptitem with fireEvent for instance or a
JQUERY equivalent) for the method called after manual evaluation, if that's easy to find out.
• A keystroke method, which should trigger the surface controls and the scripts attached to the element
• A change in focus after each input evaluation
• A custom set method (custom function)
When the framework seems overly complicated, and none of the above suggestions seem to help, you can
always search how to set the element by coding according to the framework in question, directly in Google or
Stack Overflow.
This line of JavaScript can then be tested directly in the browser, in the developer tools, and in the JavaScript
console.
Once satisfied with your instruction to set the element, you can use this JavaScript instruction in an
app.page.execscript() command in Desktop Studio, realized with your variables and needs.
UI Automation is a standard protocol developed by Microsoft. It enables applications developed with the
following technologies to be controlled:
• The capabilities provided by the UI Automation protocol (you cannot create a component in the controlled
application)
• How the UI Automation protocol is implemented in the controlled applications
Depending on the application to be controlled, the UI Automation protocol can give access to data elements
displayed in complex IHM components, such as:
• Tree items or list items in TreeView or ListBox components in QT applications (requires an accessibility
plugin)
• PDF document content in Acrobat Reader
Performance Management
Unlike other Desktop Agent connectors (such as Windows or Web), the UI Automation connector runs “out of
process”. In other words, it runs in the Desktop Agent process, not in the process of the controlled application.
All control operations are therefore carried out by means of inter-process communication, which is slower than
in-process communication. Most exchanges involve searching through the application tree during recognition.
You can significantly improve recognition performance by limiting the size of the DOM tree that is searched:
For details of the entities to define, see Entities for a Desktop Application [page 247].
Note
If you need to control Web pages embedded in a desktop application, you must define page entities for
each of these Web pages as though they were regular pages of the application.
Application-Based Events
Page-Based Events
• You can use the following operators on properties of type string: Any, Empty, Full, Part, start-with, end-with,
like.
• You must declare at least one recognition criterion.
• You can set multiple criteria on the same property, which are then connected by a logical OR.
Usually, you set recognition criteria on the EXE property (process name of the application). This criterion is
automatically set by Desktop Studio when you declare an UI Automation Application.
When you use the UI Automation connector, the following specific parameters are available:
Polling delay Sets the polling timer frequency in milliseconds. The 0 value
sets the default value, so 1000ms (polling mechanism can
not be stopped).
Pending delay If > 0, allows you to delay recognition of a loading page when
MustExist items have not yet been created
For general information on declaring an application in Desktop Studio, see Declaring Applications [page 249].
Page criteria are set on the properties of the root component of the targeted screen. They are used by the UI
Automation connector as follows:
The UI Automation connector searches the DOM tree to find all DOM components matching the page's criteria.
If a component matches, the connector doesn't search its subtree to find other instances of the page. The
connector creates one instance of the page for each matching component.
You set recognition criteria using Desktop Studio (see Criteria Management [page 269]):
• You can use the following operators: Full, Part, Starts, Ends, like
• You must declare at least one recognition criterion.
• You can set multiple criteria on the same property, which are then connected by a logical OR.
If the targeted root component has no unique distinguishing properties, you can use one of the following
advanced declaration methods:
Page-Based Events
The UI Automation protocol describes a wide range of notification events that can be fired by the controlled
applications. The UI Automation connector provides the special SPY(SUBTREE) track event to listen to all
notification messages fired by the components of the page:
• Check the SPY(SUBTREE) track event (see Select Page tracked Events)
• Run your project
• All notification events fired by the application are displayed in the Events view in the following format:
SPYTREE(event)
After receipt of these messages during the execution of the PSC, it is possible to track the events you need.
To do this, right-click the desired event and select Track this event. The corresponding event is added in the
TrackEvents tool window of Desktop Studio.
Page parameters can be set using Desktop Studio (See Declaring Pages [page 252]).
Auto Capture on polling Indicates (true) to regularly capture values of items declared
in auto capture.
Subpages Type Indicates whether the page can possess multiple (Multiple)
or single (Single) instances of subpages.
Root Item Indicates the item on the parent page used as the root item,
if any (see Root Item Method [page 284])
For each page, the recognition cost expresses the number of components that must be tested in order to
recognize the page. It is the sum of the number of components tested to recognize:
The recognition cost does not give a precise value of the time spent, but a high score (for example, more than
100) indicates pages that are good candidates for optimization.
Before recognizing a page, the UI Automation connector tries to recognize its preceding sibling pages. So, the
actual recognition cost for a page is its own cost or the cost of its preceding sibling pages, whichever is greater
(not the sum of both, thanks to cache management).
So, to optimize the recognition time of a specific page, you need to reduce the recognition cost of the page and
of its preceding sibling pages.
Note
If you need to use Items Pattern Method [page 286] to optimize root item recognition, you can use Root
Item Method [page 284].
Refreshing a page by means of polling can be time-consuming, because it requires the cache to be cleared
and the searched subtree to be reloaded from the controlled application (see Performance Management [page
93]).
To optimize cache management, it is possible to avoid refreshing subpages that are always present.
Example:
You have to control an application with a main window (1) that permanently displays a TabControl with
TabItems. You have to control two TabItems (2) and (3):
The pTabItem1 and pTabItem2 targets are not window components and must be detected by polling.
In addition, as only one TabItem can be loaded at a time, you can set the pTabControl’s ‘Subpages type’
parameter to ‘Single’). This way, when one pTabItem SubPage is recognized, the software no longer tries to
recognize other subpages of pTabControl.
By default, a parent page that has multiple subpages tries to recognized all of its subpages.
When you declare a parent page to target a TabControl and subpages to target the TabItems, you know that
only one subpage is present at one time.
You can then set the Subpages type parameter of the parent page to ‘Single’. This way, if one subpage is
recognized, the parent page doesn’t try to recognize the others.
Most pages target only one screen. To optimize page recognition performance, the UI Automation connector
only searches for a page's first target by default.
If you have to manage a page that has multiple targets, check its Multi-instance parameter.
For general information on declaring a page in Desktop Studio, see Declaring Pages [page 252].
Related Information
To detect optimization needs in page declaration, you can use the recognition cost displayed in the page part of
the Recognition tool window’ (see About the Recognition Mechanism [page 276]).
The recognition cost does not give a precise value of the time spent, but a high score (for example, more than
100) indicates pages that are good candidates for optimization.
Before recognizing a page, the UI Automation connector tries to recognize its preceding sibling pages. So, the
actual recognition cost for a page is its own cost or the cost of its preceding sibling pages, whichever is greater
(not the sum of both, thanks to cache management).
So, to optimize the recognition time of a specific page, you need to reduce the recognition cost of the page and
of its preceding sibling pages.
Note
If you need to use Items Pattern Method [page 286] to optimize root item recognition, you can use Root
Item Method [page 284].
Refreshing a page by means of polling can be time-consuming, because it requires the cache to be cleared
and the searched subtree to be reloaded from the controlled application (see Performance Management [page
93]).
To optimize cache management, it is possible to avoid refreshing subpages that are always present.
The pTabItem1 and pTabItem2 targets are not window components and must be detected by polling.
With this declaration, the whole application DOM tree is regularly reloaded. You can optimize performance
by modifying your declaration as follows:
In addition, as only one TabItem can be loaded at a time, you can set the pTabControl’s ‘Subpages type’
parameter to ‘Single’). This way, when one pTabItem SubPage is recognized, the software no longer tries to
recognize other subpages of pTabControl.
By default, a parent page that has multiple subpages tries to recognized all of its subpages.
When you declare a parent page to target a TabControl and subpages to target the TabItems, you know that
only one subpage is present at one time.
You can then set the Subpages type parameter of the parent page to ‘Single’. This way, if one subpage is
recognized, the parent page doesn’t try to recognize the others.
Most pages target only one screen. To optimize page recognition performance, the UI Automation connector
only searches for a page's first target by default.
If you have to manage a page that has multiple targets, check its Multi-instance parameter.
For general information on declaring a page in Desktop Studio, see Declaring Pages [page 252].
Once the parent page connector recognizes a UI component as a declared page, it can search the component's
subtree to find each item’s target:
• An item will target the first DOM component that matches its criteria.
• If an item is multiple, it will target all of the DOM components that match its criteria.
Items are usually declared for controlling purposes. You can also use items to aid page recognition by setting
MustExist or MustNotExist parameters.
You set recognition criteria using Desktop Studio (see): Criteria Management [page 269]).
• You can use the following operators: Full, Part, Starts, Ends, like.
• You must declare at least one recognition criterion.
• You can use OR to define a combination of criteria on each property.
ControlType (such as Edit, Button, Text) This criterion is required and automatically set by Desktop
Studio.
Deepness Indicates the depth of the component inside the DOM tree
In some cases, it is not possible to recognize a targeted component merely by setting criteria on its properties.
Another component is recognized by mistake. To ensure your declaration is correct, you can use advanced
recognition methods.
The Items Pattern Method [page 286] is frequently used when declaring items with the UI Automation
connector.
Example
A window contains several DataGrid components, with no discriminant property. You must target the DataGrid
component having a column header (HeaderItem) Date.
You declare your oTable item using the Items Pattern method as follows:
Sample Code
DataGrid [target]
HeaderItem (Value = 'Date')
The Ancestor Method [page 285] involves declaring an additional technical item. Use it when the Items Pattern
method can't be used. Sometimes, the Ancestor method can also avoid duplication of complex Items Pattern
declarations.
Example
In a window with several DataGrid components, you have to target the rows (DataItem) of the DataGrid
component which has a column header (HeaderItem) Date.
The DataItem, DataGrid and HeaderItem components are not in a parent-child relationship. That means
you can't declare your oRow item directly using the Items Pattern method. You first have to declare a
In a window with a DataGrid comprising two columns and two rows, you declare an oCell Item to target the cells
(Edit) of the second column of the DataGrid
To address this use case, you can set a criterion on the Range property:
The Range property is calculated by the UI Automation connector and indicates the absolute position of the
component within the DOM tree. When the recognition process tests a criterion on the Range property, it
considers the criterion value as relative to the preceding recognized component:
• The component recognized by the parent item if the Items Pattern method is used.
• The component recognized by the ancestor item if the Ancestor method is used.
• The component targeted by the page if none of these methods are used.
When you set a criterion on the Range property, Desktop Studio automatically sets the relative criterion value.
Caution
Be aware that this calculation is performed with the criterion is set. If you change the method used (such as
setting the Ancestor) after setting the criterion, the criterion value is not recalculated.
You declare the oCell Item using the Items pattern method. You can then use the Range property to target the
second column.
Sample Code
oCell declaration
DataGrid
DataItem [occurs]
Edit (range=R1= [target]
Item-based events must be explicitly tracked in order to be notified. The UI Automation connector implements
the following standard technical events:
SETFOCUS Fired when the component has gained the input focus
KILLFOCUS Fired when the component has lost the input focus
The UI Automation protocol specifies a certain number of notification messages, depending on the type of
item. With SPY track events, you can discover the UI Automation notification messages fired by the targeted
component:
• Right-click on the desired event and select menu item Track this event.
• The corresponding event is added in the TrackEvents tool window of Desktop Studio.
Note
Tracking SPY events is time-consuming. Take care to remove tracking before delivering your project.
Item Parameters
Must exist If set, the page will be recognized only if the item exists (for
more details, see MustExist Method [page 284] )
Must not exist If set, the page will not be recognized if the item exists (for
more details, see MustNotExist Method [page 284])
Ancestor Name of the ancestor item (for more details, see Ancestor
Method [page 285] )
Capture auto If set, the item value is included in each page-based event
Labelled by Indicates (if not empty) the name of the item that must be
recognized as the label (see Labelled By Method [page 285]
This value is the number of components tested to recognize an item (or the root item of a page). It does not
give a precise value of the time spent, but a high score (for example, more than 100) indicates items that are
good candidates for optimization.
You do this by setting a criterion on the Deepness property of the targeted component, with the LTOE
operator. This way, the UI Automation connector will limit its search to the indicated depth.
Limiting the search depth can greatly improve recognition performance when controlling an application with a
huge DOM. It is advisable to set a criterion on the Deepness property in page or item declarations.
When you set a criterion on theDeepness property, Desktop Studio automatically calculates the right
criterion’s value, relative to the direct recognized ancestor. If you change the direct ancestor after setting
the Deepness criterion so it can be recalculated.
This can be done by using Ancestor Method [page 285] or Items Pattern Method [page 286].
Example
You have to declare the oMenuOpen item in the pMain page to target the MenuItem ‘Open’ component
If you declare it as follows, the recognition will search in the three preceding components (StatusBar, Tab,
ToolBar) before searching in the MenuBar pane, and you get a recognition cost of 135.
For general information on declaring items in Desktop Studio, see Declaration of Page Items [page 262].
The following advanced recognition methods can be used with the UI Automation connector:
Please note that the order in which pages are declared is significant. For more information, see Order of
Declared Pages [page 286]
The UI Automation connector listens to the desktop to detect the opening of root UI components (children of
the desktop):
• It looks for the first declared UI Automation application whose criteria match.
• If it finds one, it looks for the first declared root page whose criteria match. If a corresponding root page
is found, the connector associates the new root UI component with that root page, and a LOAD event
notification is issued for the page.
• Otherwise, it ignores the root UI component.
Note
You must declare a root page entity to control an application's main window.
Subpage Recognition
The UI Automation connector implements the concept of subpages (see Declaring a Page [page 243]).
As soon as a page is recognized, the UI Automation connector tries to recognize each of its subpages. This
recognition is performed in the subtree of the component targeted by the page. That means you must pay
attention to the page-subpage relationship when declaring pages.
Example:
You need to target an application with a main window that sometimes opens a child window. To control the
child window, you will have to declare the following pages:
Recognition Refreshment
Page recognition is performed when Desktop Agent starts, and is reexecuted later to refresh the detection of
subpage instances. The way this refresh is performed depends on the individual subpage:
• By listening for the WINDOWOPENED event for subpages targeting window components (RefreshMode
Window)
This refresh mode is automatically set when a page is created, but can be modified individually by setting the
subpage parameters (see Page Parameters).
Caution
Setting this parameter incorrectly can lead to the following error case:
• A page is recognized if the target component is opened when Desktop Agent starts: recognition works
correctly
• A page is not recognized if the target component opens after Desktop Agent has started: refresh fails
The UI Automation connector implements standard control methods described in Controlling Individual
Entities [page 226]. It also provides the following additional features:
Control actions required by scripts are performed synchronously by the UI Automation connector (see
Understanding Asynchronous and Synchronous Processes [page 517]). If necessary, you can change that
using the following methods:
Suppose that you need to refresh a page manually, which takes a long time.
Sample Code
Some technologies make Pages recognition by using polling (UI Automation, SAPGUI, OCR). By default,
recognition is started as soon as the project starts, even if no scenario is running. This allows to:
Polling is then stopped for all the technologies used in the application (UI Automation, SAPGUI, OCR).
In both cases, it is up to the script to restart the polling by calling the startRefreshOnPolling method on
any running Page of the Application.
The UI Automation connector implements standard control methods described in Controlling Individual
Entities [page 226]. It also provides additional features for controlling pages.
If you have declared a page with a RefreshMode to ‘Polling’, the page subtree is periodically refreshed (see Page
Parameters [page 97] ). This refresh is made by polling, so you don’t know exactly when it is done.
If you have to control a set of items on a page of this kind, automatic refresh can slow controlling if it is
performed between control actions.
Example:
Sample Code
// Control Items
MyAppli.MyPage.MyItem1.set('my value1');
MyAppli.MyPage.MyItem2.set('my value2');
...
MyAppli.MyPage.MyItemN.set('my valueN');
If you have declared a page with a RefreshMode to ‘Polling’, the page subtree is periodically refreshed (see Page
Parameters [page 97]). This refresh is performed by polling, which means you don’t know exactly when it is
done.
To be sure that a refresh has been done before control actions are performed, you can force a refresh.
Sample Code
The UI Automation connector implements standard control methods described in Controlling Individual
Entities [page 226]. It also provides additional features for controlling items.
You can also get the value of any other property of the targeted element. To do this, use the following method:
Sample Code
Using the UI Automation connector, complex items such as trees or lists often have a subtree containing their
elements (like in Web).
Note
Very often, a subtree only contains visible elements. The following elements are generally not present in a
subtree:
If you control a complex item by using its subtree, you must manually refresh this subtree after executing
actions which changes the item display (scrolling, expand, and so on).
Example:
Sample Code
If the AutomationId property can't be used, you can set a criterion on the Name property. For multilingual
applications, you can set different values for this criterion, combined with the OR operator (see Criteria
Management [page 269]).
Page is dynamically created and some MustExist Items are not present at load time
When you declare a page that has a RefreshMode parameter equal to 'Window' and a MustExist item, that item
must be recognized when the page opens.
Note
If this MustExist Item is not present at load time, but is dynamically created later, the page will not be
recognized until you have set the 'Pending delay' parameter. For details of setting application parameters,
see Set Application Parameters [page 94] .
In some cases, a COMMAND event tracked on a button doesn't fire when the user clicks it. This is a known
problem due to a default in the implementation of the UI Automation protocol by the controlled application. To
get around this problem, you can tell to the connector to listen to another type of event termed WinEvents.
You must do this explicitly in a script using the listenWinEvents method:
Sample Code
MyAppli.MyPage.listenWinEvents() ;
Most pages target only one screen. To optimize page recognition performance, the UI Automation connector
only searches for the first target of a page. If you need to manage a page that has multiple targets, check its
Multi-instance parameter. For details of page parameters, see Page Parameters [page 97].
Some use cases implies collecting Items value once the Screen closes.
This collection must be executed when receiving the UNLOAD event notification. At this time, targeted
components will have been destroyed, so you can't use controlling to read item values.
The only way to collect this data is to set the Capture Auto parameter on the associated items. This
parameter tells the connector to:
• Collect the value of the component associated with the item every time a technical event is notified (not
only UNLOAD).
• Store this value in the event data.
If there is no technical event to collect an item's value, you can tell the connector to collect data each time a
polling occurs, by setting the page parameter Auto Capture on polling. Please note, however, that this
option is time-consuming, because item recognition is performed on each polling.
Right-Click an Item
Using this connector, you can right-click an item using the actionApp method as follows:
Sample Code
myAppli.myPage.actionApp('RFCTBTNM', 'myItem') ;
The right-click is performed in the center of the item. You can force a right-click at another position relative to
the top-left corner of the item by setting offsetX and offsetY values:
Sample Code
If you need to right-click an indexed item, you can set the desired index as follows:
Sample Code
myAppli.myPage.actionApp('RFCTBTNM', 'myItem[iIndex]') ;
Note
The right-click is a mouse-click, so the controlled Item must be at the foreground to receive the right-
click.
Example:
For indexed items, the Desktop Agent connector targets all the occurrences of the recognized components.
You can then use the appropriate index value in a script to target the desired occurrence.
Example
In a window with a DataGrid, you declare an oCell item to target the cells (Edit) of the Date column, knowing
that the user can change the order of the columns.
Sample Code
oHeader declaration
• DataGrid
◦ Header [occurs]
◾ HeaderItem [occurs] [target]
oCell declaration
• DataGrid
◦ DataItem [occurs]
◾ Edit [occurs] [target]
Sometimes, capturing pages with UI Automation can take a long time, depending on the application. There are
two ways to reduce this delay:
• If it takes a long time before the page you wish to capture is given the focus, uncheck the ShowAll button to
avoid exploring the whole tree
• If the capture itself takes a long time, click the Int button to stop counting and start capturing. You will then
have a partial capture, which may be big enough for the purpose of declaring items
Control Qt Applications
If you have to click a button that opens a modal popup, the MyAppli.MyPage.MyButton.click() method can:
To avoid this, you can perform a mouse-click instead, using the MyAppli.MyPage.MyButton.click(true) method.
Note
From version 3.3 of the SAP GUI connector, this problem is solved by performing asynchronous clicks that
do not lock the connector.
You can disable this mechanism by setting the AsyncElementInvoke setting to false in the
CxUIAProvider.xml file in theconfig subdirectory of Interactive.
You can capture SAP applications with Desktop Agent using the SAP GUI connector.
SAP GUI for Windows is a front-end application that you can use to access SAP applications such as SAP ERP,
SAP Business Suite, and so on. It is designed for the Windows operating system and provides a Windows-like
user experience and integration with other applications based on OLE interfaces or ActiveX controls.
For automation purposes, you need to enable and use the SAP GUI Scripting API. You need to enable
both client [page 120] and server [page 124] scripting. A JavaScript library (SAPScripting.js) is available to
implement specific behaviors.
Note
To use an SAP GUI application in your project, proceed as you would for a native Windows application. Use the
Workflow Designer or apply scripting directly.
Examples
Context
To use SAP GUI for Windows for automation purposes, both client and server scripting must be enabled
1. Launch the Control Panel, choose Appearance and Personalization , and launch SAP GUI configuration.
For some Visual Design options, you can know if SAP GUI Scripting is running by hovering over this icon:
For other options, you can know if SAP GUI Scripting is running by hovering over the following icon:
Context
To use SAP GUI for Windows for automation purposes, server scripting must be enabled.
Procedure
If you get an error message "Exception has been thrown by the target of an invocation", you must set
sapgui/user_scripting_set_readonly to FALSE in transaction RZ11.
Next Steps
Sometimes, following this procedure does not give you enough rights.
In this case, you must open a ticket for another component: BC-FES-GUI.
For more information, see Mode Combination for Server Side Protection in the SAP GUI Scripting Security
Guide.
• Windows technology
• SAP GUI technology
• Web technology
All SAP transactions based on SAP GUI are accessed through the SAPLogon application. This application must
be declared using UI Automation technology, by targeting the SAPLogon window (see Declaring an Application
[page 94]). UI Automation technology lets you declare UI Automation pages, SAP GUI pages, and Web pages.
Once you have declared the SAPLogon application, you need to do the same with the SAPLogon page.
Page criteria are set on the properties of the root component of the targeted screen. They are used by the SAP
GUI connector as follows:
The SAP GUI connector searches the DOM tree to find all DOM components matching the page's criteria.
If a component matches, the connector doesn't search its subtree to find other instances of the page. The
connector creates one instance of the page for each matching component.
You set recognition criteria using Desktop Studio (see Criteria Management [page 269]):
• You can use the following operators on properties of type string: Any, Empty, Full, Part, start-with, end-with,
like.
• You must declare at least one recognition criterion (unless you use Root Item Method [page 284]).
• You can set multiple criteria on the same property, which are then connected by a logical OR.
If the targeted root component has no unique distinguishing properties, you can use one of the following
advanced declaration methods:
Page-Based Events
Page Parameters
Page parameters can be set using Desktop Studio (See Declaring Pages [page 252]).
Auto Capture on polling Indicates (true) to regularly capture values of items declared
in auto capture (see Advanced Use Cases [page 144]).
Subpages Type Indicates whether the page can possess multiple (Multiple)
or single (Single) instances of subpages (see Performance
Optimization for Page Recognition [page 130])
Root Item Indicates the item on the parent page used as the root item,
if any (see Root Item Method [page 284])
For each page, the recognition cost provides the number of components that must be tested in order to
recognize the page. It is the sum of the UI components tested to recognize:
The recognition cost does not give a proper value of the time spent, but a high score (for example, more than
100) indicates pages that are good candidates for optimization.
Before recognizing a page, the SAP GUI connector tries to recognize its preceding sibling pages. So, the actual
recognition cost for a page is its own cost or the cost of its preceding sibling pages, whichever is greater (not
the sum of both, thanks to cache management).
To optimize the recognition time of a specific page, you need to reduce the recognition cost of the page and of
its preceding sibling pages.
Note
If you need to use Items Pattern Method [page 286] to optimize root item recognition, you can use Root
Item Method [page 284].
When you declare a parent page to target a TabControl and subpages to target the TabItems, you know that
only one subpage is present at one time.
You can then set the Subpages type parameter of the parent page to ‘Single’. This way, if one subpage is
recognized, the parent page doesn’t try to recognize the others.
If you have to manage a page that has multiple targets, check its Multi-instance parameter.
Declaring an Item
For general information on declaring items in Desktop Studio, see Declaration of Page Items [page 262].
Once the SAP GUI connector recognizes a UI component as a declared page, it can search the component's
subtree to find each item’s target:
• An item will target the first DOM component that matches its criteria.
• If an item is indexed, it will target all of the DOM components that match its criteria.
Items are usually declared for controlling purposes. You can also use items to aid page recognition by setting
MustExist or MustNotExist parameters.
You set recognition criteria using Desktop Studio (see Criteria Management [page 269] ):
• You can use the following operators: Full, Part, Starts, Ends, like
• You must declare at least one recognition criterion.
• You can use OR to define a combination of criteria on each property.
Type (such as GuiButton or GuiTextField) This criterion is required and automatically set by Desktop
Studio.
LeftLabel Indicates the text of the label associated with the compo
nent.
Deepness Indicates the depth of the component inside the DOM tree.
In some cases, it is not possible to recognize a targeted component merely by setting criteria on its properties.
Another component is recognized by mistake. To ensure your declaration is correct, you can use advanced
recognition methods.
The Items Pattern Method [page 286] is frequently used when declaring items with the SAP GUI connector.
Example
A window contains several DataGrid components, with no unique distinguishing property. You must target
the DataGrid component that has a column header (HeaderItem) Date.
You declare your oTable item using theItems Pattern method as follows:
Sample Code
DataGrid [target]
HeaderItem (Value = 'Date')
The Ancestor Method [page 285] consists in finding an ancestor component of the targeted component
that has unique distinguishing properties. This ancestor component must not be among the ancestors of
components that you do not want to recognize by mistake.
The Ancestor method requires the declaration of an additional technical item. Use it when the Items Pattern
method can't be used. Sometimes, the Ancestor method can be used to avoid the duplication of complex items
pattern declarations.
Example
In a window with several DataGrid components, you have to target the rows (DataItem) of the DataGrid
component which has a column header (HeaderItem) Date.
The DataItem, DataGrid and HeaderItem components are not in a parent-child relationship. That means
you can't declare your oRow item directly using the Items Pattern method. You first have to declare a
technical oTable item which target sthe DataGrid component using the Items Pattern method. You can then
declare the oRow item with the oTable item as its ancestor.
The Labelled By Method [page 285] consists in finding another component that is at a fixed distance (CX, CY)
from the target component and has unique distinguishing properties.
Example
In a window with a DataGrid comprising two columns and two rows, you declare an oCell Item to target the
cells (Edit) of the second column of the DataGrid
To address this use case, you can set a criterion on the Range property, as explained below.
You declare the oCell Item using theItems pattern method. You can then use the Range property to target the
second column.
Sample Code
oCell declaration
DataGrid
DataItem [occurs]
Edit (range=R1= [target]
The Range property is calculated by the SAP GUI connector and indicates the absolute position of the
component within the DOM tree. When the recognition process tests a criterion on the Range property, it
considers the criterion value as relative to the preceding recognized component:
• The component recognized by the parent item if the Items Pattern method is used.
• The component recognized by the ancestor item if the Ancestor method is used.
• The component targeted by the page if none of these methods are used.
When you set a criterion on the Range property, Desktop Studio automatically sets the relative criterion value.
Be aware that this calculation is performed when the criterion is set. If you change the method used (such
as setting the Ancestor) after setting the criterion, the criterion value is not recalculated.
Item Parameters
Must exist If set, the page will be recognized only if the item exists (for
more details, see MustExist Method [page 284] )
Must not exist If set, the page will not be recognized if the item exists (for
more details, see MustNotExist Method [page 284])
Ancestor Name of the ancestor item (for more details, see Ancestor
Method [page 285] )
Capture auto If set, the item value is included in each page-based event
Labeled by Indicates (if not empty) the name of the item that must be
recognized as the label (see Labelled By Method [page 285]
To detect optimization needs in declaring items, you can use the Recognition cost displayed in the Recognition
ToolWindow (see About the Recognition Mechanism [page 276]).
This value is the number of components tested to recognize an item (or the root item of a page). It does not
give an accurate value of the time spent, but a high score (for example, more than 100) indicates items that are
good candidates for optimization.
The first way to optimize item recognition is to limit the search depth.
You do this by setting a criterion on the Deepness property of the targeted component, with the ‘LTOE’
operator. This way, the SAP GUI connector will limit its search to the indicated depth.
Limiting the search depth can greatly improve recognition performance when controlling an application with a
huge DOM. It is good practice to set a criterion on the Deepness property in page or item declarations.
When you set a criterion on the Deepness property, Desktop Studio automatically calculates the right
criterion’s value, relative to the direct recognized ancestor. If you change the direct ancestor after setting
the Deepness criterion, you have to reset (delete+add) the Deepness criterion so it can be recalculated.
This can be done by using Ancestor Method [page 285] or Items Pattern Method [page 286].
Example
You have to declare the oMenuOpen item in the pMain page to target the MenuItem ‘Open’ component:
If you declare it as follows, the recognition will search in the three preceding components (StatusBar, Tab,
ToolBar) before searching in the MenuBar pane, and you get a recognition cost of 135.
Performance Management
Unlike other Desktop Agent connectors, such as Windows and WEB, the SAP GUI connector runs out of
process. That means that it runs within the Desktop Agent process and not within the process of the
application being controlled.
All control is therefore carried out by means of inter-process communication, which is slower than in-process
communication. Most exchanges related to exploring the application's tree during recognition. You can
significantly improve recognition performance by limiting the size of the DOM tree explored:
The SAPLogon main page must be declared. At runtime, as soon as this main page is recognized, a START
event is delivered for the SAPLogon application. The SAP GUI connector then starts collecting the DOM of the
SAPLogon application by polling the SAP GUI component.
Subpage Recognition
The SAP GUI connector implements the concept of subpages (see Declaring a Page [page 243]).
As soon as a page is recognized, the SAP GUI connector tries to recognize each of its subpages. This
recognition is performed in the subtree of the component targeted by the page. That means you need to
take page-subpage relationships into account when declaring pages.
Example:
You need to target an application with a main window that sometimes opens a child window. To control the
child window, you must declare the following pages:
Recognition Refreshment
Page recognition is performed when Desktop Agent starts, and is reexecuted later to refresh the detection of
subpage instances. The SAP GUI connector refreshes detection at each polling time. It is possible to stop this
polling:
Polling is then stopped for all the technologies used in the application (UI Automation, SAPGUI, OCR).
In both cases, it is up to the script to restart the polling by calling the startRefreshOnPolling method on
any running Page of the Application.
The SAP GUI connector implements standard control methods described in Controlling Individual Entities
[page 226]. It also provides additional features for controlling pages.
Extend the Wait Period When the SAP Session is Busy [page 141]
SAP GUI bots enable SAP scripting in order to execute. A polling mechanism is used to recognize SAP
GUI pages that are loaded and unloaded dynamically, and to identify changes in a SAP GUI page. In turn,
continuous polling keeps SAP scripting enabled.
But when bot execution ends, it's necessary to stop polling. Otherwise, the UI will behave strangely to a
user who is controlling it manually. For example, script-friendly file dialog boxes are displayed rather than the
regular, user-friendly ones.
Two methods are provided to explicitly start and stop the polling process, which in turn starts and stops SAP
scripting:
• stopRefreshOnPolling
• startRefreshOnPolling
To stop SAP scripting, call this method on the SAP Logon page, as shown below. You need to
callstopRefreshOnPolling at the end of every workflow.
Sample Code
SAPLogon750.pWindowSAPLogon76.stopRefreshOnPolling()
// Wait until the page loads
SAPLogon750.pageSortOrder.wait(function(ev) {
SAPLogon750.pageSortOrder.setFocus();
SAPLogon750.pageSortOrder.oItem3.click();
sc.endStep(); // end scenario
SAPLogon750.pWindowSAPLogon76.stopRefreshOnPolling();
return;
});
}});
startRefreshOnPolling
If SAP scripting has been stopped using the method stopRefreshOnPolling, you can enable it using
startRefreshOnPolling at the beginning of a workflow. You call the method on the SAP Logon page.
Sample Code
SAPLogon750.pWindowSAPLogon76.startRefreshOnPolling();
// -------------------------------------
// Test menu for scenario oItem2Workflow
// -------------------------------------
GLOBAL.events.START.on(function (ev) {
if (ctx.options.isDebug) [
// Add item in systray menu.
systray.addMenu('', 'oItem2WOrkflow', 'Test.oItem2Workflow', '', function
(ev) {
var rootData = ctx.dataManagers.rootData.create();
SAPLogon750.pWindowSAPLogon76.startRefreshOnPolling();
SAPLogon750.scenarios.oItem2Workflow.start(rootData);
});
}
});
SAP Scripting does not automatically stop if a workflow fails. So you need to explicitly call
stopRefreshOnPolling at any step at which you think a workflow could fail, if SAP scripting should stop
at that point in case of failure.
When the parameter Refresh on polling is unchecked in the Desktop Studio at application level, polling is
disabled by default. This prevents an agent from accessing SAP scripting when the agent starts.
However, refresh on polling needs to be enabled during bot execution in order to detect SAP GUI pages and
items. In the workflow JavaScript file, enable refresh on polling on the SAP Logon page. In the example below,
the page name is pLogon.
Add the following statement immediately after calling the start() method for the SAP GUI application:
SAPLogon760.pSAPLogon.startRefreshOnPolling();
Sample Code
// ---------------------------------------
// Step: stStartSAPLogon
// ---------------------------------------
GLOBAL.step( {
stStartSAPLogon: function (ev, sc, st) {
var rootData_Data = sc.data;
ctx.workflow('DepreciationPostRun', '4c8d6beb-680d-486b-8f7a-
e65d53b4169d');
// Start 'SAP'
SAP.start();
SAP.pLogon.startRefreshOnPolling();
rootData_Data.output.message.push("Scenario started");
sc.endStep(); // stLogon
return ;
}
});
While SAP GUI is waiting for some action to be completed, such as loading a large table or uploading a file, the
status of the SAP GUI server is busy. If you know that the previous automation action might cause the SAP GUI
server to be busy, it is best practice to check its status before sending the next automation action. If it is not
busy, you perform the action. Otherwise, return a 'server is busy' message. To check the current status, you
can use the isSAPGuiBusy method, which is available at page and item level.
Sample Code
loop(SAPLogon750.pTCURRDisplayOfEnt.isSAPGuiBusy()){
ctx.log('SAPGUI is busy");
}
//then the next action
SAPLogon750.pTCURRDisplayOfEnt.oTxt.get();
If your current automation action could make the SAP GUI server busy, wrap the automation action inside an
asynchronous block.
When an action is sent to the SAP GUI, and the SAP session is busy - even for a few milliseconds - it can throw
an error. To overcome this issue, a timer is set for 1000 milliseconds by default whenever an action is sent to
SAP GUI. During this period, the system frequently checks whether the session is busy. If the session becomes
free before the time elapses, execution starts immediately. It is also possible to increase the time period using
the setBusyWaitTime method.
The setBusyWaitTime method should be called in the first step of a workflow so that the same wait time is
used for all of the following steps. You can call the method using any page that is currently loaded. For more
details and a code example, see setBusyWaitTime.
Make sure you call resetBusyWaitTime at the end of the workflow, using the page currently loaded in the
last step. This method resets the wait time to the default value of 1000 milliseconds. For details and a code
example, see resetBusyWaitTime.
Note
In the SAP GUI Connector, the DOM tree is automatically refreshed to recognize the page.
If you have to control a set of items on a page of this kind, automatic refresh can slow controlling if it is
performed between individual control actions.
To avoid this, you can suspend automatic refresh using the following methods:
Example:
Sample Code
// Control Items
MyAppli.MyPage.MyItem1.set('my value1');
MyAppli.MyPage.MyItem2.set('my value2');
...
MyAppli.MyPage.MyItemN.set('my valueN');
To be sure that a refresh has been carried out before control actions are performed, you can force a refresh.
Sample Code
When you are working with the SAP GUI application, you can receive a busy server message.
This issue is caused by subpages. Subpages freeze SAP Scripting and a busy server message appears on your
screen.
• Avoid subpages when you are working with the SAP GUI application.
• Minimize the number of Must Exist / Must not Exist elements in a page.
The SAP GUI connector implements standard control methods described in Controlling Individual Entities
[page 226]. It also provides additional features for controlling items.
You can also get the value of any other property of the targeted element. To do this, use the following method:
Example
Sample Code
Using the SAP GUI connector, complex items such as tables often have a subtree containing their elements
(like in Web).
Be aware that, very often, the subtree only contains visible elements. The following elements are generally not
present in the subtree:
If you control a complex item using its subtree, you must manually refresh this subtree after executing
actions that change the item display (such as scrolling or expanding).
Example:
In a tree, double-click on a TreeItem, children of another TreeItem which is collapsed. You have declared:
If the AutomationId property can't be used, you can set a criterion on the Name property. For multilingual
applications, you can set different values for this criterion, combined with the OR operator (see Criteria
Management [page 269]).
Most pages target only one screen. To optimize page recognition performance, the UI Automation connector
only searches for the first target of a page. If you need to manage a page that has multiple targets, check its
Multi-instance parameter. For details of page parameters, see Page Parameters [page 97].
Some use cases implies collecting Items value once the Screen closes.
This collection must be executed when receiving the UNLOAD event notification. At this time, targeted
components will have been destroyed, so you can't use controlling to read item values.
The only way to collect this data is to set the Capture Auto parameter on the associated items. This
parameter tells the connector to:
• Collect the value of the component associated with the item every time a technical event is notified (not
only UNLOAD).
• Store this value in the event data.
If there is no technical event to collect an item's value, you can tell the connector to collect data each time a
polling occurs, by setting the page parameter Auto Capture on polling. Please note, however, that this
option is time-consuming, because item recognition is performed on each polling.
Right-Click an Item
Using this connector, you can right-click an item using the actionApp method as follows:
Sample Code
myAppli.myPage.actionApp('RFCTBTNM', 'myItem') ;
Sample Code
If you need to right-click an indexed item, you can set the desired index as follows:
Sample Code
myAppli.myPage.actionApp('RFCTBTNM', 'myItem[iIndex]') ;
Note
The right-click is a mouse-click, so the controlled Item must be at the foreground to receive the right-
click.
Example:
Sample Code
It is sometimes impossible to target a component simply by using item declaration. In these cases, you can use
the Occurs method.
For indexed items, the Desktop Agent connector targets all the occurrences of the recognized components.
You can then use the appropriate index value in a script to target the desired occurrence.
Example
In a window with a DataGrid, you declare an oCell item to target the cells (Edit) of the Date column, knowing
that the user can change the order of the columns.
Sample Code
oHeader declaration
• DataGrid
◦ Header [occurs]
◾ HeaderItem [occurs] [target]
oCell declaration
• DataGrid
◦ DataItem [occurs]
◾ Edit [occurs] [target]
To avoid this, you can perform a mouse-click instead, using the MyAppli.MyPage.MyButton.click(true) method.
Note
From version 3.3 of the SAP GUI connector, this problem is solved by performing asynchronous clicks that
do not lock the connector.
You can disable this mechanism by setting the AsyncElementInvoke setting to false in the
CxUIAProvider.xml file in theconfig subdirectory of Interactive.
Solutions for supporting multiple themes where UI components may be present or absent.
In SAPGUI for Windows, some components are added or removed whenever the theme is changed. The GUI
button that is used to start a transaction is one of those components absent from the latest themes.
In the following screenshot (Blue Crystal Theme), the GUI button isn’t available:
If the GUI button responsible for starting the transaction isn’t present, the “Enter” key is used instead.
Case 1: The Page Definition/Criteria Are the Same for Different Themes, but the Available
Components Differ
When a component such as the Enter button may or may not be present on the page, the bot developer can
create If (true), If (else) item-level activities. These check whether the button exists.
Sample Code
Consider the following two images, for example. They show the same window, but in different themes.
Window 2:
Sometimes a change of theme causes a page's definition and components to change completely. In this case,
the bot will probably fail to recognize the page and be unable to continue.
To prevent this kind of failure, create multiple flows of activities based on the condition of a page being timed
out.
You can do this with the Wait Multiple activity. The bot then waits for a page until time out, and if it fails to
recognize the page, it goes on to wait for another specified page.
The GuiCtrlGridView (also known as the GridView or ALV Grid Control) is a dynamic SAP GUI component
comprising a table and optionally, a toolbar. A child of the GUI Shell component, it's included in an SAP GUI
page in its entirety.
Caution
When you create items out of components in a GuiCtrlGridView, make sure that you don't use a
component's type in defining the recognition criteria. If the Type attribute of a component is used as
the recognition criterion by itself or in combination with another attribute, recognition of the item fails at
runtime.
Where there are multiple items with the same captured data that only differ in their Type attributes, you
must use a pattern such as a parent-child relationship for recognition instead of using Type.
The toolbar provides buttons used to perform actions on the table. The button types are as follows:
The table contains rows of data with dynamic columns that can be rearranged, removed, or hidden.
Activities
Activities are provided in the Workflow Designer under the SAP GUI category to automate GridView controls.
The available activities are as follows:
Click • GuiGridViewButton
• GuiGridViewButto
nAndMenu
• GuiGridViewCheck
Box
• GuiGridViewGroup
Select Click a • GuiGridViewButto Item - ID of the control that provides a list of menu items
toolbar menu nAndMenu
menu item item from Menu item's text
• GuiGridViewMenu
by text a drop-
down list.
Select Click a • GuiGridViewButto Item - ID of the control that provides a list of menu items
toolbar menu nAndMenu
menu item item from Menu item's position in the list (0 indicates the first item)
• GuiGridViewMenu
by position a drop-
down list
Select Click a • GuiGridViewButto Item - ID of the control that provides a list of menu items
toolbar menu nAndMenu
menu item item from Menu item's ID (string). The ID of a menu item.
• GuiGridViewMenu
by ID a drop-
down list
The following activities relate to the data rows, columns, and cells of the table (pane):
Note
You must
use a
Select
Cell or
Select
Row ac
tivity to
select a
cell or
row be
fore us
ing this
activity,
SelectCo
ntextMen
uItemBy
Text
If the SEPARATOR is ignored while counting, the menu item selection will be incorrect
Note
or fail to work.
You must
use a
Select
Cell or
Select
Row ac
tivity to
select a
cell or
row be
fore us
ing this
activity,
SelectCo
ntextMen
uItemBy
Position
You must Record only the step of selecting the required menu item from the context menu.
use a
The generated VB script will have a selectContextMenuIte call with the ID next to it.
Select
Cell or
Select
Row ac
tivity to
select a
cell or
row be
fore us
ing this
activity,
SelectCo
ntextMen
uItemByI
D
The GuiToolbar is an SAP GUI component that's included in an SAP GUI page in its entirety. The children of a
GuiToolbar are buttons.
Caution
When you create items out of components present within a GuiToolbar, make sure that you don't use
a component's type in defining the recognition criteria. If the Type attribute of a component is used as
the recognition criterion by itself or in combination with another attribute, recognition of the item fails at
runtime.
Where there are multiple items with the same captured data that only differ in their Type attributes, you
must use a pattern such as a parent-child relationship for recognition instead of using Type.
Activities to automate GuiToolbar controls are provided in the Workflow Designer under the SAP GUI category
GuiGridView. The available activities are as follows:
Click • GuiToolbarButton
• GuiToolbarButtonAn
dMenu
• GuiToolbarCheckBo
x
• GuiToolbarGroup
Select Click a • GuiToolbarButtonAn Item - ID of the control that provides a list of menu items
toolbar menu dMenu
menu item item from Menu item's text
• GuiiToolbarMenu
by text a drop-
down list
Select Click a • GuiToolbarButtonAn Item - ID of the control that provides a list of menu items
toolbar menu dMenu
menu item item from Menu item's position in the list (where 0 indicates the first
• GuiiToolbarMenu
item)
by position a drop-
down list
Select Click on a • GuiToolbarButtonAn Item - ID of the control that provides a list of menu items
toolbar menu dMenu
menu item item from Menu item's ID - can be fetched using record and playback
• GuiToolbarMenu
by technical a drop-
ID down list
Related Information
Scrolling is used with a GuiTableControl to overcome the problem that data is only retrieved from the visible
area of the table.
The GuiTableControl is an SAP GUI component. With Intelligent RPA, data is retrieved from this component
column-wise with the help of the Occurs attribute. When this attribute is checked in the Criteria pane, data is
retrieved in one operation from all table cells that match the criteria.
The vertical scroll bar provided for a GuiTableControl works as follows: The number of possible scroll-bar
positions is equivalent to the number of nonempty rows in the table. So, assuming the table contains five rows
of data, one row disappears on each scroll down.
Even when all nonempty rows are visible, SAP GUI still provides a scrolling function that scrolls one row at a
time.
In the following example, there are only two rows of data and the number of possible positions is also two
(positions 0 and 1). The maximum scroll offset is 1.
Before Scrolling:
scrollDownByOneRow Scrolls down one row at a Application.oPage.o True if scrolled, else false
time and a new row appears GuiTableCtrlCell.Sc
in the lower part of the table.
rollDownByOneRow();
scrollUpByOneRow Scrolls back up one row at a Application.oPage.o True if scrolled, else false
time. GuiTableCtrlCell.Sc
rollUpByOneRow();
scrollToPosition Scrolls to the exact scrollbar Application.oPage.o True if successful, else false
position provided by the bot GuiTableCtrlCell.Sc
developer.
rollToPosition(1);
Parameter: integer (0 to
ScrollMaximum)
This section provides the best practices for a faster execution of captured SAP applications using the SAP GUI
connector.
Faster Recognition
• Add only Id (full) as criteria for an item if Id is stable (not applicable for a page).
• Add only Name (full) as criteria for an item if Name is stable and if Id is not available for the item (not
applicable for a page).
• Use only Name (full) as criteria for an occurs item if the Name property is available. Commonly used for
GuiTableControl cells.
• Use only one unique Must Exist Item of each page for recognition if two or more pages have the same
criteria. Try avoiding the usage of Must not Exist item for this use case as it may slow the loading of the
page.
Example:
Here two pages pReportResult and pEmptyResult have the same criteria.
To uniquely identify the two pages, an item which is unique to each page is added as a Must Exist Item.
Here oTree is unique to the page pReportResult and oNoData is unique to the page pEmptyResult.
• Do not declare a Must Exist/Must not Exist item on a page unnecessarily if you do not have the above use
case.
• Avoid declaring subpages when using the SAP GUI connector.
• Make sure to enclose your statements within lock and unlock refresh calls as seen in Suspend Automatic
Refresh [page 141] for the following scenarios:
• While performing set/get operations on an occurs item.
• When executing a set of statements on a page where items remain constant.
• Use only item level wait block if required. Do not do an exitance check of an item and perform an operation.
• Do
selected()
Sample Code
SAPLogon760.pEDocumentCockpit.oSAPTableTreeControl.selected();
3. To click on the link: the first parameter contains the value find above, the second parameter contains the
index of the column.
Sample Code
SAPLogon760.pEDocumentCockpit.oSAPTableTreeControl.clickNodeItemLink("
2",0);
• Enable the Show keys within dropdown lists option from the Interaction Design dropdown list for the
design time. For more information, see https://blogs.sap.com/2017/08/14/sap-gui-options-show-keys-
within-dropdown-lists/ .
• Create the item of the GuiCombox. Select the option you need the key for. Run the debugger and do get()
call on the GuiComboBox item to get the key of the selected option.
• Use the Script Recording and Playback of SAP GUI.
• Use the GetListmethod:
SAPUI5 is an extension of the Web connector. It's a framework that includes a collection of libraries you can use
to build applications which run in a desktop or mobile browser – while only maintaining one code base. SAP
S/4HANA offers multiple business applications built on the SAP HANA in-memory platform.
Declaring Entities
Entities are declared as described in the same way as for standard Web applications. For details, see Declaring
Entities Using the Web Connector [page 71].
The SAPUI5 framework provides standard methods for controlling standard components (see Controlling
Entities Using the Web Connector [page 78]). But it also provides a wide range of specific methods for
controlling custom SAPUI5 controls. The following custom controls and activities are currently supported:
Control Activity
ActionSelect Open
Carousel Next
Previous
Add Item
FeedContent Press
Menu Open
Get Items
Add Item
Table Data
Row Count
Row Data
Select All
Select Row
Add Debit
Get Credit
Get Debit
TreeGrid Expand
Check
UnCheck
The UI5 controls listed below are supported by Desktop SDK methods (see also SAPUI5 Application
Management ):
• ActionSelect
• Button (methods also used for Link, Breadcrumbs, and URL Helper)
• CheckBox
• ComboBox
• DatePicker
• FeedContent
• FeedInput - a control that combines an input field with a button that's not enabled until there's an entry in
the input field
Example:
Related Information
1. Start Desktop Studio and in the menu bar select File New Project... .
6. In the Capture Application window, select the SAPUI5 or S/4HANA page you previously opened in your web
browser. Click Save.
A new object is added to your project.
Tip
Open the Editor perspective and check that the SAPUI5 library is included in the Framework of the
script tree tool window.
9. Go to the SAPUI5 or S/4HANA page opened in your browser, and press Ctrl . A red rectangle appears
meaning that the page is now selected.
11. In the Captured data window, select the URL and then click the plus icon (+) in the criteria window.
12. The page is now ready for you to add UI objects. In the capture panel, click the object you want to add. In
this example, we'll add a radio button.
Every UI element (object) you add must be associated with a SAP UI custom type.
13. Go to the Subtree tool window and select the input corresponding to the UI object you want to add.
Related Information
A feature of SAPUI5 is that a control can have a busy state that's different from that of the page. A page can be
loaded although some controls are still loading.
To handle this behavior, you can use the waitReady method in your scripts. This method checks the state of
all controls on a page. The page is not ready until all controls are ready.
Whether you should use waitReady or the wait method depends on your use case:
• If your bot enters a text in a search field and then clicks Search, it is possible that only the area where the
search results are displayed will load. That depends on how the SAPUI5 page in question is implemented.
So for this kind of use case you should use waitReady to be on the safe side.
• If your bot fills out a form on the SAPUI5 page and then clicks Submit to navigate to the next page, for
example, you can use the wait method.
Related Information
waitReady
You can apply the type SAPUI5.ToggleButton to buttons on an SAPUI5 interface. This type takes into
account the state of the button (pressed or unpressed), so that different methods can be called accordingly.
Sample Code
SAPUI5SDKDemoKit.pSAPUI5SDKDemoKit.oToggleButton.click()
You can apply the type SAPUI5.tablerowclick to handle clickable rows on an SAPUI5 interface.
ProjectControl.pageofTableRow.objectofTableRow.index(5).click()
With the SAPUI5 connector, the contents of tables or table rows can be captured using convenient methods
provided by the SAP Intelligent Robotic Process Automation Desktop SDK.
Example Table
Methods
The following SAP Intelligent Robotic Process Automation Desktop SDK methods are provided for use with
SAPUI5 tables (see SAPUI5.table):
• getTableData
• getRowCount
• getRowDatabyIndex
If lazy loading is enabled for the table, getTableData will return only the rows of data initially fetched from
the client side.
For details of the entities to define, see Entities for a Desktop Application [page 247]
Note
If you need to control Web pages embedded in a Desktop application, you must define page entities for
each Web page you need to control, as if they were regular pages of the application.
Application-Based Events
Page-Based Events
Related Information
• You can use the following operators on the EXE property: Full, Part, Empty, No.
• You must set a criterion on the EXE property (process name of the application), using the Full operator.
Note
This criterion on the EXE property is set automatically when you declare a Win32 application.
One instance per thread If true, tells the connector to manage an instance of applica
tion by thread. Do not use unless this is a specific require
ment.
Use V2 Set false to use the old version of Win32 connector. Do not
use unless this is a specific requirement.
For general information on declaring an application in Desktop Studio, see Declaring Applications [page 249].
Page criteria are set on the properties of the root component of the targeted screen. They are used by the
Win32 connector as follows:
The Win32 connector searches the DOM tree to find all DOM components that match the page's criteria.
If a component matches, the connector doesn't search its subtree to find other instances of the page. The
connector creates one instance of the page for each matching component.
You set recognition criteria using Desktop Studio (see Criteria Management [page 269]):
• NAME: if present and unique, this property is usually set by developers and does not change (WinForms
application only)t
• IDENT: If unique and not auto-generated, this property is usually set by developers and does not change
(Win32 application only)
• TITRE: Title or text
• CLASS: Classname (Win32 only)
• STYLE: Setting a criteria on this property with the WS_VISIBLE value can be useful to declare TabItems of a
TabControl as a page. If you do this, a page of this type will only be recognized if the TabItem is visible.
IDENT Window ID
CLASS Classname
CX Width
CY Height
If the targeted root component has no unique, distinguishing properties, you can use MustExist Method [page
284], which is an advanced declaration method.
Page-Based Events
The Win32 connector can also notify the following technical events:
Page Parameters
Page parameters can be set using Desktop Studio (see Declaring Pages [page 252]).
Windowless container Indicates (true) that the page will contain windowless pages
For general information on declaring a page in Desktop Studio, see Declaring Pages [page 252].
Once the Win32 connector recognizes a Win32 component as a declared page, it can search the component's
subtree to find each item’s target:
• An item will target the first DOM component that matches its criteria.
• The Win32 connector does not manage multiple items.
Items are usually declared for controlling purposes. You can also use items to aid page recognition, by setting
MustExist parameters.
You set recognition criteria using Desktop Studio (see Criteria Management [page 269] ):
• You can use the following operators: Full, Part, No for textual properties (No means "not equal")
• Equal for numeric properties
• You cannot use OR to define a combination of criteria
The complete list of available properties is the same as for setting page criteria (see Available Properties for
Page Criteria [page 177]).
In some cases, it is not possible to recognize a targeted component merely by setting criteria on its properties.
Another component is recognized by mistake. To ensure your declaration is correct, you can use advanced
recognition methods.
The Ancestor Method [page 285] involves finding, among the targeted component's ancestors, an ancestor
component that has unique, distinguishing properties. This ancestor component must not be among the
ancestors of the wrongly recognized component.
The target component will be searched for among the descendents of the ancestor component.
Example
A window has two groupboxes with a label in each one. The labels have the same text, but the groupboxes
have different titles. You need to target the first label.
Sample Code
• Groupbox1
◦ Label
• Groupbox2
◦ Label
You must first declare a technical item oGroupbox1 that targets the first groupbox component. You can then
declare the oLabel item with the oGroupbox1 item as its ancestor.
This component is typically a label component lying near the target component. But it can be any other
component in any position on the screen.
Desktop Studio stores as a criterion the distance between the targeted component and the label component.
This distance is calculated in a unit that does not depend on the screen resolution.
The software will search for the target component among the components located at this stored distance from
the label component.
Example
In a window that has three EntryField with no unique, distinguishing properties, you declare an oEdit item to
target the second one.
Sample Code
Window
◦ EntryField
◦ EntryField ←
◦ EntryField
To address this use case, you can set a criterion on the ROW property. This property indicates the position of
the component within the DOM tree.
You declare the oEdit Item using the ROW property to target the second EntryField.
Sample Code
oEdit declaration
• EntryField (ROW=R2)
Sample Code
Window
◦ EntryField (ROW=R1)
◦ EntryField (ROW=R2) → oEdit
◦ EntryField (ROW=R3)
The captured ROW property is the absolute position of the component within the DOM tree. When you
set a criterion on the ROW property, Desktop Studio automatically calculates the criterion value to be
relative to the component targeted by the page.
Item-Based Events
Item-based events must be explicitly tracked in order to be notified. The Win32 connector implements the
following standard technical events:
SETFOCUS Fired when the component has gained the input focus
KILLFOCUS Fired when the component has lost the input focus
Item Parameters
Must exist If set, the page will be recognized only if the item exists (for
more details, see MustExist Method [page 284] )
Ancestor Name of the ancestor item (for more details, see Ancestor
Method [page 285] )
Capture auto If set, the item value is included in each page-based event
Labelled by Indicates (if not empty) the name of the item that must be
recognized as the label (see Labelled By Method [page 285]
TypObj Indicates the way the connector must control the item (see
Controlling an Item Using the Win32 Connector [page 186])
The following advanced recognition methods can be used with the Win32 Connector:
Please note that the order in which pages are declared is significant. For more information, see Order of
Declared Pages [page 286]
Subpages
For information on subpages and when to use them, see Subpages [page 248]
The Win32 connector listens to the desktop to detect the opening of root UI components (children of the
desktop).
• It looks for the first declared Win32 application whose criteria match.
• If it finds one, it looks for the first declared root page whose criteria match. If a corresponding root page
is found, the connector associates the new root UI component with that root page, and a LOAD event
notification is issued for the page.
Note
You must declare a root page entity to control an application's main window.
Subpage Recognition
The Win32 connector implements the concept of subpages (see Declaring a Page [page 243]).
As soon as a page is recognized, the Win32 connector tries to recognize each of its subpages. This recognition
is performed in the subtree of the component targeted by the page. That means you must pay attention to the
page-subpage relationship when declaring pages.
Example:
You need to target an application with a main window that sometimes opens a child window. To control the
child window, you will have to declare the following pages:
The Win32 connector implements the standard control methods described in Controlling an Application [page
234]. It does not provide any additional features for controlling applications beyond these standard methods.
The Web connector implements the standard control methods described in Controlling a Page [page 232]. It
also provides additional features for controlling pages.
You can easily integrate these UI elements directly inside the controlled page.
To insert a component into a Windows page content, use the following methods:
Once injected, the components are present in the DOM and can be controlled like other components.
Note
The injected components cannot be stylized. They look like basic system components
The Win32 connector implements the standard control methods described in Controlling Individual Entities
[page 226]. To know how to control an item, the Win32 connector uses its TypObj parameter.
The TypObj parameter indicates to the Win32 connector the kind of the targeted component and the way to
control it.
When you declare an item, Desktop Studio automatically calculates the TypObj parameter based on the
ControlType of the targeted component.
If necessary, you can change it by choosing from a list of available TypObj values for that ControlType. This
allows you to:
To control complex items such as trees or lists, you must set the TypObj parameter to the correct value. You
then control complex items in the standard way (see Controlling Individual Entities [page 226]).
For details of the entities to define, see Entities for a Desktop Application [page 247]
Note
If you need to control Web pages embedded in a Desktop application, you must define page entities for
each Web page you need to control, as if they were regular pages of the application.
Application-Based Events
Note
The Start event is not fired when the application starts, but when the first recognized page is loaded.
Page-Based Events
Related Information
Context
Using the Java Connector, make sure that the debugger has been launched and that the correct EXE of the
application has been recognized.
Procedure
The CLASSWIN criterion is useful when the Java application contains a loading screen. If this criterion is
not set, the application may be not recognized during the runtime.
Note
If you only use EXE without using CLASSWIN as one of the criteria , it may not work during runtime. If
you only use EXE as a criterion and if the debugger is not launched before the application, it will not
be recognized. However, if you use CLASSWIN and EXE as criteria, the application can be recognized
whether or not the debugger is launched before the application.
Make sure that you see the load of an _Undefined_ page in the Events tab of the debugger. If you don’t see
this, the following steps will not work.
Next Steps
If the previous steps do not work, capture the application as a Java Applet (a Java application that is displayed
in a browser).
• You can use the following operators on properties of type string: Full, Part, like.
• You must set a criterion on thejava.exe or javaw.exe property using the Full operator.
Note
This criterion on the exe property is set automatically when you declare a Java application.
• You must set a criterion on the classwin property. It enables the detection of a Java application if this
application contains a loading screen.
For general information on declaring an application in Desktop Studio, see Declaring Applications [page 249].
Note
For Java applications, you must capture pages while running the project. Indeed, you need to capture the
application itself first, then run the project with this application before capturing the pages. This is related
to the way the Java connector works as it needs to connect to the application first. Only then, the pages will
be visible in the capturing tool.
Page criteria are set on the properties of the root component of the targeted screen. They are used by the Java
connector as follows:
The Java connector searches the DOM tree to find all DOM components that match the page's criteria. If
a component matches, the connector doesn't search its subtree to find other instances of the page. The
connector creates one instance of the page for each matching component.
You set recognition criteria using Desktop Studio (see Criteria Management [page 269]):
Properties
CLASS Classname
If the targeted root component has no unique distinguishing properties, you can use the MustExist Method
[page 284], an advanced declaration method.
Page-Based Events
The Java connector can also notify the following technical events:
Once the Java connector recognizes a Java component as a declared page, it can search the component's
subtree to find each item’s target:
• An item will target the first DOM component that matches its criteria
• The Java connector does not manage multiple items.
Items are usually declared for controlling purposes. You can also use items to aid page recognition, by setting
MustExist parameters.
You set recognition criteria using Desktop Studio (see Criteria Management [page 269] ):
• You can use the following operators: Full, Part, like - the Like property value must match the criterion value
considered as a regexp
• You must declare at least one recognition criterion
• You cannot use OR to define a combination of criteria
Properties
In some cases, it is not possible to recognize a targeted component merely by setting criteria on its properties.
Another component is recognized by mistake. To ensure your declaration is correct, you can use one of the
following recognition methods.
Example
In a page that has four PPanel items with no unique distinguishing properties, you declare an item to target
the second one.
Sample Code
• pTransactionSearch (Page)
◦ JRootPane
▪ JPanel
▪ JLayeredPane
▪ JPanel
▪ ContextProviderFinderForm
▪ PPanel
▪ PPanel ←
▪ PPanel
▪ PPanel
To address this use case, you can set a criterion on the RANG property. This property indicates the position
of the component within the DOM tree.
Example
You declare the oPPanel item using the RANG property to target the second PPanel.
Sample Code
oPPanel declaration
• oPPanel (RANG=R1R2R1R1R2)
Sample Code
• pTransactionSearch (Page)
Note
The captured RANG property is the absolute position of the component within the DOM tree. When you
set a criterion on the RANG property, Desktop Studio automatically calculates the criterion value to be
relative to the component targeted by the page.
Item-based events must be explicitly tracked in order to be notified. The Java connector implements the
following standard technical events:
SETFOCUS Fired when the component has gained the input focus
KILLFOCUS Fired when the component has lost the input focus
Note
• MOUSE and DBLCLK are exclusive, which means that if both TRACK_EVENT are performed for the same
item, then only the latter is considered
• ENTER and KEY are exclusive, which means that if both TRACK_EVENT are performed for the same
item, then only the latter is considered
JList Action (Enter) on a line of the list The (first) selected line
JList Action (DblClick) on a line of the list The (first) selected line
Meaning Data
Item Parameters
Must exist If set, the page will be recognized only if the item exists (see
MustExist Method [page 284])
Capture auto If set, the item value is included in each page-based event
TypObj Indicates the way the connector must control the item Con
trolling an Item Using the Java Connector [page 202]
The following advanced recognition methods can be used with the Java connector:
Please note that the order in which pages are declared is significant. For more information, see Order of
Declared Pages [page 286]
Subpages
For information on subpages and when to use them, see Subpages [page 248]
The Java connector listens to the desktop to detect the opening of root Java components (children of the
desktop).
• It looks for the first declared Java application whose criteria match.
• If it finds one, it looks for the first declared root page whose criteria match. If a corresponding root page
is found, the connector associates the new root Java component with that root page, and a LOAD event
notification is issued for the page.
• Otherwise, it ignores the root Java component.
Note
You must declare a root page entity to control an application's main window.
In addition, the Java connector can only control Java applications running on a 32 bit Java JRE.
Subpage Recognition
The Java connector implements the concept of subpages (see Declaring a Page [page 243]).
Java subpages can be created from the main page components (see Capture a Subpage [page 256]).
As soon as a page is recognized, the Java connector tries to recognize each of its subpages. This recognition
is performed in the subtree of the component targeted by the page. That means you must pay attention to the
page-subpage relationship when declaring pages.
You need to target an application with a main window that sometimes opens a child window. To control the
child window, you will have to declare the following pages:
The Java connector implements the standard control methods described in Controlling an Application [page
234].
For Java Oracle Forms applications, a special custom class to be developed by the SAP Intelligent RPA R&D
team must be integrated into the specific project. For classical Java applications, the Java connector doesn't
provide additional features for controlling applications beyond the standard control methods.
The Java connector implements the standard control methods described in Controlling a Page [page 232]. It
also provides additional features for controlling pages.
The Java connector allows you to enrich the content of a controlled Windows page. This requires a custom
class.
The Java Connector directly includes these Java elements in the controlled page. Once included, the
components are present in the DOM and can be controlled like any other component.
The Java connector implements the standard control methods described in Controlling Individual Entities
[page 226]. To know how to control an item, the Java connector uses its TypObj parameter.
To control complex items such as trees or lists, you must set the right value for the TypObj parameter. You
then control complex items in the standard way (see Controlling Individual Entities [page 226]).
HLLAPI is an IBM API that enables communication with mainframe computers using applications such as
AS400, 3270, 5250, and terminal emulators.
A mainframe application is any application running in a terminal emulator which implements the HLLAPI
monitoring protocol.
• A parameter file containing a set of application parameter (such as working environment, key mapping, or
coloring scheme)
It is sometime possible to generate a parameter file by modifying parameters in settings of the application.
Parameter file extensions vary depending on the emulator application.
• An optional workspace (generally the URL of the executable)
To be able to control mainframe application, Desktop Agent will need to actively connect to it by opening a
channel to it.
• A channel is set with a specific session ID and is linked via a parameter file
• A channel can be set in most emulator application settings
• Multiple session may coexist, but Desktop Agent is not able to connect to two channels at the same time.
• If users open multiple emulators, you may have to manage multiple instances of the software, but only of
the pilwin/UI Automation application wrapping the mainframe screens.
Note
• A mainframe application running in a Web terminal emulator (for example Crysalid or z/Scope
Anywhere) must be regarded as a Web application (see Controlling an Application Using the Web
Connector [page 78]).
Definitions
For a mainframe application:
• You define the application entity as the HLLAPI session that provides access to the mainframe application.
• You define a page entity for each screen of the application which you need to control. If necessary, you can
define generic page entities to represent multiple screens of the application.
• You define an item entity for every screen zone that you need to control.
Application Recognition
For the HLLAPI to be recognized, a connection first has to be actively established to it via the session ID.
Note
• Until a connection is established by means of the HLLAPI monitoring protocol, Desktop Agent will not
be able to control the application.
• Although the application may have been captured while under a specific session ID ('A', for instance),
the application will still be recognized using other session ids.
Page Recognition
This is the algorithm applied for page recognition:
• it looks for the first declared HLLAPI application whose criteria match
• if it finds one, it looks for the first declared page of the application whose criteria match
• if it finds one, it associates the new HLLAPI screen with this page and notifies a load event for the
page.
• Otherwise, if it’s a mainframe, it associates it with the generic _Undefined_ Page and notifies a load
event for this page.
• in all cases, it continuously controls the HLLAPI screen.
• Otherwise, it ignores the HLLAPI screen.
For each HLLAPI screen being controlled, the HLLAPI connector regularly checks whether the HLLAPI screen
still matches the application criteria:
• If not, it notifies an UNLOAD event for the associated page (if any) and releases control of the HLLAPI
screen.
• If it still matches:
• If the HLLAPA screen is still associated with an HLLAPI page, the connector checks whether the
HLLAPI screen still matches the page criteria. If not, it notifies an unload event for the associated
page.
Related Information
Declaring an Application
During capture, only the opened channels (indicated by their session ID) will be displayed and selectable.
For general information on declaring an application in Desktop Studio, see Declaring Applications [page 249].
There are no criteria to be set on applications using Desktop Studio (see Criteria Management [page 269]).
App page name When declaring an HLLAPI Application, Desktop Studio cre
ates a technical page, whose name can be modified. This
technical page is used to connect to an application session.
Declaring a Page
• No criteria are set for a page, as they are usually all the same throughout the application, which makes
it impossible to differentiate between them based only on such criteria.
• Screens occasionally have more rows and columns, or fewer.
Therefore, to be able to differentiate between pages, you must use the Must Exist method.
Page-Based Events
A declared page automatically receives the following technical events:
Declaring an Item
X Column position
Y Row position
CX Field size
• Always exist
• Always have the size declared (CX propertz)
You set recognition criteria using Desktop Studio (see Criteria Management [page 269] ):
• You can use the following operators on properties of type string: Full, Part, Empty, No.
• You can set multiple criteria on the same property, which are then connected by a logical OR.
• You must declare at least one recognition criterion.
Example
• EQ(X) = 11
• EQ(Y) = 9
• EQ(CX9 = 4
The Labelled By method (for details, see Labelled By Method [page 285]).
If you need to recognize an array in a screen, it may be useful to use the Occurs method. For multiple items,
the Desktop Agent connector targets all the occurrences of the recognized components. You can then use the
appropriate index value via a script to target the desired occurrence.
Occurs indicates the number of multiple elements beside the initial element. If Occurs is set at 8, then there
will be 9 elements.
Inc X and Inc Y respectively indicate the offset between columns and rows. If Inc X is set at 1 and Inc Y is
set at 0 then the multiple items will be side by side in a horizontal direction
• Occurs = 8
• Inc X = 0
• Inc Y = 1
• Occurs = 11
• Inc X = 2
• Inc Y = 0
These parameters allow you to catch a vertical array of 12 elements; each element is one column away from the
next.
• Occurs = 3
• Inc X = 2
• Inc Y = 2
Using a non-zero value for both Inc X and Inc Y will lead to a different (and generally unintended) type of
array recognition.
Must exist If set, the page will be recognized only if the item exists (for
more details, see MustExist Method [page 284] )
Labelled by Indicates (if not empty) the name of the item that must be
recognized as the label (see Labelled By Method [page 285]
Capture auto If set, the item value is included in each page-based event
Item-Based Events
Unlike most other connectors, the HLLAPI connector does not provide any technical events on items.
Related Information
The HLLAPI connector implements the standard control methods described in Controlling an Application
[page 234].
Note
Before you begin, agree with the customer what session ID will be used for automation.
Note
With the HLLAPI connector, the application does not need to be topmost to receive keystrokes. That means
it is possible for the screen to be locked while interacting with the application.
Note
With the HLLAPI connector, items will always exist as they have been declared using screen coordinates.
Related Information
Connection
Sample Code
In some cases, the terminal emulator will ask for credentials to access to the mainframe screen:
Sample Code
Once connected, START/END events of a mainframe application and page LOAD events will be cached, as well
as any other HLLAPI technical event.
Internationalization
The application screen for different languages is often very similar and items stay the same size.
The Must Exist item can be used to recognize page in different languages, by applying the like operator on it
and listing possible text parts.
Item criteria:
• EQ(X) = 2
• EQ(Y) = 1
• EQ(CX) = 8
• like(TEXT) = Home|Accueil
Desktop Agent always tries to recognize the first page that matches its criterion.
With HLLAPI, pages are usually recognized via MustExist items, and more specifically, their TEXT criteria.
• The pMain page under the popup could be recognized up to an item screen test (in orange)
• The pPopup page could be recognized up to an item popup title (in gray)
To be seen in the page hierarchy, the pPopup page must be above pMain.
Otherwise, pMain will be always found, and pPopup won't be found – whether or not pPopup is displayed.
You need to set focus on the targeted item before invoking the keystroke on the page.
Sample Code
Unlike the keystroke method, the set method directly focuses on the item before setting its value.
It is possible to send command sequences using constants and keystrokes. But remember that mainframe
applications have their own send key mapping, and constants (here e.key.Erase) may not be usable on every
mainframe.
Sample Code
Use of Mnemonics
In general, the @ key is a special character used for mnemonic sequences, which means that writing an email
could be problematic. For instance, in some mainframe applications, @C will clear the focused item. To be able
to set/keystroke an @ character, it may be necessary to escape it using another @ character.
Sample Code
MYAPPLICATION.pMyPage.oMyItem.set('myEmail@@sap.com');
Navigating between two screens is often accomplished by validating the first one. This is generally done using
the Enter key.
Sample Code
Once declared, all objects will exist. There are no technical events.
Sample Code
Image recognition and OCR are used to automate user interfaces whose underlying technology (including
the document object model, or DOM) isn’t accessible at design time or runtime. This technique is known as
surface automation.
Surface automation automates interactions with a user interface by means of visual elements such as labels,
controls, images, and icons rather than DOM elements or applicationspecific APIs. Typical use cases for
surface automation with the OCR connector:
• The application you want to automate is running in a virtual desktop or a Citrix environment and you’re not
permitted to install the Desktop Agent there.
• The application you want to automate can't be automated using any of the other technology connectors
supported by SAP Intelligent RPA, such as the Web connector or the Java connector. Flash applications
are one example. Another example are legacy applications for which native automation technologies don’t
exist or are very niche.
• Your automation use case requires the recognition of an image such as an icon.
1. Open the Desktop Studio and create a new project. For details, see Create a Project [page 63].
2. In the Explorer perspective, open the context menu and choose Add a New Application ...:
• Select UI Automation in the Choose Technology field.
• Select the application from the list (in this case, CRM - WinForm). It’s then shown in the preview so that
you can check whether it’s the right one.
• Click Select.
• Return to the Explorer perspective and enter the application name and location in the Parameters tool
window.
Click Save.
3. Capture a page:
• Double-click in the new Page box.
• Hover the cursor over the page to be captured while holding down the Ctrl key.
• Name the page 'pMain'.
• Click the Scan and Capture button.
4. In the Captured data pane, double-click Name and ControlType to set them as recognition criteria for this
page.
5. For this use case, we control Tab 1 of the CRM - WinForm application, so associate Tab - Tab1 in thePage
tree to a new item.
6. Rename it 'oOCRRootItem'.
7. Set AutomationId and Deepness as recognition criteria by double-clicking them in the Captured data
pane.
8. Now, create a subpage using OCR:
• Right-click the 'pMain' page to add a subpage with OCR technology.
• Highlight Tab 1 - hover the cursor over the page while holding down the Ctrl key.
Tip
Make sure that these two Capture Page windows don't overlap with the application during capture.
• Now, create an item for the Search button in the same way as for the ReferenceID input field. In the
Criteria pane, keep only the Text property.
12. Create a subpage with data:
• Open the CRM WinForm application, enter 2 in the Reference ID field, and click Search.
• To capture the CRM WinForm with data, create another subpage. In the Explorer view, right-click
'pOCRContainer' and select Add Subpage.
• Once the Add Capture dialog appears, capture the screen. Enter the name 'pTab1PageWithData' and
click Scan and Capture.
• Double-click the field label Lastname. Lastname is shown in the Explorer view under
'pTab1PageWithData'.
• Identify the Lastname input field using OCR. Select the image selector around the Lastname input
field.
• Do the same for the Firstname label and input field.
• In the Parameters pane, set the Labelled by parameter for both the Firstname and Lastname input
fields.
13. Create the workflow:
• Navigate to the Workflow tab, select 'CRMWinForm', and click Create New Workflow. Enter the name
'readCRMWinForm'.
• Open the workflow. In the Activities view, select the Activities tab.
• Go to Application, select Start, and drag it under the Start box.
• From the Pages tab, drag and drop the page 'pTab1PageWithData' under Start 'pTab1Page'.
• Double-click the page 'pTab1PageWithData' and add Get actions for the Firstname and Lastname input
fields.
• From Activities Activities Popup , select MsgBox and drop it under the page
'pTab1PageWithData'.
• Add the following in the Properties pane:
Template matching makes it possible to detect any pre-selected pattern on a user interface, including non-
textual areas, regardless of the target location. A typical example is buttons with icons but no text. Template
zones are helpful in detecting patterns on user interfaces with fluid layouts, where the positions of controls
keep changing and the Labelled by property can't be used.
A template is treated like any other item and you can perform actions on it, such as clicking.
When you have defined a template, a pixel-to-pixel comparison between the template and the application’s
screenshot is performed at run time. The highest matched region is returned as the recognized template.
Template zones only work if the control you are tracking stays the same size.
Choose the desired zone and right-click on the zone rectangle. Choose 'Create new Template from image
selection'.
The rectangle will change to green. The Zone Type property in the Properties pane is set to 'Template'.
Note
Do not declare a template zone item as ‘must exist’. To uniquely identify a page, create a text item and
declare it as a ‘must exist’ item..
Related Information
If you’ve created a template for an image pattern that has multiple candidates on a page, you can't predict
which of them the OCR connector will return at run time. So you must uniquely identify the template match you
need.
In the example screen below, there are two occurrences of the search field (shown with yellow borders) and two
occurrences of the gear icon (red borders):
The implementation of the new feature works by looking at the items around the target template (shown below
with green borders). At design time, the bot developer must label the target template with the nearest item.
Let's say the bot developer wants to uniquely recognize the second gear icon. The developer must do the
following:
At runtime the distances d1 and d2 between the two template instances and the label item are calculated and
as d1 is smaller, the second template is recognized.
Using this method improves the stability and resilience of your bot.
Related Information
The Problem: Identifying the Correct Text Item from Multiple Matches
With the OCR connector, you can select text labels on an application page and declare them as an item. Then
you can associate activities such as click or set with the item. However, if there are multiple occurrences of a
text on the page, the topmost match will always be recognized. And that may not be the one you want to target.
The values set for these properties can range between 0 and 100. The default value is 0, meaning that this
feature is disabled. If the deviation at runtime is greater than the configured percentage value, the text is not
recognized.
At runtime, the text will be returned that is within the area defined by the Nearest Match parameters and also at
minimum distance from the design-time coordinates. In the diagram below, the text “search” is the target item,
h is the expected percentage deviation along the y-axis and w the expected percentage deviation along the
x-axis. At runtime, the area shown in blue is scanned and if the target text lies inside it, the text will be correctly
identified. The midpoint of the blue search area is the top left corner of the target item. This is the reference
point that is applied when you use this option.
In the diagram below, the reference point, or midpoint of the blue search area, is the offset distance from the
center of the Labelled by, Status and the offset distance is the distance between the center of the target item
If there are multiple hits for the text within the blue area, the one nearest the reference point is returned as the
matched text.
Whether you use Option 1 or 2, the Nearest Match feature improves the stability and resilience of your bots.
The first step in controlling applications is to control individual entities: items, pages and applications.
Controlling an Item
In your projects, most control actions are performed on items. You usually perform control actions on simple
items such as:
For a complete list of ctx.item class members, see the Desktop SDK Reference Guide.
• Clicking a field
• Setting the value of a field
If the controlled item doesn’t respond as expected, check whether the controlling method returns an error.
According to the application implementation technology (such as Windows or Web), item instances can
implement additional features:
For a complete list of ctx.item class members, see the Desktop SDK Reference Guide.
Multiple items are controlled in the same way as non-multiple ones are. You must simply specify the index of
the item’s instance using the i method:
Sample Code
If an item is multiple (see ‘Recognition’), you must specify one index via the Occurs level:
Sample Code
You can get the count of different instances of a multiple item using the nbOccurs property:
Sample Code
For multiple items, you can only get the count of the last Occurs level:
Sample Code
You can manage in one call the values of all instances of a multiple item using the following methods:
getAll Get in one call the values of all instances of a multiple Item
Sample Code
Controlling complex items (such as a list or tree) can be more complex than controlling simple items.
myAppli.myPage.myFiel
d.set(myValue);
If the simple method doesn’t work as expected, there may be another way to control the targeted item, specific
to the connector used to control the application. Please look at the documentation on the corresponding
connector:
If you can't find a way to control your item, it may be due to the implementation of the application being
controlled.
In some cases, this method doesn’t set the item value correctly. This may be because control actions are
performed at a low level instead of at the user level.
In these cases, you can try setting the item’s value at the user level by:
Sample Code
In some cases, this method doesn’t do the action as required. This may be because control actions are
performed at low level instead of the user level.
In these cases, you can try to click the item at the user level by:
Sample Code
MyAppli.MyPage.activate() ;
MyAppli.MyPage.MyButton.click(true) ;
Sample Code
If you need to know which element has been clicked, you can retrieve this information thanks to the event
parameter ev.itemIndex.
Sample Code
// This handler displays a popup indicating the index of the clicked object
MyApp.myPage.myObject.events.CLICK.on(function(ev) {
var data = {};
ctx.popup('pClickHandled', e.popup.template.Ok).open({
title: GLOBAL.labels.aboutPopup.title,
CX: 500,
CY: 300,
message: "click occurred on element number "+ev.itemIndex,
icon: ctx.options.resourceURL + '/bmp64/hello128.png'
});
});
Background
Most of the time, you do not need to perform control actions on pages. For example, there is no controlling
method to open a page. Instead, you execute the control sequence described in the Functional Specification of
the project. For example, click the Open button.
myAppli.myPage.activa
te();
myAppli.myPage.close(
);
var bExist =
myAppli.myPage.exist(
);
If necessary, you can get an item by its name using the getItem method, instead of using the item object.
Sample Code
MyAppli.MyPage.MyItem.set(myValue) ;
is equivalent to
Sample Code
MyAppli.MyPage.getItem('MyItem').set(myValue) ;
Controlling an Application
For a complete list of ctx.application class members, see the Desktop SDK Reference Guide.
Start an Application
With some technologies (such as WEB and WIN.), you can start a declared application by script, using the
start method:
Sample Code
MyAppli.start() ;
Caution
Please be aware that, particularly with Web applications, you generally cannot use the same application
path in the development phase as in the production phase:
This issue can be managed by providing the right path in the start method:
Sample Code
if (ctx.options.env == e.env.dev)
MyAppli.start('MyEnvPath') ;
else
MyAppli.start('MyProdPath') ;
An alternative to set the application's path for each environment using the setPath method:
Sample Code
If necessary, you can get a page by its name using the following method, instead of using the page object.
Sample Code
MyAppli.MyPage.activate() ;
is equivalent to
Sample Code
MyAppli.getPage('MyPage').activate() ;
In this example, Desktop Agent detects two running instances of the same Web application (here: CRM) with
two distinct InstanceIDs (CRM[13064] and CRM[9912]).
Desktop Agent receives technical events from the two running instances and can control both of them.
This can also happen if the controlled application opens the same page twice. In this case, the problem is: how
to make sure the right page instance is controlled?
The application and page InstanceIDs carried by an event are set by the sender of the event:
• For technical events, they are set by the Desktop Agent connector.
• For functional events, the application InstanceID can be set by the sender of the event via the notify
method.
Examples:
Sample Code
MyApply.MyPage.events.LOAD.on(function(ev)
{
// Same as MyApply[ev.appliInst].MyPage[ev.pageInst].MyButton.click()
MyApply.MyPage.MyButton.click() ;
};
Sample Code
How can you be sure that the dedicated running instance is controlled, and not the one launched
by the user? You can do this by setting the default instance on an application using the
ctx.application.setDefaultInst method:
Sample Code
• You will not receive any technical events from the other instances.
• Other instances will not be taken into account by default instance management.
• You cannot control other instances using the syntax <MyAppli[otherInstance]>.
Note
The default instance is automatically reset when the controlled application ends.
You can do this by setting a default application instance for a running scenario using the
sc.setDefaultInst method:
Sample Code
• Handlers set in the steps of the scenario will not be triggered by technical events from the other instances.
• Other instances will not be considered in Default instance management inside the steps of the scenario.
• You can still control other instances using the syntaxMyAppli[otherInstance]
You control entities such as applications, pages, and items by using a script. To make this simpler, the Desktop
SDK implements the following classes:
ctx.application
Sample Code
<application>.<action>(parameters...);
Example
Depending on the application implementation technology (such as Windows, Web, or Java), the
ctx.application instance implements different methods. For a complete list of ctx.application class
members, see Class ctx.application.
ctx.page
Sample Code
<application>.<page>.<action>(parameters...);
Example
Depending on the application implementation technology (for example, Windows, Web, or Java), the ctx.page
instance implements different additional methods. For a complete list of ctx.class class members, see
Class ctx.page.
ctx.item
Sample Code
<application>.<page>.<item>.<action>(parameters);
Example
Depending on the application implementation technology (such as Windows or Web), item instances
implement different actions. For a complete list of ctx.item class members, see Class ctx.item.
To allow you to control declared entities, an instance of the appropriate class is automatically created for each
declared entity. This code is included in the declaration script file <project name>.resources.js.
Note
The entire content of the declaration script file is automatically regenerated. Do not write any code here: It
will be deleted.
The main purpose of SAP Intelligent Robotic Process Automation is to automate tasks that humans perform on
applications running on user workstations. Typical tasks include:
Most projects involve controlling applications that are running on a user's workstations. To control these
applications, you begin by declaring entities such as applications, pages, and items. These entities can then be
used to communicate with the application you wish to automate.
Basic Definitions
The application entity is used to communicate with a running, real-world application. An application entity can
contain page entities that can communicate with parts of the application’s user interface. A page entity can
contain item entities that can communicate with elements of the page entity.
• Control real-world applications to determine, for example, whether a button has been clicked or to read or
write a value in a field.
• Receive technical events from real-world applications, such as starting an application, loading or unloading
a specific object, or clicking on a specific button.
Process entities execute internal tasks that are not directly related to a running, real-world application.
Examples include:
• Managing exchange with external services (such as Web services and databases).
• Managing applications via APIs (such as Microsoft Excel, Microsoft Word, Microsoft Outlook, or SAP
Business Suite).
• Managing coordination when no running applications are able to perform this task.
All of the above entity types can exchange data by means of functional events.
• Desktop applications
• Web applications
• Mainframe applications running in a terminal emulator
Although these types of application differ in some ways, the respective entities must always satisfy the same
rules.
Application, page, and item entities must comply with the following rules:
Page entity rules • A page entity must belong to an application entity (or, in the case of Desktop applica
tions only, to another page entity).
• A page entity can contain item entities.
To learn the key principles you need to observe to ensure that your entity declarations are robust, see
Declaration Principles [page 282].
When you begin to declare an application, you must choose the connector used to control the targeted
application. Your choice mainly depends on the technology of the application. The most frequent cases are:
Sometimes it is difficult to identify the technology of the target application, especially in the case of desktop
applications. The recommended approach in this case is to:
1. Choose a technology and verify that the targeted application appears in the list of detected applications.
2. Once found, create the application entity.
3. Declare a page in this application (see Declaring Pages [page 252]).
Declaring an Application
When you create an application entity, Desktop Studio automatically sets the application criteria. In most
cases, the default criteria will be correct. If not, they can be adapted as required.
For a full description of this task, see Declaring Applications [page 249].
Declaring a Page
Subpages
In some technologies (such as WIN, JAVA, UI Automation), a page can contain another page, that is, a subpage.
Note
Relationships between pages must mimic the relationships between their targeted components:
Incorrect declaration of pages and subpages can lead to errors during page recognition:
Components (2) and (3) are descendants of component (1), so pTabITem2 and pTabITem1 are contained in
pMainPage.
Page Instances
Each recognized page is a page instance.
For details of these methods, see Advanced Recognition Capabilities [page 283].
A declared page automatically receives LOAD and UNLOAD events. In some technologies, declared pages can
receive other types of technical events. These events must be explicitly tracked in order to be notified.
In special cases, it can be useful to declare more pages to generate additional LOAD and UNLOAD events.
Using Subpages
Note
The use of subpages is only possible with WIN, Java, and UI Automation technologies.
Consider the case of a desktop application that has a TabControl with various TabItems. Suppose that we have
to perform the following control sequence:
With this method, receipt of a LOAD event on the pTabItemPage triggers the continuation of the control
scenario.
For more details on declaring pages, see Declaring Pages [page 252].
Declaring an Item
Item criteria are set for target component properties (see Criteria Management [page 269]). The available
component properties are specific to each technology.
Once the connector recognizes a screen as a declared page, it can search the DOM of the screen to find the
target of each item:
• An item will target the first DOM component that matches its criteria
• If an item is declared as multiple, it will target all of the DOM components that match its criteria.
Multiple items (available in WEB, UI Automation, HLLAPI, and Java Swing only)
A multiple item is used to target an undefined number of components (for example, all the rows in a table).
1. Set recognition criteria that are broad enough to match all of the targeted components.
2. Set the Occurs item parameter (see Item Definition [page 263]).
The Occurs parameter can be also set on the ancestor item or on any item of the items pattern.
• Items Pattern Method [page 286] (available in WEB and UI Automation only)
• Ancestor Method [page 285] (available in WEB, WIN, and UI Automation only)
• Labelled By Method [page 285] (available in WIN, UI Automation, and HLLAPI only)
Note
A tracked event will be notified if it is fired by the targeted component. It is necessary to verify at runtime
that the tracked event is fired correctly.
The available technical events depend on the technology and on the type of component targeted.
Set Parameters
Item parameters can be set by using Desktop Studio (see Set Item Parameters under Declaration of Page
Items [page 262]).
Parameter Description
The Technical parameter can be useful for filtering items declared for use as an:
For more information on declaring items, see Declaration of Page Items [page 262].
Application Entity
Page Entity
• A Page entity is defined for each window of the application that must be controlled, such as the main
window, popup windows, or MDI windows.
• You can also define Page entities for subparts of an application window, such as for a tab item in a tab
control, or control containers.
• If required, generic page entities can be defined to represent a set of windows. For example, you can control
a set of error popups using the same generic page entity.
• An Item entity must be defined for each component that has to be controlled, such as input fields,
buttons, labels, combo boxes, or checkboxes.
Item Entities
An Item entity must be defined for each component to be controlled, such as entry fields, buttons, labels,
comboboxes, or checkboxes.
Application-Based Events
• Start
• End
Page-Based Events
The concept of subpages is related to the structure of desktop applications. These applications usually have a
main window, which often has child windows.
The relationship between pages and subpages must be the same as the relationship between the
corresponding targeted windows.
During recognition:
• A subpage cannot be recognized until its parent page has been recognized
• A subpage can only be recognized among the descendants of the component targeted by its parent page
Applications running in a plugin included on a Web page (for example, Flex applications, Silverlight applications,
or Java applets) are considered by Desktop Studio Desktop Agent as desktop applications.
• Application entity: This is defined as the set of Web pages of the application.
• Page entities:
• A page entity is defined for each page of an application that needs to be controlled
• For Web pages including a frameset, you need to define a page entity for each frame you want to
control
• If necessary, you can define generic page entities to represent a set of Web pages
• Item entities:
• An item entity is defined for each component that must be controlled, such as input fields, buttons,
labels, combo boxes, or checkboxes.
• For complex UI components (such as tables, lists, or trees), you will generally need to define a multiple
item entity to represent the component items.
Note
Some Web pages may open popup windows owned by the Web browser (such as information or error
popups or “open file” popups). If you need to control such popups, you must:
A mainframe application is any application running in a desktop terminal emulator implementing the HLLAPI
monitoring protocol.
A mainframe application running in a Web terminal emulator (such as Crysalid) is regarded as a Web
application. A mainframe application running in a desktop terminal emulator without HLLAPI protocol is
regarded as a desktop application.
• Application entity: This is defined as the HLLAPI session giving access to the mainframe application
• Page entities
• A page entity is defined for each screen application that must be controlled
• If necessary, you can define generic page entities to represent a set of application screens
• Item entities: An item entity is defined for the zone that must be controlled on each screen
To declare an application, you first capture it, then define the criteria that allow the software to recognize it, and
finally set the relevant application parameters.
1. Launch the application (Web, Windows, and so on) to be managed by the project.
2. In the Explorer perspective, open the context menu and choose Add a New Application…
3. Select the technology of the application to be declared. Depending on this technology, the list below shows
all the running entities that can be chosen as an application:
• For Windows or UI Automation technology, all of the Windows executables running on the desktop
• For WEB technology, the Web pages loaded in all of the browser instances running on the desktop
• For HLLAPI technology, all of the HLLAPI sessions running on the desktop
4. Select the application that you want to add from this list.
5. Choose what you want to capture by selecting either the Print Window or Screenshot radio buttons. The
selected application is shown in the preview so that you can check that it is the right application.
Recommendation
If the preview area is black, make sure that the application you want to capture is in the foreground.
Then select the Screenshot radio button.
6. Click Save or Save and Capture Page if you want to immediately capture one or more pages of the
application.
7. After you have finished capturing the application, return to the Explorer perspective to specify its
parameters and criteria.
• Problems may occur when zoom factors are tuned with different values on a multiple screen display.
This is a known issue, in particular with Chrome and Firefox during capture. Capture with Chrome
and Firefox works if the window zoom factor is the same on every screen (whatever the browser zoom
factor).
There should be no issue with Win32, UI Automation, or SAP GUI applications.
If you have some issues capturing UI elements, you may be able to solve the problems by setting the
zoom factor to 100%. Go to the Scale and layout settings of your laptop and ensure that your zoom
factor is set to 100%, then restart your session to apply the change.
In the Capture window, a warning message lets you know if the zoom level of the target page is not set
to 100%.
• Rarely, other issues can occur when the zoom factor is not set to 100% in the runtime phase:
• Highlighting of items can be incorrectly positioned.
• In the rare cases where a mouse click driven by coordinates is used, the coordinates may be
incorrect and the mouse click can fail.
Related Information
After capturing an application, you need to set the criteria required for the software to recognize it.
The Captured Data tool window of the Explorer perspective panel shows the properties of the application that
can be used as criteria.
These properties are collected when the application is first captured. What properties are captured depends on
the application technology and corresponding connector: only properties used by the connector are captured
correctly.
The Criteria tool window lets you edit the criteria of the application that will be used by the connector to
recognize an application at runtime.
The Parameters tool window lets you set the following application parameters:
General Category
Techno SDK Indicates which SDK (V2 for legacy XML or V3 for Java
Script) is used to develop the application
Connector Category
Technical Category
After you have declared an application, you must add at least one page of the application. To do so, you capture
the page, set the page parameters, and then define the criteria that allow the software to recognize the page.
Note
Before you start a capture with Desktop Studio, make sure you are on the tab you want to capture. If there
are several windows open, the Desktop Studio only detects the current tab on the window where you are
active. Among all the different opened windows, the capture request works on the active window. During
the capture, make sure to activate the specific window you want to capture.
If you have just captured an application using the Save And Capture Page button, the Capture Page dialog box
will open automatically. Otherwise, open the context menu for the application and click Capture a New Page…
or double-click the New Page box shown in the Explorer perspective panel.
The technology of the selected page is detected automatically depending on the technology of the declared
application.
You can also specify it by checking Choose Technology: and selecting the desired technology from the
dropdown list.
To select the page to capture, keep the Ctrl key pressed and hover the cursor over the page.
Select the page to capture by clicking it in the tree. A standard name and description will appear in the fields at
the bottom of the page, and you can edit them as desired. Then click Scan And Capture.
When scanning and capturing are finished, the window closes and the page is displayed in the Capture pane of
the Explorer perspective panel.
Note
Some captures can be time-consuming, especially when capturing very large documents (Web
technology). You can interrupt an ongoing capture by clicking the Stop Scanning button. In this case, the
capture is not canceled entirely, but will be only partially completed.
Note
Remember that for Java applications, you must capture the pages while running the project.
Tip
• Problems may occur when zoom factors are tuned with different values on a multiple screen display.
This is a known issue, in particular with Chrome and Firefox during capture. Capture with Chrome
and Firefox works if the window zoom factor is the same on every screen (whatever the browser zoom
factor).
There should be no issue with Win32, UI Automation, or SAP GUI applications.
If you have some issues capturing UI elements, you may be able to solve the problems by setting the
zoom factor to 100%. Go to the Scale and layout settings of your laptop and ensure that your zoom
factor is set to 100%, then restart your session to apply the change.
In the Capture window, a warning message lets you know if the zoom level of the target page is not set
to 100%.
• Rarely, other issues can occur when the zoom factor is not set to 100% in the runtime phase:
• Highlighting of items can be incorrectly positioned.
• In the rare cases where a mouse click driven by coordinates is used, the coordinates may be
incorrect and the mouse click can fail.
The content of the page tree depends on the technology (automatically detected or manually selected):
• For a Web page, it contains all the frames displayed in the selected browser instance.
• For a Windows page, it contains all the controls of the selected Windows application.
• For a Java page, no tree is displayed.
The selected page can be changed by selecting it in the tree. The red border and the screen capture (if
available) are changed to reflect this selection.
Note that for a Windows page, the selected item will be considered as the root item of the page.
Clicking the Scan And Capture button triggers the capture. Desktop Studio executes and stores:
A progress bar is updated during the operation to show the capture in progress. Captures are stored on disk
and are available for working offline, so there is no need for the application to be running after the capture has
taken place). The elements captured depend on the page technology:
Capture Options
To set further capture options, click the cog icon at the top right.
Capture:
This option lets you select the method used to make a screen capture of the page.
The default capture mode is Print Window, which lets you capture a page that is not completely visible on
the screen. If this capture fails, the other capture mode is used automatically. Sometimes, the Print Window
Note
If you use this mode, the page must be visible (not covered by other graphical elements) when the capture
is validated.
Parameters
Limit Depth To
This option limits the depth of the DOM captured. It's useful for capturing very large Acrobat Reader
documents with UI Automation technology. Capturing a huge DOM can take a very long time, and you may
only need the first few levels. The result is a partial capture of the DOM.
Limit Siblings To
This is useful when capturing Acrobat Reader content with UIAutomation technology. In some cases, Acrobat
Reader returns an infinite number of children of an element. Setting a limit on the number of siblings resolves
this issue. The result is a partial capture.
This requirement is due to the tree structure of Windows applications and to the way the Windows connector
recognizes Windows pages:
If a Windows control to be recognized as a Page_1 by Desktop Studio has a parent control which is recognized
as a Page_2, Page_1 MUST be declared as a subpage of Page_2.
This subpage relationship ensures that only the controls required are recognized. However, if not declared
correctly, it can prevent required controls from being recognized correctly.
The only difference is that it MUST be declared with the corresponding parent page.
In the Explorer perspective, you can define this subpage relationship in the following ways:
Note
The parent page can be only detected if it has been recognized in the Page view.
Note
The parent tree of a page is the chain of window handles (HWND) of the newly captured control's
parent controls. As this chain is comprised of window handles, it is valid until one of the parent controls
is closed or until the application itself is closed. In order to use this detection method, it is advisable to
capture all the pages during the same application session.
When a subpage is captured, the root item is set. Later on, another item can be set as the root item by
right-clicking the new root item and selecting Associate with the Selected Page from the context menu.
It is not possible to capture an HLLAPI page by selecting the page on the screen. Instead, to select an HLLAPI
page, click the Refresh icon.
The page tree shows all the HLLAPI sessions opened on the desktop (A, B, and so on).
After selecting the session to be captured, click the Scan and Capture button.
Captures can be added to an existing page. Having multiple captures can be useful when a page has different
states. Select the page from the Project tree, then select Make a new Capture of this Page…. The capture
process is the same as for a new page, except that a popup appears asking if you wish to replace the current
capture.
The various captures associated with a page are available in the capture selector. Here is an example of a page
with two captures:
The current capture can be selected manually by selecting the corresponding tab. To make this simpler, each
tab has a tooltip showing the capture comment and the date of capture.
You can make a new capture by clicking the button. The capture workflow is the same as described earlier.
When you select an item in the Project tree, the current capture is automatically changed to the one in which
the item was selected (see Associate Items With Components in the Page Capture [page 262]). In order to
prevent this, the current capture can be locked by clicking the button. This way, the current capture remains
the same no matter which item is selected. To unlock the current capture, click the button again.
By clicking the button, you can change the data associated with the capture.
After a page is captured, or at any time afterward, the various elements of a page definition can be modified.
These are:
Regardless of the page technology, this panel contains the same subparts:
The Parameters tool window lets you set the page parameters:
General category
Technical category
The TrackEvents tool window lets you set the technical events controlled on the page. The list of available
technical events depends on the page technology. A description of each event is available in the Help panel.
For more information on the TrackEvents tool window, see Tool Windows in the Explorer Perspective [page 10]
The Captured Data tool window shows the properties of the page that can be used as criteria. These properties
are collected when the page is captured. If the page was been captured by Desktop Studio, this tool window is
empty.
• For a Web page, these properties are associated with the captured frame
• For a window page, these properties are associated with the root item set at the beginning of the capture
The Criteria tool window lets you edit the page criteria that the connector uses to recognize a page at runtime.
For a complete description of this tool window, see Criteria Management [page 269].
When a page is selected in the Project tree, Desktop Studio tries to recognize it automatically in the current
capture. In the same way, when changing the current capture, Explorer tries to recognize the current page on
this capture. The page is highlighted in green if it is recognized, in red if not, and in black if no recognition has
been attempted.
Once a page has been declared, you can add items to the configuration. When you declare an item, you:
Items are declared offline from the page captures. Even the validity of criteria can be tested offline. A final
validation must be performed online on the running application.
To associate a component with a new item, right-click the component in the Screen display and select
Associate to a New Item from the context menu or double-click the component. You can also do this in the
Tree display, Subtree tool window, and Text tool window.
The item is then added to the page items in the Project tree and an internal link is established between this item
and the component selected in the screen capture. The new item is created with default parameters.
Smart declaration automatically generates the right criteria to uniquely identify the component in the UI (user
interface). Smart declaration works in most scenarios except when the recognition requires complex patterns.
In this case, it is up to you to set the right criteria.
If the action is performed from the Text tool window, a criterion is added to the Text property. These
parameters and criteria can be edited in the Item properties panel.
To associate the existing item, select it in the Project tree, right-click the component in the Screen display, and
click Associate to the selected Item.
You can also do this in the Tree display, Subtree tool window, and Text tool window .
If the selected component is not yet associated with an item, a new item is created automatically. Otherwise,
the associated item is automatically selected.
The criterion is set for this property, with its complete value and the default scan value for this property.
Item Definition
Once an item has been created, various elements can be set in order to define it:
Selecting the item in the Project tree gives you access to the Item definition panel.
The Parameters tool window lets you set the item parameters:
General Category
Folder Used to organize items (see Project Tree). Useful when you
have a large number of items.
Connector Category
Technical Category
The Track Events tool window lets you set the technical events for the item. The list of available technical events
depends on the page technology. A description of each event is available in the Help panel.
• The single component method, which involves setting criteria for the properties of the component to be
recognized
• The components pattern method, which involves setting criteria for a pattern of one or more components
to be recognized, where one of these components is the component to be targeted
The single component method can be used with any technology available with Desktop Studio. The
components pattern method is used with Web and UI Automation technologies only.
The properties captured depend on the page technology and connectors: Only the properties used by the
connector are captured.
The Criteria tool window lets you edit the criteria for the item that will be used by the connector to recognize it
at runtime.
For a complete description of this tool window, see Criteria Management [page 269].
Example:
Suppose a Web page has several TABLE components. We want to target the TABLE component that has the
column header Company.
• One component (the target component) that recognizes the TABLE component (1)
• A child component that recognizes the TH component that has the Text property equal to Date (2).
• To remove a component from the pattern, right-click the component in the Criteria tool window (2) and
select Remove Component from the context menu.
Components pattern properties can be set in the Criteria tool window (2).
When added, components are automatically set at the right position in the pattern. This position is determined
by the relative positions of the associated components. Associated components must have a parent-child
relationship. It is not possible to add a sibling component. The depth of the relationship between recognized
components can be set with the Children checkbox. If it is checked, the component recognized must be a direct
child of the component recognized as the parent in the pattern.
In the example above, if the TH component has the Children checkbox checked, the TABLE component target
will not be recognized because the recognized TH component is not a direct child of the recognized TABLE
component.
The Occurs property of a component can be used if we want to address a collection of components. This is
mainly used to set this property on the target component, but it can be set on any upper component in the
pattern.
The Target property is used to change the target component of the pattern. The target component is
highlighted in bold in the pattern tree.
Declaration of items with HLLAPI is a little different from declaration with other technologies. An HLLAPI page
capture doesn’t contain components, but only the text of the screen. This means that in order to declare a
new item, you have to select the relevant part of the text instead of the component. After selecting the text,
right-clicking the selection gives you several options:
• Associate with new item: Create a new item with the X, Y, CX value of the selection.
• Associate with new MustExist Label: Create a new MustExist item with the X, Y, CX, and TEXT values of the
selection.
• Associate with the selected item: Update the selected item with the X, Y, CX value of the selection.
A soon as an item has at least one criterion, Desktop Studio attempts to recognize it. When an item is selected
in the Project tree, its associated element (if any) is bordered by a blue rectangle. As a result, its recognized
component(s), if any, is bordered by:
• A green rectangle if it matches the associated one. As the two rectangles match, only one green rectangle
is visible:
• A red rectangle if it does not match. As the two components do not match, two rectangles, one blue AND
one red, are visible:
The Recognition tool window helps you to investigate cases where no components are recognized or where the
recognized component is not visible.
For a more detailed description of item recognition, see About the Recognition Mechanism [page 276].
When several captures have been created for a page, you can manually choose which capture is used for
recognition by selecting the corresponding tab (1, 2, 3, and so on) from the capture selector.
When you select an item in the Project tree, the current capture is automatically set to the one where the item
was associated with a UI component..
This behavior can be disabled by locking the current capture using the button in the Capture toolbar.
Criteria are rules set by the user and used by the Desktop Studio connectors to recognize defined elements
(applications, pages or items) in the running entities (Web pages, Windows items, and so on).
A connector recognizes a running entity as an element if the entity properties match the element criteria.
Available Properties
• The technology of the entity (in other words, the URL property is available in a Web page but not a Windows
page),
• The connector (in other words, the Window connector only tests the EXE property of a Windows
application).
When Desktop Studio captures a running entity, it captures only the properties available for use in criteria.
Available Operators
Text Properties
Starts The property value must start with the criterion value
Ends The property value must end with the criterion value
Like The property value must match the criterion value consid
ered as a regex
Numeric Properties
• The type of the property (for example text, numeric, Boolean, or enumerated)
• The connector (in other words, the Web connector manages the ‘starts-with’ operator for text properties
but the Windows connector does not)
The general rule is that all of the element’s criteria must be satisfied before an entity is recognized (AND).
However, some connectors accept two (or more) criteria for the same property. In these cases, only one of
these criteria must match (OR).
When the OR combination is available for a property, the Criteria Editor shows the plus icon (+). This button
adds a criterion to the edited property, even if a criterion already exists for this property.
The Criteria Editor is available in the Criteria tool window (see Tool Windows in the Explorer Perspective [page
10]).
• Text properties:
• Numeric properties:
• Boolean properties:
• Enumerated properties:
Adding a Criterion
The procedure for adding a criterion is the same for all element types (applications, pages, and items):
• Select the captured property in the Captured Data tool window (see Tool Windows in the Explorer
Perspective [page 10]). The Criteria tool window is updated as follows:
A captured property can be quickly added as a criterion by double-clicking it in the Captured Data tool window.
Updating a Criterion
To update a criterion:
Deleting a Criterion
To delete a criterion:
The criteria technical document can be automatically generated using the Build criterion doc menu item in the
File menu. This generates an additional HTML document for each PSC file. It is named PSCName.html:
A page implements event-driven UI updates when it fills fields, starts a calculation, or controls changes to the
state of the page.
• Page1 processes the zipcode field value to get the corresponding city name and then fills the cityname field
• Page1 checks the value of the contractId field before allowing the other fields to be filled
When you control such pages, you must take into account the implemented event-driven UI updates to avoid
conflicts with them.
• Page1 processes the zipcode field value to get corresponding city name and fill the cityname field
• Remaining fields are disabled or hidden until contractId field has been controlled
• …
Some processes are more difficult to detect, such as when the other fields are reset after the contractId field is
verified:
To detect processes of this type, you need to carefully examine how the page changes when a user interacts
with it. For example:
When you fill a field and start an event-driven UI update, the page is put into an unstable state until the process
has been completed. It is important to understand how the process starts so that you can control the actions
that are required to trigger it.
To detect the starting event, you must carefully examine how the page changes when a user interacts with it.
For example,
• Does the process start when I hit a key in the input field?
• Does the process start when I navigate to the next field?
On Web pages, you can also examine the page source to see which events are triggered on an item.
Note
Only the HTML source is captured in Desktop Studio; included files such as CSS or JavaScript files are not
captured.
A full investigation may require you to have the application running. External tools can be useful for analyzing
an event-driven UI update, such as:
For fieldrelated event-driven UI updates, if the basic control action doesn’t automatically trigger the event-
driven UI update, it is necessary to trigger it manually by appending additional control actions.
Once you have determined the starting event, there are different ways to trigger it. Below are some use cases
encountered in real projects, along with the methods used to handle them.
This is not an exhaustive list. Please don’t hesitate to send us other use cases you have encountered or other
methods you have implemented in your projects. We will add them to the list.
Sample Code
• On a Web page, you can fire the blur event using the scriptItem method:
Sample Code
myItem.scriptItem("fireevent('blur')") ;
• On a Web page, you can fire the onchange event using the scriptItem method :
Sample Code
myItem.scriptItem("fireevent('onchange')") ;
• On a Web page, you can call the onchange method using the scriptItem method:
Sample Code
myItem.scriptItem("onchange()") ;
• You can set the field value using the keystroke method:
Sample Code
myItem.keyStroke('value to set') ;
You can set the field value using the keyStroke method:
Sample Code
myItem.keyStroke('value to set') ;
It is important to know what an event-driven UI update does so that you can detect when the process has
ended.
It can also help you solve some problems during process execution:
The following problem was encountered in controlling a Web application: Although the input values are set
correctly, and the event-driven UI update starts correctly, the process aborts.
Taking a look at the JavaScript code for the process (using the Source display in the Explorer perspective's
Page view) gives you the solution. The changed attribute of the input fields must be set to 'true' to enable the
process to consider it.
Sample Code
myItem.scriptItem("changed=true;") ;
Even if the event-driven UI update seems to be very quick, it does take a certain amount of time. These
processing delays must be managed in developments within SAP Intelligent Robotic Process Automation:
Controlling in SAP Intelligent Robotic Process Automation is much faster than user actions
You must therefore ensure that the event-driven UI update has ended before you continue controlling.
The way you wait for process termination depends on the result of the process (see above):
Capturing and declaring applications goes hand in hand with the recognition mechanism. To help ensure that
your applications are properly captured and recognized, we provide some guidelines here.
These guidelines also explain how to use methods to handle advanced use cases. Methods include MustExist,
MustNotExist, and Ancestor.
Principles
Desktop Studio includes an internal recognition mechanism. The goal is to allow offline validation for the
recognition criteria that are defined when pages and items were declared. The recognition mechanism
implements the same recognition rules as those implemented by each connector. You can check the page
recognition and item recognition for each page capture.
Background
When you select a page in the project tree, Desktop Studio tries to automatically recognize it on the current
capture. In the same way, when you change the current capture, Desktop Studio tries to recognize the selected
page on this new capture. The page is highlighted:
Recognized Application
Unrecognized Application
Recognized Page
Unrecognized Page
Untested Page
The number of tests displayed beside each page name is the recognition cost (in number of tests).
Example 1
In this case, the pTabPage1 page is highlighted in red, because recognition is performed on one of its captures
and the page has not been recognized. The pTabPage2 page is only grayed, because, even if it has not been
recognized, recognition is not performed on one of its captures.
Example 2
In this example, the recognition process, applied to a pMonAffichage page capture, gives the following results:
The cost is especially important when using the UI Automation connector. In this case, the connector can be
very slow, especially when the recognition cost is very high.
When investigating the declaration of subpages, it can be useful to use the Tree display (see Page View Panels
[page 16]).
As a subpage can only be recognized in its parent-page subtree, using the Tree display can be helpful when
trying to determine why a subpage is not recognized.
Item Recognition
Introduction
When you select an item in the project tree, Desktop Studio tries to automatically recognize it on its selected
capture. For an item, the selected capture is the page capture in which it has been associated with a UI
component and declared (if any). For more details, see Associate Items With Components in the Page Capture
[page 262].
Similarly, when you change the current capture, Desktop Studio tries to recognize the selected item on this
capture.
• Testing whether the declared item is recognized (at least one captured component matches the item
recognition criteria)
• Testing whether the component associated with the item (if any) matches the recognized component.
But when an item is selected in the Project tree, the current capture is automatically set to the one associated
with the item .
It is possible to disable this behavior by locking the current capture using the button.
When an item is selected in the project tree, its target component (if any) is bordered with a blue rectangle. Its
recognized component(s), if any, are bordered with:
• A green rectangle if it matches the target component, As the two rectangles match, a green rectangle is
displayed:
• A red rectangle otherwise. As the two components don’t match, two rectangles, one blue AND one red, are
displayed:
Recognition succeeded
Recognition failed
Note the recognition cost (in test number) displayed near each item name (for example, btAccueil [49 tests]).
This cost is especially important when using the UI Automation connector. In this case, the connector can be
very slow, especially when the recognition cost is very high.
Note also the index value shown next to each recognized multiple component (for example: [2] or [1][1]).
This index value indicates the index value that must be used to control each item instance (for example:
oLigneAssigneToMe[2]).
It can be useful to use the Tree display to view the recognition results. This display shows all of the recognized
items within the technical DOM tree of the capture.
Declaration Principles
During the solution design phase, you defined the various application, page and item entities required by your
project.
In the declaration phase, you declare the entities in the SAP Intelligent RPA project.
Once you have created your project (see Create a Project [page 63]) you need to create the functional entities:
Desktop Studio and Desktop Agent use recognition criteria to link the entity with the targeted component of
the real-world application to be controlled.
The way criteria are defined can depend on the technology of the targeted application. Generally, you can:
• Select the constraint operator (such as equals, contains, starts, ends, or like)
• Set several criteria on different properties combined by a logical AND
• Set several criteria on the same property combined by a logical OR
• Precise enough to target only the desired component of the controlled application
• Robust enough to still work even if the controlled application changes.
Note
During the process of setting recognition criteria, Desktop Studio performs recognition on the various
captures. This way, you can easily validate declarations offline (see About the Recognition Mechanism
[page 276])
Once you have declared entities, we recommend performing test recognition online using the debugger.
For a list of common recognition errors, and how to resolve them, see Recognition Error Cases [page 470].
Note
Application events (START, END) and pages event (LOAD, UNLOAD) trigger notifications automatically and
don’t need to be tracked. Item events (such as CLICK, SETFOCUS) must be explicitly tracked in order to
trigger notifications.
If the screen that is to be controlled does not have unique, distinguishing properties, you can use an advanced
declaration or recognition method. The available methods depend on the technology.
The MustExist method is available in all technologies. It consists in detecting one or more components that
are present in the screen to be controlled but not in any other. These components are declared as items on the
page and their MustExist parameter is set.
The MustNotExist method is only available for the WEB and UI Automation technologies. It consist in
detecting one or more components that are not present in the screen to be controlled but are present in others:
These components are declared as items on the page and their MustNotExist parameter is set.
Using this method, a screen is not recognized as a page if one of its MustNotExist items is found on the
screen.
The Root Item method is available for UI Automation and the SAPGUI connector. It is used to declare
subpages as follows:
• In the parent page, declare an item that targets the desired root component
• Set this item as root item in the subpage parameters
This method allows you to use advanced item declaration methods to target the root component.
The Ancestor method searches upwards in the hierarchy to find an ancestor component with a set of properties
that make it unique. This ancestor component can't be part of an ascending hierarchy that is incorrectly
recognized.
The target component will be searched in the descendance of the ancestor component.
In the following DOM, you want to target second leafnode (in orange):
The two leafnodes are the same, so, if you don’t use the Ancestor method, the first leafnode will always be
recognized, not the second. You cannot use node (id=1) as ancestor, because it is ancestor of both of the
leafnodes and the first leafnode will be recognized. So I must use subnode (id=3) as ancestor so that the
second leafnode is recognized.
This component is typically a label component located near the target component. But it can be any other
component, anywhere on the screen.
Desktop Studio stores as a criterion the distance between the targeted component and the label component.
This distance is calculated in a unit independent of the screen resolution.
The target component will be searched for between the components located at this stored distance from the
label component.
The Items Pattern method consists in recognizing a set (pattern) of related components, rather than a
single component.
These components must be linked together by a parent-child relationship. One of these components is the
target and will be addressed in the SAP Intelligent RPA project.
This method is useful when the target component has no (or insufficient) unique, distinguishing properties. For
more information, see Declaration of Page Items [page 262].
When the connector detects the opening of a screen, it searches for the first declared page whose criteria
match.
If you need to declare a generic page with broad criteria, you must declare it after declaring the rest of the
pages. This ensures that screens are correctly recognized as generic pages.
Scenarios are used for process automation. Often, you will need to split process automation into small pieces:
the steps. You can decide to bootstrap your project with Workflow Designer.
Workflow Designer lets you use previously declared application pages and activities. You use dedicated
activities – such as set or get – within an application page added to the Workflow Canvas. By linking the
pages together, you create a set of steps which will generate a scenario script.
Scenario scripts can be also created from scratch in the Editor perspective. In this case, you use the Desktop
SDK.
A workflow refers to an automation sequence. It can describe the control of a single application or the
coordination of several apps.
Functional Description
When you design a workflow, you describe the implementation of the automation sequence in functional terms:
• The sequence of the screens and the actions to perform on each screen
• The data to collect and return
• The other actions to implement (manage files, data...)
The goal of a workflow is to describe the functional requirements (Scope Of Work), not the technical
implementation.
Note
The screens and items that can be used in a workflow must be declared beforehand in the Explorer
Perspective.
You can generate the JavaScript code from a workflow at any time.
Script Development
Iteration
You can change a workflow and regenerate the code, even it has been manually changed by the script
developer. This requires you to set an external code merger tool.
Related Information
Prerequisites
Context
The values for the Timeout and the steps are set by default in the workflow.
You can change these values and later manage your Timeouts in your workflow.
Procedure
1. In the Workflow Perspective, go to the pane at the top-right of the screen. There are 3 options : Context,
Events, Properties.
2. Click Properties.
3. Go to section 2-Activity.
4. You can make two modifications:
Workflows
• Each activity has parameters that can be edited in the Parameters tool window.
• The list of available activities is presented in the Activities tool window, from which activities can be
dragged & dropped into the current design.
The data collected during the automation sequence can be stored in a context.
Functional Events
Unlike technical events, functional events are created by a developer. A functional event has a name and is able
to transport data such as a string or a JavaScript object.
The functional event mechanism requires a receiver and a sender. The receiver is the entity that receives the
event, and can be any entity (including process entities). The sender is the entity that sends the event to the
receiver.
Note
Any entity can be the sender, even the receiver itself. In this case, the entity sends the event to itself.
The functional event belongs to the receiver. Each functional event can have only one receiver. The event is
always delivered asynchronously, and it can be delivered with a delay (in ms).
Disconnect Disconnects a HLLAPI appli HLLAPI Application - The name of the ap
cation. plication to disconnect.
Highlight Highlights all detected items Win, Web, JavaSwing, UI au Application - The name of applica
in active pages of an applica tomation, OCR. tion to use for this action.
tion.
Duration - The highlight duration of
detected items in milliseconds. If 0
(zero), items remain highlighted.
Note
You can manage credentials locally (Windows Registry or Credential Manager) or on the server (Cloud
Factory).
You can write, read and save your credentials locally. For security reasons, you can only read credentials on
the server as the values can be shared between multiple bots. This means that if you try to set a credential
variable on the server, you get a "not implemented" error message because this function is not supported.
Comment
Notify Sends a functional event to itself or Event - enter a new event name or select an
another application or page. existing one from the list.
Wait for Sets an event handler to wait for a Event - name of the functional event to wait
functional event. for.
Initialize Excel Initializes the Excel library in differ New instance - if true, the software initial
ent modes. izes Excel with a new instance.
Release Excel
Data
Get one value Gets one value from a cell. Row - the row number.
Set one value Sets one value in a cell. Row - the row number.
Get values Gets values from a range of cells in Start column - the starting column, such as
the active worksheet. A (the limit is “XFD” or 16384).
Set values Sets values in a range. Start column - the starting column, such
as A.
headers.
File
Open Existing Excel file Excel filename - the full path and name of
the Excel file.
Format background color Changes the background color of a Range definition - string that represents
range of cells. the range, such as “A;5;G;67” or “1;5;7;67” or
“A5:G67” for a range, or A; 8 or 1;8 or A8 for a
single cell.
Format bold Formats the text of a range of cells Range definition - string that represents
as bold, or removes bold format. the range, such as “A;5;G;67” or “1;5;7;67” or
“A5:G67” for a range, or A;8 or 1;8 or A8 for a
single cell.
Format font color Changes the font color of a range of Range definition - string that represents
cells. the range, such as “A;5;G;67” or “1;5;7;67” or
“A5:G67” for a range, or A;8 or 1;8 or A8 for a
single cell.
Format font size Changes the font size of a range of Range definition - string that represents
cells. the range, such as “A;5;G;67” or “1;5;7;67” or
“A5:G67” for a range, or A;8 or 1;8 or A8 for a
single cell.
Format italic Formats the text of a range of cells Range definition - string that represents
as italic, or removes italic format. the range, such as “A;5;G;67” or “1;5;7;67” or
“A5:G67” for a range, or A;8 or 1;8 or A8 for a
single cell.
Get formulas Gets formulas from a range of cells. Start column - the starting column, such as
A (the limit is “XFD” or 16384).
Workbook
Worksheet
Activate worksheet Activates an Excel worksheet from Excel worksheet - the name of the work
the active workbook. sheet.
Add new worksheet Adds a new Excel worksheet to the Excel worksheet - the name of the work
active workbook. sheet.
Add job Adds a job to the Factory server. Application - the name of applica
tion that contains the scenario to add to
the job manager.
Add job List Adds a job list to the Factory server. Application - the name of applica
tion that contains the scenario to add to
the job manager.
Get job Gets a job from the job manager. Criteria - the criteria used to search
for jobs.
Get job list Gets a job list from the Factory server. Job data source
Get/run job Gets, runs, and updates a job in the job Criteria - the criteria used to search
manager. for jobs.
Note
To use theses activities, the FSO library must be included in the project.
Advanced FSO Indicates briefly and clearly in this acti Available functions - All availa
vity's title field the aim of this advanced ble functions for manipulating files and
manipulation required in file system. folders with FSO library.
Download file Downloads a file from a web or network Source URL- the URL of the source
URL. file to download.
Delete file Permanently erases a file File - full path name to the file to
be deleted. Use double backslashes
(\\), for example: C:\\myFolder\
\SubFolder\\myFile.ext
Read CSV Reads all entries from a specified CSV Source file - the name of the
(comma-separated values) file. source file to read with its absolute
path.
Read JSON Reads the content of a JSON (Java Source file - the name of the
Script Object Notation) file. source file to read, along with its abso
lute path.
Read text Reads the content of a text file. Source file- the name of the
source file to read, along with its abso
lute path.
Read XML Reads the content of a XML (eXtensible Source file- the name of the
Markup Language) file. source file to read, along with its abso
lute path.
Write CSV Writes a CSV (comma-separated val Source file- the name of the
ues) file. source file to read, along with its abso
lute path.
Write JSON Writes a JSON (JavaScript Object Nota Source data- the name of the var
tion) file. iable which contains data to store in
JSON (JavaScript Object Notation) file.
Write text Writes a text file. Source data- the name of the varia
ble which contains data to store in the
text file.
Write XML Writes an XML (eXtensible Markup Lan Source data- the name of the varia
guage) file. ble containing data to store in the XML
(eXtensible Markup Language)
Create folder Creates a new empty folder. This Folder - the full path of folder struc
action can be used to create ture to be created. The '\' character
multiple levels of new subfolders, must be duplicated. For example: C:\
such as C:\\NewParentFolder\ \NewFolder\\SubFolder1
\SubFolder1\\SubFolder2, etc.
In other words, an entire new folder
structure (tree) can be created in a sin
gle action; it is not necessary to create
each folder separately.
Flow
Caution
This action must be used
within a scenario.
Output The output value. Output value - the internal name of output
of this step.
Caution
This action can only be used
within a page and must be used
within a scenario.
Flow-If
Caution
This action can only be used
within a page.
Flow- Loop
Caution
This action must be used
within a scenario.
Exit Test block to exit from a loop. Exit condition - This is an 'expression' to
evaluate whether or not to leave the loop. Use:
Caution
• $item$ to perform a test on an item (exam
This action must be used ple: !$item$.exist()),
within a scenario. • $data$ to perform a test on data in the
context (example: $data$ == '').
Delay Delays execution for some millisec Delay - the number of milliseconds to wait be
onds. fore executing the code.
Timer Sets a timer that executes speci Delay - the number of milliseconds to wait be
fied actions once after the timer ex fore executing the code.
pires.
Caution
This action can only be used
within a page.
Wait semaphore Waits for a semaphore Semaphore - name of the previously declared
semaphore.
Wait until Waits until a test condition evalu Condition - expression evaluated every 250
ates to true. milliseconds, within the limit of 20 attempts. If
condition evaluates to false, polling is repeated.
If the condition evaluates to true, control passes
to the following statement. Use:
Caution
Mouse-click Simulates a mouse click on Win, Web, JavaSwing, UI au Item - name of item to use
an item. tomation, OCR, Flex. for this action.
X-coordinate - horizon
tal position (relative to item
top left position).
Y-coordinate - vertical
position (relative to item top
left position).
Get Gets the content on an item. Item - name of the item to use for this action.
Get table Gets the content of a table item. Item - name of the item to use for this action.
Keystroke Sets the content on an item (key Item - name of the item to use for this action.
stroke).
Source data - this is an 'expression'. Use:
Caution • $data$ to get data from the context (exam
Select Selects a value in the content of the Item - the name of the item to use for this
item. action.
Set focus Sets the focus on an item. Item - name of the item to focus.
This action can only be used • $data$ to get data from the context (exam
within a page. ple: $data$ + '+++')
• '…' to set a constant value (example: 'my
value')
Set Set the content of an item. Item - name of the item to fill with data.
Caution
This action can only be used
within a page.
Set table Sets data in a table. Item - name of the item to fill with data.
Data
Caution
Wait change Waits until the content of an Item - name of item to use
item changes for this action
Wait click Waits until the end user Item - name of item to use
clicks an item for this action
Wait exist Waits by polling until an item Item - name of item to use
exists. for this action
Wait focus Waits until an item gets the Item - name of item to use
focus for this action
Wait command
Comment
Account
Enumerate accounts Enumerate the accounts of the cur Variable- name of the context variable to
rent Outlook instance store the retrieved information in.
Accept appointment
Create appointment The generated appointment item Subject - subject of the appointment
will be set as current appointment
in the 'appointment context' after Body - body of the appointment. To start a new
wards if the property updateCon line use \r\n.
Decline appointment
Forward appointment Forward the current context ap "To” recipients - recipients must be
pointment. separated by semicolons, such as “email1@fac
tory.com; email2@factory.com; email3@fac
tory.com”. If you are using Active Direc
tory, “FirstName1 LastName1; FirstName2 Last
Name2; FirstName3 LastName3” can be used
instead of the email addresses.
Get status Gets the status of the current con Variable- name of the context variable to
text appointment. store the retrieved information in.
Update appointment Updates the current context ap Subject - subject line of the appointment.
pointment.
Body - body of the appointment message. To
start a new line use \r\n.
Required attendees
Optional attendees
Resources
Organizer
Appointment context filter Perform a selection of appoint Start after specific date - write a
ments which can be used later to date/time information to indicate that the ap
work on the items pointment must start after a specific date. Note
that this parameter depends on the language
and region. English: “12/25/20 4:30:00 PM”,
French=“25/12/20 16:30:00”.
Does current appointment exist? Returns true of the current context Variable- name of the context variable to use
appointment is existing, false oth for this action.
erwise.
Helper
Get information from time slot Get appointments information from Start date time - date and time to start
time slot. the appointment. Note that the value depends
on the language and region. English=“12/25/20
4:30:00 PM”, French=“25/12/20 16:30:00”, and
so on.
Store
Enumerate stores Enumerates the stores of the cur Variable- name of the context variable to
rent Outlook instance. store the result in.
Get items Gets values of all items on a Page - name of the page to
page. use for this action.
Highlight Highlights all detected items Win, Web, JavaSwing, UI au Page - name of the page of
in a page of an application. tomation, OCR, Flex. the application to use for this
action.
Wait close Waits until a page of an appli Page - name of the page to
cation is closed. use for this action.
Popup activities allow interaction with the user. This can be used for displaying informational messages or
prompting the end user for input. This input can be used during the execution of the scenario, such as asking
for a number of loops, for a file name, or to take alternative action based on their response.
• <br/> to insert a
breakline
• <b>text</b>
to put the text in bold
• <H4>My message
header</H4> to
mark a header
Value
Row number
Column code
Row number
Column code
Row number
Column code
Row number
Get row count Gets the number of rows in the ta Item
ble.
Number of rows
Get rows by column Gets all rows of values in the given Item
column, starting from the Start
Start row index
Row Index.
Number of rows
Column ID
Column code
Row number
Select toolbar menu item by text Clicks a toolbar menu item. Item
Note
You must use a Select
Cell or Select Row activity
to select a cell or row
before using this activity,
SelectContextMenuItemByText
Note Note
You must use a Select The ID of a menu item can be fetched using
Cell or Select Row activity the Recording and Playback option in the
to select a cell or row SAPGUI application.
before using this activity,
Record only the step of selecting the re
SelectContextMenuItemByText
quired menu item from the context menu.
Note Note
You must use a Select If there are SEPERATOR lines in the mid
Cell or Select Row activity dle of the context menu list, they must be
to select a cell or row counted to get the accurate position of the
before using this activity, required menu item.
SelectContextMenuItemByText
If the SEPARATOR is ignored while count
ing, the menu item selection will be incor
rect or fail to work.
Row number
Column code
End transaction
Note Page
Get all visible rows Gets all the visible rows present in Item
the table.
Where to store result
Get column names Gets the list of the column names Item
present in the table. If the column
contains an icon instead of text, the Where to store result
icon name is returned.
Get visible row count Gets the count of the visible rows in Item
the table.
Where to store result
Get maximum vertical scroll offset Gets the maximum value up to Item
which scrolling is possible with the
table. Where to store result
Get the vertical current position of Gets the current position of the Item
scrollbar scrollbar.
Where to store result
Scroll down by one row Scrolls down one row at a time and Item
a new row appears in the lower part
of the table.
Scroll to next page Scrolls to the next set of rows in the Item
GUI table control.
Note
The scroll moves to the given
row number while selecting the
row, making it the first in the
list of visible rows.
Select all visible rows Selects all specified visible rows. Item
Caret position
Check Item
Node key
Node key
Node key
Node key
Node key
Node key
Node key
Get node key by path Get the node's key using its path. A Item
node path is constructed using the
position of all the nodes that are Node path
traversed to reach your target node
Where to store result
in the same sequence appended by
'/'. Position (starts with 1) is simply
the position of the node at that level
in the tree.
Note
For bigger trees that are dy
namic and where node posi
tions tend to change, it is rec
ommended to use the follow
ing approach when creating the
bot:
Get node key by text Get key of the node using text. Item
Node key
Item
nodeKey (string).
Note
If there are SEPERATOR lines in the mid
dle of the context menu list, they must be
counted to get the accurate position of the
required menu item.
columnPosition (number)
Note
For tree types other than Column Tree, the
columnPosition parameter is not re
quired as it is not applicable.
Item
nodeKey (string).
columnPosition (number)
Note
For tree types other than Column Tree, the
columnPosition parameter is not re
quired as it is not applicable.
Item
nodeKey (string).
itemID (string).
Note
The ID of a menu item can be fetched using
the Recording and Playback option in the
SAPGUI application.
ColumnPosition (number).
Note
For tree types other than Column Tree, the
columnPosition parameter is not re
quired as it is not applicable.
Node key
Select/Unselect (true/false)
Node key
Uncheck Item
Node key
Add item
Calendar Item
Appointment title
Appointment subtitle
Appointment type
Start date
End date
Creation status
Previous Item
Source data
Press Item
Enter subheader
Source data
Source data
Set Item
Source data
Source data
Source data
Source data
Source data
Source data
Source data
Is checked Item
Uncheck Item
Source data
Start Starts a specified scenario. The Scenario - Name of the scenario to start.
data to use and manipulate with the
Data used with the scenario - This is an expres
scenario can also be specified.
sion. Use:
The “Wait end” option will launch
• “…” to use a constant value (example: “my
a scenario and wait until the sce
Value”),
nario terminates successfully. Once
the scenario terminates, execution
• … to use a user variable (example: my
Data).
continues with the next action.
Wait end - If true (in other words, if the option is
ticked), wait until the scenario ends.
Caution
This action must be used
within a scenario.
Comment
Setting value
Setting value
Set clipboard Places the specified text on the Message - the text message to be copied to
clipboard. The previous clipboard the clipboard. Use:
content is not saved.
• $data$ to use data from the context,
• “…” to use a constant value (example: “My
message”),
• … to use a user variable that must be de
clared beforehand (example: myMsg).
Set context Assigns a value to a variable of the Variable - name of the variable of the con
current defined context, and to up text to use for this action.
date it during a run. To set it to an
initial value, simply put the number Value - value to assign to the variable. This is
or text in the “Value” field. an 'expression'. Use:
Kill process Forces a running program to close. Process - The name of process to kill all run
All instances of a running process ning instances of. For example: iexplore.exe
are killed. The process to kill is
determined via the program filen
ame. If possible, use the close com
mand for an application or a page
because this allows the program to
shut down gracefully. “Kill process”
will shut the program down without
saving any changes or data. To use
this activity, the WMI library must
be included in the project.
Log Provides a method of adding your Message - the text message that is saved
entries to the log file and in the de to log and shown in the debug window. Only
bug window, with a severity level. strings are supported.
This can be used for many pur
poses, such as debugging scripts Level - The severity level of the message to be
and recording information. logged.
Read registry Reads a setting from the Windows Variable - name of the variable in which for
system registry. store the read result.
Sleep Freezes the execution of the cur Delay - the time interval for which execution is
rent thread until a time-out interval to be suspended, in milliseconds.
elapses.
Call SAP web service Calls an SAP web service. Source URL - the URL of the web service to
be called.
Call web service Calls a web service. Source URL - the URL of the web service to
be called.
Open Word Word filename - the word full file path and
name of the Word file.
Init Word
End Word
Release Word
Close Word
Text to replace
Save as Word Word filename - the word full file path and
name of the Word file.
Save Word
Set bookmark Set a bookmark with a value. Bookmark - the defined bookmark to set.
Formatting
Format font size Font size - the font size is a positive integer.
Clear formatting
Open PDF Opens the text-searchable PDF PDF filename - the full file path and name
document of the text-readable PDF file, surrounded by ' ',
such as 'C:\path\to\folder\MyPDF.pdf'.
Get number of pages Retrieves the number of pages in Variable - name of the variable of the con
the document text in which to store the result.
Get text Retrieves the complete text of the Variable - name of the context variable in
PDF document, or the subset of the which to store the retrieved text. Mandatory.
document defined by the Filter, if
used.
Create filter for text extraction Creates a filter for use in an extrac Page Range - the page or pages on which to
tion activity to restrict the opera apply the operation. Mandatory. Examples: "2"
tion of that activity to a specified for the second page, multiple pages: "1,3-7,10".
page range or a defined area of the
PDF page. Top offset - distance of the extraction area
or bounding box from the top of the page
Sequences can be easily controlled using the ‘waiting’ patterns (see Waiting [page 343]).
A scenario allows you to split a single complex control sequence into several simple sequences, called steps.
• Timeout management
• Centralized error management
Once you have defined the entities in our project (see The Declaration Phase: General Information [page 240]),
you need to design the control sequences.
Basically, sequence control consists in concatenating control actions on one or more controlled (supervised)
applications. This includes:
Waiting
Occasionally, a control action generates processing in the controlled application. Desktop Agent has to wait
until this processing is ended before executing the next action of the sequence. In other words, Desktop Agent
needs to synchronize with the application execution and continue with its own execution only when the target
application is ready to receive the next action in the control sequence.
Example 1 – Navigation
Functional description
1. Once page1 has been loaded, click the open_page2 button on page1
2. The application then loads page2
3. Get the value of the name field on page2
Technical description
1. Once page1 has been loaded, click the open_page2 button on page1
2. WAIT UNTIL page2 IS LOADED
3. Get the value of the name field on page2
Sample Code
page1.open_page2.click() ;
page2.name.get() ;
This control sequence will fail, because it is executed synchronously. After executing the click on the
open_page2 button, Desktop Agent will not automatically wait for page2 being loaded before executing the
get on the name field. So, you need to explicitly wait for page2 to be loaded before executing the next command
page1.open_page2.click() ;
page2.wait() // wait until page2 loads (pseudo-code)
{
page2.name.get() ;
}
In this case, Desktop Agent clicks the open_page2 button and then waits for page2 to be loaded before
executing the get on the name field, which is coded in the callback part of the wait() method.
Functional description
1. Once page1 has been loaded, fill the zipcode field of page1
2. The application processes this value to get the corresponding city name and fill the cityname field
3. The then get the value of the cityname field on page1
Technical description
1. Once page1 has been loaded, fill the zipcode field of page1
2. WAIT UNTIL THE cityname field has been computed
3. The then get the value of the cityname field on page1
Sample Code
page1.zipcode.set(zipcode_value) ;
page1.cityname.get() ;
This control sequence will fail, because it is executed synchronously. After executing the set on the
zipcode field, Desktop Agent will not automatically wait for the application to compute the cityname before
executing the get on the cityname field.
So, you need to explicitly wait until the cityname field has been computed before executing the next
command.
You can wait for some time before getting the value of the cityname field:
Sample Code
page1.zipcode.set(zipcode_value) ;
ctx.wait(some_time) // wait for some_time(pseudo-code)
{
page1.cityname.get() ;
}
This is a good solution, but not very reliable because you can't be sure you have waited long enough:
• If the wait is too short, you won't get the value of the cityname field if the application being controlled is
slow
Sample Code
page1.zipcode.set(zipcode_value) ;
page1.cityname.events.CHANGE.on() // wait until 'cityname' has
changed(pseudo-code)
{
page1.cityname.get() ;
}
This is the best solution: we wait until the application notifies that the cityname field content has changed.
Background
The first task when designing a control sequence consists of:
1. On the SearchPage, Desktop Agent enters the search criteria and clicks the Search button, which opens
the ResultPage.
2. Desktop Agent collects the search result from the ResultPage.
Once Desktop Agent has clicked the Search button, it must wait until the ResultPage is opened before
collecting the results on this page. We will design the following sequence:
Sample Code
Sometimes, waiting needs can be more difficult to identify (see Controlling Pages with Event-Driven UI Updates
[page 273]):
Once you have detected your sequence's waiting needs, you must find the best way to implement 'waiting'
code:
• The best way is to wait for a technical event notified by the controlled application.
• If you don't receive any appropriate technical event, you can wait by implementing polling (explained later).
• Finally, if polling is not available, you will have to use the wait some time method (explained later).
Technical Events
Synchronization is managed by waiting for receipt of a technical event. Technical events are notifications sent
by an application being controlled, resulting from events fired inside that application.
The flow of notified technical events depends on the running application workflow. It is not possible to
determine what and when technical events are notified by a supervised application. You can merely decide
to listen for them.
Application-Based Events
Page-Based Events
Item-Based Events
Each connector or technology implements its own set of technical events: Some are common to all connectors
and some are technologyspecific. A list of all trackable events is shown, for each declared element, in the
Track Events tool window (see The Explorer Perspective [page 9]. For the UI Automation connector, the
available item-based events are listed in Page-Based Events [page 96] ).
When you track an event, the relevant connector is informed that this event is expected. That doesn't mean
that it will be notified as expected. You need to verify notification by running the project in Debug mode and
playing the sequence through manually. Notified events are displayed in the Events view or the Scenario view of
the Desktop Debugger (see Debugging and Testing with the Debugger [page 432]).
Once you have found the appropriate technical event to wait for, you can implement the corresponding wait
code.
The Context
The context is a data manager that maintains all data arising during execution of a scenario - internal data of
the scenario or external data sent to or received by the scenario.
The structure of the context is automatically generated each time you add a Get/Set activity on an item in a
page:
This automatic generation option can, however, be disabled by unchecking "Generate context items" on the
Workflow tab in the Desktop Studio settings. The script developer is then responsible for creating all required
context items manually.
Note
Automatic generation of context items is recommended for less experienced scenario script developers.
In the below screenshot of the Context tool window, IO is an element of the context (in this case, a folder), and
its child elements are Customer and CreditValidation.
By default, when generating the scenario script, the Desktop Studio automatically adds a data manager
that refers to the context in the code via a script variable called rootData. It is added both to the code that
starts the scenario and to each step in which the data manager is retrieved. This variable helps developers
within the script to interact with the data manager in the code. If a developer selects a folder for its Input
DataManager property (e.g. IO), the script variable's name is changed to rootData_IO.
The Input DataManager property allows a developer to declare the data manager used within a scenario. It is
used to enable scenario reusability. It is typically a folder or subfolder of the context structure, such as the IO
folder in the context shown above.
If the Input DataManager property has been provided, the scenario script can only use this folder. However, if
the Input DataManager property is left empty, the whole context structure is used in the scenario script.
Tip
Using a custom Input DataManager means you are not moving all of the context back and forth in the cloud.
It is good practice to limit the quantity of data you send and receive in the cloud to only the data that your
project actually requires.
As explained above, the Input DataManager is used only for data management within a scenario. But
sometimes a bot requires the exchange of parameters between skills (see the Skills section in Designing
Processes), such as with a User Task in a Cloud Studio Process, or needs to send data to a scenario via an API
trigger or a Scheduled trigger. For this purpose, you can make entries in the Input and/or Output properties in
the Properties window (Input to receive data and Output to send data):
• If the developer has defined an Input DataManager, the dropdown lists display the elements of the context
that correspond to the Input DataManager's elements.
If the developer doesn't select anything for the Input or Output property (and there is no defined Input
DataManager), the entire context is used for that property.
Desktop Studio packages can be imported to the Cloud Studio in order to re-use the scenarios. During import,
the Cloud Studio automatically creates the required data types for each scenario in the package. The data
types are then available for various purposes, such as passing parameters between skills (scenarios, user
tasks, and processes) and for triggers and notifiers.
At Runtime
When a scenario is triggered by the Cloud Factory, the Desktop Agent instantiates the Input DataManager (or
if none was defined, the context), and where applicable, initializes it with data received from the Cloud Factory
(if defined by the scenario developer in the input properties, as explained above). When the Desktop Agent
has finished executing the scenario's script, it sends data back to the Cloud Factory (if defined by the scenario
developer in the output properties, as explained above).
Designing a scenario to control a complex sequence essentially consists of deciding how to split the sequence
into smaller subsequences. Here are some of the ways you can do this:
If you plan to reuse steps, it is important to define carefully in what state the step waits for the controlled
application and in what state it leaves it.
• On the SummaryPage, select each line of the Detail list and click on the Detail button
• Wait until the application opens the DetailPage
• Collect the data in the DetailPage and go back to the SummaryPage
• Loop until you have collected the data on each line
• Step st_Start
Navigate to SummaryPage
• Step st_Loop – Input : SummaryPage is loading – Output : SummaryPage is loading
Wait until SummaryPage loads
• If there are no more detail lines, jump to step st_End
• Select the next detail line
• Click the Detail button
Wait until the DetailPage loads
• Collect the data in the DetailPage
Related Information
Related Information
Sample Code
The parameter of this method is a callback function (named step handler), where you implement the code to
be executed when the step starts. This callback receives the following parameters:
Note
• Initialization code
• Controlling code
• Event handlers
• and so forth
Make sure that code implemented outside Event handlers is executed when the step starts.
Sample Code
Calling endStep without parameter starts the next step declared in the scenario list (see Declaring Scenarios
with Desktop SDK [page 354].)
If the step is the last one in the scenario list, the scenario automatically stops
Example:
Sample Code
Note
• Calling endStep() synchronously starts the next step and then executes its initialization code.
• Calling endStep() ends the step but doesn’t exit from handler. Code implemented after the call to the
endStep method is executed.
• Any Event handler set inside the step is reset when the step exits (whatever it has been called or not).
There is no risk that an Event handler is called after the step has ended.
• You can force the next step started by setting it as parameter (see Managing Loops and Conditional
Switches in Scenarios [page 356]).
Sample Code
A scenario handler contains code that will be executed when the scenario starts. This callback receives the
following parameters:
Note
• An optional onTimeout handler which is called if a timeout appears (see Managing Timeouts in Scenarios
[page 361]).
• An optional onError handler which is called if an error occurs (see Managing Errors [page 360]).
• Initialization code (for example, Starting mode)
• A list of steps that are concatenated and started sequentially during scenario execution.
Sample Code
Note
• You may declare steps prior to setting the steps list, in order to get IntelliSense in Desktop Studio.
• You can use the stu + TAB snippet to use an existing step inside a new scenario.
The scenario’s starting mode determines what appends when the scenario starts. You can set the
starting mode using the setMode method. The main available modes are as follows (see Enumeration
e.scenario.mode ):
Related Information
If you're using activities when designing your scenario through code, you need to follow some guidelines to
avoid merge conflicts.
Indeed, parts of code are generated from the activities. In case of localization changes (for example to use a
different language), the data generated from an activity changes, which brings a risk of conflict that can not
always be solved by the merger tool.
To avoid merge conflicts, always set manually your own step name, instead of using the default step name that
comes from the name or the description of the activity.
It is possible to implement conditional jumps or loops within a scenario. You can simply do this by stating the
next step to start in the endStep method.
Sample Code
When starting a scenario instance, a user data object, accessible via the data property, is generated
automatically. This user data object is freely usable by developers to store data for the duration of the scenario
instance.
Sample Code
Sample Code
In the case of sensitive information, you may not want the data to be displayed externally, for example on the
controlling page of SAP Intelligent Robotic Process Automation Factory. If so, use sc.localData instead of
sc.data in the generated code to keep the data locally.
Sample Code
sc.localData.credential = {};
ctx.cryptography.credentials.SAPGUI.get(function(code,
label, credential) {
if (code == e.error.OK) {
sc.localData.credential.user =
credential.userName.get();
sc.localData.credential.password =
credential.password.get();
sc.endStep();
} else {
sc.setError( e.error.KO, "Getting credential
failed!" );
sc.endScenario( );
}
return;
});
}});
// Do login ...
}})
Sample Code
myApplication.scenarios.scMyScenario.start([data]);
• When a scenario starts, the first step declared in the scenario is started.
• When a step ends (‘endStep()’ is called), the next step is started.
• When the last ends, the scenario is stopped.
Sample Code
Related Information
Sample Code
sc.endScenario();
You can stop all running scenarios for an application (or process) using the clearAll method:
Sample Code
You can stop all running scenarios using the runningScenarios property:
Sample Code
Note
<application>.scenarios will give a list of declared scenarios rather than running scenarios.
If necessary, you can set an onEnd handler on a scenario, which will be called when the scenario ends
Sample Code
myApplication.scenarios.myScenario.start().onEnd( function(sc)
{
ctx.log('scenario [' + sc.name + '] has ended with code: ' + sc.code);
});
Note
WIth the Javascript try … catch pattern, you can catch exceptions for specific error management. Uncaught
exceptions are automatically caught by the Desktop SDK framework, which generates an error message in the
logs.
This default error management is generally not appropriated when errors occur in a control sequence. In most
cases, the required error management method is as follows:
You can easily implement this default error management by setting a default error handler in a scenario. To do
this, set the onError handler in the scenario handler:
Sample Code
The generated implementation of the onError handler simply stops the scenario: this behavior can be changed.
If required in a step, you can override the scenario’s default error handler by setting a default error handler in
the step.
Sample Code
Note
You can still explicitely catch exceptions in your code. These exceptions will not be routed to the default
error handler.
Tip
To change your timeout values, we strongly recommand setting timeout values in the Workflow Perspective.
For more information, see Setting Timeout Values [page 289].
Caution
If you manually change the Timeout value in the Editor Perspective, the new value won't be taken into
account. Only the value you set in the Workflow Perspective will be displayed.
Caution
Do not write asynchronous code or long synchronous code in these blocks, you can have inconsistent
behavior between the agent and the factory.
Sample Code
Sample Code
• Use sub-automations
You must add the below code on every step.
The best way to manage these errors is to use sub-automations and use the sc.code result. When you use
a sub-automation you can retrieve the result code of the sub-automation to try again or do other actions. In
the sub-automation no need to add ctx.wait or try catch, onError and onTimeout callback will be executed
in the sub-automation and the result code will be affected.
Sample Code
GLOBAL.scenarios.scSubautomation.start(undefined).onEnd( function(scData)
{
if(scData.code == e.error.KO)
{
sc.endStep("errorManagement");
return;
}
else if (scData.code == e.error.TimeOut)
{
sc.endStep("timeoutManagement");
return;
}
sc.endStep(); // end Scenario
return;
});
}});
For more information about Error Timeout Waiting for Script Execution in SAP Intelligent RPA, see the
following note 2999270
You can activate it on a scenario by setting the onTimeout handler in the scenario handler:
Sample Code
This indicate that the execution duration of any step of the scenario must not exceed the timeout delay (in ms).
If that happens, the onTimeout handler will be called. This callback receives the following parameters:
The generated implementation of the onTimeout handler stops the scenario, but you can change this behavior.
Note
Sample Code
Note
In this case, the job timeout comes from the workflow and not from the code.
There are two ways to change default timeouts for steps and scenarios:
If you change timeout values in scripts, this change is taken into account during the debug mode.
However, when the bot will be launched from the Cloud Factory (either in attended or unattended modes),
these new values will not be taken into account. The job will expire after the timeout indicated in the related
workflow (generally 10 minutes after, as this is the default value).
The best practice is to always update timeout values from the Workflow
section. If you udpate from this section, you also update scripts. New
values are thus taken into account in both debug and production executions.
Remember that timeout in the code and timeout in the workflow are different:
When you create the workflow for the first time and as long as you keep using the merging tool, the timeout
may stay synchronized. Once you start modifying the code and especially the timeout, timeouts of the
workflow (in the UI) and of the scenario (in the code) are desynchronized.
Sample Code
Modifications of the code never modify the workflow. So, this can lead to a possible desynchronization. If there
is no merging tool, updates of the workflow timeout may not be considered. If the Agent (script) timeout is
greater than the workflow timeout and if the effective time of the bot is greater that the workflow timeout, then
the Factory decides that the job must expire. This also means that the Agent is out of range and won’t try to
communicate with the Factory anymore. For the Factory, the Agent is disconnected.
The job may keep running on the Agent side, especially if:
• Some synchronized code keeps running. This prevents the Agent from getting news from the Factory.
• The Agent gets stuck and does not respond anymore. This prevents the Agent from getting news from the
Factory.
To make sure that your workflow timeout is properly updated, you can also check in the key.xml of the
exported version.
Sample Code
<WORKFLOWS>
<WORKFLOW Name="synchronousLoop" Src="%workflows%\synchronousLoop.xaml"
CtxtId="082683cd-1868-4151-9552-ec7036c2b683"
DisplayName="synchronousLoop" StepTimeout="30" ScenarioTimeout="60"
GeneratedScenarioName="synchronousLoop" />
<WORKFLOW Name="asynchronousLoop" Src="%workflows%\asynchronousLoop.xaml"
CtxtId="21e817af-425f-4a1a-a3a8-1745e0b4a522"
DisplayName="asynchronousLoop" StepTimeout="30" ScenarioTimeout="600"
GeneratedScenarioName="asynchronousLoop" />
</WORKFLOWS>
You sometimes need to increase the timeout of your sub-scenario because it executes tasks for a long period of
time.
If you increase the timeout of your sub-scenario(s), make sure that the step timeout of the main scenario is
higher than the timeout of the sub-scenario(s). All scenario timeouts must be higher than any of their step
timeouts.
We do not recommended you to put a high value for step and scenario timeouts. The best practice is to have
scenarios which run in less than 10 minutes. For more information, see Disabling Timeout [page 368].
If the timeout of the sub-scenario is not properly managed by the main scenario, it will be ignored. Moreover,
the main scenario will continue its execution, even if this is not the desired behavior.
To avoid this behavior, you must verify in the onEnd callback function that the ev.code parameter equals OK.
If it does not equal OK, you can consider that the sub-scenario has failed, and you can perform the appropriate
behavior for the main scenario.
Sample Code
GLOBAL.scenarios.NestedWorkflow.start(undefined).onEnd( function(ev) {
if (ev.code == "OK") {
If you need the user to interact with an application, then you might wonder how long the user will take to do
this. It may be quick or take an undetermined amount of time.
In this case, it’s possible to disable the timeout for a particular step, using the disableTimeout() function.
This function disables the default timeout for this specific step.
Sample Code
In the next step, the default behavior will be reused. For steps which don’t require a user interaction, using this
function with scenarios which take a lot of time to be executed is not a best practice. You should estimate the
time of execution of the scenario and change the timeout value depending on this criterion.
Keep in mind that having scenarios which last more than 10 minutes is not a best practice. If your scenario
processes several lines of an Excel file and takes more than 10 minutes to end, you should not use the
disableTimeout() function or put a big value for the timeout. The best practice is to use several jobs to
process the Excel file.
Context
Environment variables in SAP Intelligent RPA Factory are the properties of an environment, re-usable across
multiple projects, packages, and scenarios. Environment variables aim to retrieve common or shared elements
such as credentials for instance.
Procedure
1. Create a text or a credential environment variable in SAP Intelligent Robotic Process Automation Factory.
For more information, see Environment Variables for the Desktop Studio.
2. In the code of the scenario, declare the text or credential environment variable using the following syntax:
Caution
You must declare environment variables in your scenario with the exact same name than the one
defined during the creation in the Factory.
• Declare a text environment variable named MyVar, stored in an environment on the factory
Sample Code
ctx.setting({ MyVar: {
key: ctx.cryptography.keys.none,
comment: "Test variable",
server: true
}});
Sample Code
ctx.cryptography.credential({ MyCred: {
key: ctx.cryptography.keys.none,
comment: "Test credential",
server: true
}});
3. To retrieve the value of the text or credential environment variable, use the following:
Sample Code
Results
SAP Intelligent Robotic Process Automation supports the automation of applications hosted in a Citrix or a
Microsoft RDP environment.
Important Information
Sometimes users need to access applications that are not available on their local machines but only in a Citrix
or Microsoft RDP environment. If you want to develop scenarios to meet this need, there are a few things you
need to know:
• It is not possible for the Cloud Factory to send a job to a specific remote session of a specific user. So the
main scenario of a job runs on the user's local machine and communicates with the job run by an agent in
the remote environment. Data can be passed between the local and remote environments, and user input
can be obtained in the remote environment.
• Desktop Agent needs to be installed on the remote machine as well as on the user's local machine.
• When you develop a scenario and capture an application that will later be executed on a Citrix or RDP
machine, you need to capture that application while it is running in the corresponding remote environment.
That means that Desktop Studio must also be installed in that environment.
• At the Cloud Factory end, you need to define a hierarchy for the user that includes a local machine and
a Citrix or RDP machine. If the user employs the same login to connect to the Citrix or RDP session and
locally, you can define a login hierarchy for the user containing just one node.
• To communicate between remote and local environments, create corresponding local and remote
processes in the project, and use the notify method to send functional events from one to other.
Related Information
Context
In this example project, a reference ID from a local Microsoft Excel file is passed in a loop to the CRMWinForm
application running on a Citrix server, and used by that application to search for and return address data, which
is then written to the Excel file.
Note
Procedure
Select Add a New Process … from the context menu in the Projects tree of the Editor perspective.
In the dialog box, you can choose to create the process in a separate project source file. If you name your
process LOCAL, for example, a file named LOCAL.pspc is created in the app folder of the project (see
Project Structure and Organization [page 60]).
The new process is added to the Scripts tree and the Project tree in the Editor perspective, and some code
is automatically generated for its context data structure.
For more information on context data structures, see Managing Data [page 347].
3. Set the application parameter Server to Citrix or RDP.
4. Create the main scenario, scReadExcelAndSearch, which will do the following:
a. Initialize the Microsoft Excel application.
b. Open an Excel file.
c. Get values from the file.
d. Set the Excel data into an array.
e. Initialize an index for looping.
f. Start the loop.
g. Read a row from the Excel spreadsheet.
h. Start the scSearchAddressCRM scenario.
i. Set values into cells.
j. Increment the index.
k. Exit the loop if the exit condition is met, or loop again.
l. Release the Excel file.
5. In the Properties window, set the Input Data Manager for scenario scReadExcelAndSearch to
CRMWinFormData.
6. Add a local functional event to the code - evSendAddress - which will be defined later.
Sample Code
7. Add and define a server event that starts the scSearchAddressCRM scenario of the local workflow and
then notifies the local server to start the evSendAddress functional event with the search data obtained.
Sample Code
GLOBAL.scenarios.scSearchAddressCRM.start(rootData_CRMWinFormData).onEnd( f
unction(scSearch) {
SERVER.notify(LOCAL.events.evSendAddress, scSearch.data);
});
});
8. In the Workflow Perspective, for the scenario scReadExcelAndSearch, select the activity Start
'scSearchAddressCRM', and set the activity property Data used with the scenario to
CRMWinFormData.
9. Create a global workflow step to notify the Citrix server to run the evSearchAddress event and to pass
the Reference ID to the Citrix server. The local evSendAddress event is also defined in this step.
Sample Code
LOCAL.notify(SERVER.events.evSearchAddress,
{referenceId:rootData_CRMWinFormData.pMainData.oReferenceId});
LOCAL.events.evSendAddress.on(function(ev) {
var data = {};
sc.localData.result = ev.data.pMainData;
rootData_CRMWinFormData.pMainData =
ctx.dataManagers.rootData_CRMWinFormData_pMainData.create();
sc.endStep(); // Set_cell
});
}});
10. Define the scSearchAddressCRM scenario that will call corresponding scenario steps to start the
CRMWinForm application, set the Reference ID, click Search, and retrieve information from CRMWinForm.
Sample Code
Business Activity Monitoring (BAM) allows you to insert statements in your scenarios with data sent by your
SAP Intelligent RPA Agent to the Cloud Factory, when the scenario runs.
Cloud Factory will allow you to download a CSV file with useful information about your running scenarios.
The Business Activity Monitoring information is different from the Monitoring view in the Cloud Factory
because it displays data that you choose to generate. For example, you may choose to display how much
time your SAP Intelligent RPA Agents spend accessing a specific application, such as SAP S/4HANA. Or you
may choose to display which machine is used most often to run a particular scenario.
Related Information
Procedure
Note
There are three types of statements. For a complete description of the different statements, see
Alert statements allow you to send a message, a warning or an error while your scenario is running.
Prerequisites
You have entered this line of code. It is required before sending any notifications:
// sets the user name and machine name from the global context
ctx.monitor.setUserVariables(ctx.options.userName, ctx.options.computerName, '');
Sample Code
The parameters in brackets represent the information that will appear in the CVS file you will download in the
Cloud Factory. These parameters include:
• "name"
• Choose the name for the notification. We strongly recommend that you pay attention to the name you
give to your alert statement, in order to find it easily.
• The maximum size should be 256 characters.
• "urgency"
• Free text. For example ("Info", "Warning", "Error", … )
• The maximum size should be 50 characters.
• "status"
• Free text. For example ("OK", "KO", "Success", "Fail" … )
• The maximum size shoud be 50 characters.
• [Optional]"data":
• Write your text data for the notification.
• There is no maximum size for this parameter. However, the total value of all the parameters together
should not exceed 50000 characters.
Counter statements allow you to send a notfication about an identified counter and its value. Each time a
counter statement is sent, the given value is stored along with a timestamp. In practice, this means you can
count objects or how many times specific actions occur.
Prerequisites
// sets the user name and machine name from the global context
ctx.monitor.setUserVariables(ctx.options.userName, ctx.options.computerName, '');
Sample Code
The parameters in brackets represent the information that will appear in the CVS file you will download in the
Cloud Factory. These parameters include:
• "name"
• Choose the name for the notification. We strongly recommend that you pay attention to the name you
give to your counter statement, in order to find it easily.
• The maximum size should be 256 characters.
• "category"
• Choose a category, as a text string.
• The maximum size should be 50 characters.
• "value"
• Choose a value for the counter, as a text string.
• The maximum size should be 50 characters.
• "data":
• Write your text data for the notification.
• There is no maximum size for this parameter. However, the total value of all the parameters together
should not exceed 50000 characters.
You can count the number of times the scenario has gone through a certain piece of code.
Timer statements allow you to start timers, reset timers, and split timers. You begin with a start timer
statement and in subsequent statements, you can split the timer or finally reset the timer.
Start timer statements allow you to start a timer. You begin with a start timer statement and you can use the
same name for subsequent timer statements (split or reset timer statements).
Prerequisites
You have entered this line. It is required before sending any notifications:
// sets the user name and machine name from the global context
ctx.monitor.setUserVariables(ctx.options.userName, ctx.options.computerName, '');
Sample Code
The parameters in brackets represent the information that will appear in the CVS file you will download in the
Cloud Factory. These parameters include:
• "name"
• Choose a name for the notification.
• The maximum size should be 256 characters.
• "step"
• Choose a name for the step in the timer.
• The maximum size should be 50 characters.
• "minimum"
• Set a minimum value in milliseconds. If subsequent timer statements start before this time value, there
is no notification.
• "maximum"
• Set a maximum value in milliseconds. If subsequent timer statements start after this time value, there
is no notification.
Note
The type of information you write depends on the position of the parameter. For example, if you write the
"name" of your notification in second position, the information will be registered as the name of the "step".
Note
Some parameters do not have a maximum size. However, the total value of all the parameters together
should not exceed 50000 characters.
Split timer statements allow you to send an intermediate duration for a previously started timer.
Context
The split timer allows the Agent to send a message counting how much time passes between the execution of
the start timer statement and the execution of the split timer statement.
Prerequisites
1. You have entered this line. It is required before sending any notifications:
// sets the user name and machine name from the global context
ctx.monitor.setUserVariables(ctx.options.userName, ctx.options.computerName,
'');
2. You have set a start timer.
Sample Code
The parameters in brackets represent the information that will appear in the CVS file you will download in the
Cloud Factory. These parameters include:
• "name"
• Choose a name for the notification. The name must match a previously started timer.
• The maximum size should be 256 characters.
• "step"
• Choose a name for the step in the timer. The name must match a previously started timer.
• The maximum size should be 50 characters.
• "status"
• Free text. For example ("OK","KO","Success","Fail"...)
• The maximum size should be 50 characters.
• [Optional]"data"
• Write your text data for the notification.
• [Optional]"force send"
• Enter a boolean variable. A notification is sent even if there is no initProcess.
• [Optional]"reset timestamp"
• Enter a boolean variable. It resets the timer to zero.
• [Optional]"minimum"
• Set a minimum value in milliseconds. If subsequent timer statements start before this time value, there
is no notification.
• [Optional]"maximum"
• Set a maximum value in milliseconds. If subsequent timer statements start after this time value, there
is no notification.
The type of information you write depends on the position of the parameter. For example, if you write the
name of your "step" in third position, the information will be registered as the "status" of your statement.
Note
Some parameters do not have a maximum size. However, the total value of all the parameters together
should not exceed 50000 characters.
Reset timer statements allow you to reset a previously started timer statement without sending a notification.
Prerequisites
1. You have entered this line. It is required before sending any notifications:
// sets the user name and machine name from the global context
ctx.monitor.setUserVariables(ctx.options.userName, ctx.options.computerName,
'');
2. You have set a start timer statement.
Sample Code
ctx.monitor.resetProcessNotification("A1");
The parameter in brackets represents the information that will appear in the CVS file you will download in the
Cloud Factory. The parameter is:
• "name"
• Choose a name for the notification. The name must match a previously started timer.
• The maximum size should be 256 characters.
Three options allow the Agent to monitor the duration between timer statements. The Agent creates a file
locally where it stores notifications about the statements actions, before it sends them to the Cloud Factory.
Note
To learn where to set these options, see Use BAM in a Project [page 374].
To change this value, insert a code like the following and set a value in milliseconds:
Sample Code
ctx.options.monitor.localCache.parseVeryShortDelay = 1000;
Short Delay
If one of the notifications in the file sent by the Agent to the Cloud Factory is invalid, the Agent will slow down
and use the short delay instead. The default time value is 30 minutes.
To change this value, insert a code like the following and set a value in milliseconds:
Sample Code
ctx.options.monitor.localCache.parseShortDelay = 1000;
Long Delay
If too many messages are sent at once, the Cloud Factory notifies the Agent and protects the service from
excessive messages.. The Agent will slow down and try to send the extra messages with the long delay. The
default time value is 4 hours.
To change this value, insert a code like the following and set a value in milliseconds:
Sample Code
ctx.options.monitor.localCache.parseLongDelay = 1000;
Context
By default, each new script is included in the GLOBAL process. If you want to include a new script in another
application, right-click the application node in the Project tree and select Add a new Script.
Note
This is required for backwards compatibility; there is no particular advantage in including a script in an
application rather than in the GLOBAL process.
Procedure
1. Right-click outside any node of the script tree and select Add a new Script.
The following dialog appears in which you can enter the file name, the name that will appear in Desktop
Studio, and any comments.
If you enter an existing file name is used, the corresponding script is included in the project. The file
content remains unchanged.
To enable breakpoints to be inserted into the new script, the script must have a unique name.
2. Click Ok to validate your entries.
The new script file is physically created in the “local” subdirectory of the project (see Project Structure and
Organization [page 60]).
Context
You can use this procedure to edit a script. If you want to edit a framework or library script, you require special
authorizations. These scripts are usually displayed in read-only mode.
Procedure
If you double-click a MapItem node in a script (such as a function or scenario), the script opens in edit mode
and the system automatically navigates to the corresponding code block within the script.
If the script is already open in a code editor, the instance is brought to the front. Otherwise, a new instance is
opened with the selected script in edit mode.
Context
You can add a script to an existing folder or create a new folder and add your script there. The folder is not
physically created on the disk; it is a logical folder only.
Note
You cannot add folders to other folders. Only single-level folders are supported.
Procedure
Proceed as follows:
Option Description
Add a script to a new 1. Right-click the script node in the script tree and select Create Folder.
folder
Desktop Studio creates a new folder and moves the selected script into it.
2. Rename the folder by selecting it and pressing F2 .
Move a script to an ex Drag and drop the script to the folder node in the script tree. (To move a script out of a folder, drag
isting folder and drop it from the folder in the script tree.)
Context
Changing the name of a script in Desktop Studio only changes the logical name. The name of the physical file
containing the script is not affected.
Procedure
Procedure
1. Right-click the script node in the script tree and select Exclude Script.
2. Confirm your decision.
Context
Procedure
1. Right-click the script node in the script tree and select Delete Script.
2. Confirm your decision.
Although not recommended, you can directly edit the XML code that describes the list of scripts.
Context
Caution
If you follow this procedure and leave the XML code open, it will not be synchronized with any further
modifications made in the project tree. To avoid losing modifications, save and close the editor as soon as
possible.
Procedure
1. Double-click the SCRIPTS node of the GLOBAL process in the project tree.
When creating a new SAP Intelligent RPA project with the standard template, a systray is created by default,
containing standard menus, such as Stop and About box.
Initialize Systray
Systray initialization is performed once the engine is started, in other words, inside a GLOBAL:START handler.
Sample Code
Note
Sample Code
GLOBAL.events.START.on(function (ev)
{
// menu and sub-menus
systray.addMenu('', 'MainMenu', 'Main menu');
systray.addMenu('MainMenu', 'evMenu1', 'Menu 1');
systray.addMenu('MainMenu', 'evMenu2', 'Menu 2');
});
You can load bitmaps to be added as menu icons using the loadImage method:
Sample Code
GLOBAL.events.START.on(function (ev)
{
systray.loadImage('stop', 'FILE', e.popup.icon16.stop);
systray.loadImage('factory', 'FILE', '/bmp/factory.png');
...
systray.addMenu('MainMenu', 'evMenu1', 'Menu 1', 'factory');
});
Sample Code
<RESOURCES>
<!-- bitmaps -->
...
<RESOURCE Name="factory 16px" Src="%sdk%
\templates\resources\bmp\factory.png" Dest="bmp" />
</RESOURCES>
To handle the activation of a menu item, set a menu handler using the on method:
Sample Code
If the function is simple enough, the menu declaration and the implementation can be managed in a single
function:
Sample Code
You can add test menus that only appear in Debug mode (hidden in production mode) using theisDebug
property:
Sample Code
if (ctx.options.isDebug) {
systray.addMenu('', 'TestMenu', 'Test Menu');
systray.addMenu('TestMenu', 'evTestVariables', 'Test Variables');
...
}
• During execution, the systray can be modified to reflect state changes using the show method:
Sample Code
// hide systray
systray.show(false);
Sample Code
// check menu
systray.check('evScnAppStartScn', true);
Sample Code
// disable menu
systray.enable('evScnAppStartScn', false);
• The systray icon can be changed dynamically using the createSystrayMenu method:
Sample Code
GLOBAL.events.START.on(function (ev) {
// create systray and load two icons
var projectIcon2Enabled = false;
ctx.options.projectIcon = '/bmp/chart_pie.png';
systray.loadImage('ICON1', 'FILE', ctx.options.projectIcon);
systray.loadImage('ICON2', 'FILE', '/bmp/record.png');
systray.createSystrayMenu(ctx.options.projectName, 'ICON1');
Systray Balloons
A tooltip balloon can be displayed above the Desktop Agent systray icon using the showBalloon method:
Sample Code
// show balloon
systray.showBalloon(ctx.options.projectLabel
, 'Ready for testing...'
, e.systray.iconType.Warning
, 10000);
Note
Tooltip balloons can be disabled or hidden by the user at runtime. That means tooltip balloons should not
be used for important information, but only for progress indications, for example.
Menu Bar
A menu bar is a basic Windows menu displayed at the top of the screen.
• The main difference is to create the object by calling createBarMenu instead of createSystrayMenu.
• Adding and modifying menus is then done the same way
• The text of the Label can be modified by using the setTitle method.
Sample Code
You can easily display various types of message box using Desktop SDK popups. For a detailed description of
using Desktop SDK popups, see Managing Popups With Desktop SDK [page 397].
Sample Code
Sample Code
Sample Code
Sample Code
• Display a popup with a waiting message in the bottom right corner, with sliding effect.
• Execute controlling.
• Close the popup when controlling is finished.
Sample Code
// Execute controlling
....
• Display a popup with customized HTML content including javascript code and links.
• Wait until the user closes the popup by clicking on one link.
Sample Code
Sample Code
You can easily display various types of tooltips using the tooltip method.
• Display a tooltip associated with the ‘myField’ field of the ‘myPage’ page
• Highlight this field
• Automatically close the tooltip and remove the highlight after three seconds
Sample Code
myAppli.myPage.myField.tooltip({
message: "<b>Equipent type</b><br/>Select some equipment",
icon: e.popup.icon32.user,
color: e.popup.color.Blue,
autoClose: 3000,
highlightColor: ctx.rgb(20, 20, 150)
});
• Display a tooltip with an error message associated with the ‘myField’ field of the ‘myPage’ page
• Highlight this field with a red border
• Automatically close the tooltip and remove the highlight after three seconds
Sample Code
var timer=3000;
// Display the tooltip with error message
// Highlight
myAppli.myPage.myField.highlight(timer);
Sample Code
timer = 10000;
var color = ctx.rgb(0, 0, 0x80);
var address = data.address + ' ' + data.ZIPCode + ' ' + data.city;
CRM.pCRM.edAddress.tooltip({
template: e.popup.bootbox.Maps,
maps: {
zoom: 14,
CRM.pCRM.edZIPCode.tooltip({
template: e.popup.bootbox.Maps,
maps: {
streetview: true,
zoom: 1,
width: 500,
height: 350,
address : address
},
fade: 1000,
autoClose: timer,
XRelative: e.popup.position.Right,
YRelative: e.popup.position.Bottom,
highlightColor: color
});
CRM.pCRM.edCity.highlight(timer, true, true, color);
HTML-Based Content
Desktop SDK popup content is an HTML page.
Desktop SDK implements the concept of a popup template. This overcomes the need to develop an HTML page
whenever you require a popup.
Sample Code
where:
If a popup instance with the same popup name has already been created, this existing instance is returned.
Note
• Be careful when using popup names. If you use the same name for all popups, you create only one
popup instance. Customization made for one popup remains unchanged for the next one until it is
modified
• A template name can be provided later, using the init or the open methods,
• You can use the ctx.popup + TAB snippet to automatically generate code.
A popup can be customized by setting some of its properties values using the init method (or directly using the
open method)
where:
Note
If the popup size and position are not set, they are automatically calculated by the Desktop SDK.
The set of properties available to customize the display inside the popup depends on the template used. Here
is a subset of available properties:
Attributes Description
As mentioned early, you can use a specific HTML page instead of the predefined Desktop SDK Templates.
This is done by setting the <url >property with the path of the specific HTML page:
Sample Code
url: '/popup/myPopup.html',
To use parameters from the SAP Intelligent RPA script inside the HTML page:
When the HTML page is loaded inside the popup, the properties set on the popup object are transmitted to the
HTML page so that content is initialized.
Sample Code
Sample Code
function initialize(properties)
{
var myParamValue = properties.myParam ;
// Customize myPopup.html content base on myParamValue
...
}
Sample Code
For more examples for Message Boxes, see Display Message Boxes [page 390].
Sample Code
Sample Code
where:
Note
• You can customize the popup using the init method or using the open method.
• If you call the open method on a popup that is already open, the popup is simply updated with the new
property values.
The mode of how the popup is opened (modal or modeless) is set by the ‘modal’ property:
• In Modal mode, the JavaScript code is blocked on the open call until the popup closes
• In Modeless mode, the open call returns immediately; an asynchronous handler can detect window
closure. The method popup.waitResult(…) is called in an asynchronous style.
The ‘Modal mode’ is not recommended because it locks any SAP Intelligent RPA treatment until the popup is
closed.
Note
• An open modeless popup can be closed at any time using the close method.
• A modal popup cannot be closed by code as SAP Intelligent RPA treatment is blocked on the ‘open’
call.
It is not possible to force a popup to be on the top of a specific application. However, you can force a popup to
be on the top of all applications using the ‘topmost’ property:
Sample Code
3.13.4 Wait Until the Popup Closes and Get the Popup Result
You can wait until the popup closes using the waitResult method:
Sample Code
myPopup.open();
myPopup.waitResult(function(res)
{
// myPopup has closed : make treatments
...
});
By calling the waitResult method, you set a callback that will be called when the popup is closed. If the popup is
already closed when calling the waitResult method, the callback is triggered immediately.
The callback receives an object as parameter. It contains the popup result. This result depends on the template
used:
UI Designer Overview
Desktop Studio includes a UI Designer perspective. This perspective makes it possible to graphically design:
• Input Forms
• Custom pages
• Application bars
For simplicity's sake, all these types of UI will be referred to as custom pages.
For a complete description of this perspective, see The UI Designer Perspective [page 33]
Principles
Using UI Designer, every custom page is an empty HTML page whose content is dynamically built using
JavaScript code. When you edit a custom page, UI Designer displays it graphically in an embedded Internet
Explorer window (the Design view[2]).
Graphic/JavaScript Design
When you graphically design your page, UI Designer automatically generates the JavaScript code in the
settings.js file.
If you prefer, rather than editing the page graphically, you can edit the settings.js file [3]. When you save it, the
Design view and the Resource tree are automatically updated to reflect your changes.
• If you make errors in JavaScript code, rendering will fail with scripting errors.
• You then have to find your error(s) to be able to continue your design.
Custom pages are displayed in the Activities window, in the Pages tab item, under the POPUPS application. To
be displayed there, a custom page must first be captured ( ).
Sample Code
POPUPS.myPopup.myItem.set(theValue);
Sample Code
Sample Code
POPUPS.myPopup.myItem.click();
• Creates, if necessary, a subdirectory for the new page in the ‘local’ folder of your project.
• Creates the following files in this subdirectory:
• Popup.html: This is the empty HTML page
• Settings.js: This is the javascript file containing the design of the page
• ‘Popup.js’ and ‘Popup.css’: allows you to customize the page behaviour and the style sheet (see
Advanced Techniques for Custom Page Design [page 417])
• Position
• CX, CY: width and height of the page. A red rectangle is displayed in the Design View [2] to make it easy
to set these properties.
• Display: when using multiple screens, this allows you to choose on which screen the page is displayed
• Html content:
• template : choose ‘AppBarHorizontal’ for a horizontal AppBar, or ‘AppBar’ for a vertical one
A row can contain columns, each column having a width of between 1 and 12 units.
With Design mode active ( ), right-click within the page to add container items (containers, rows, columns,
and so forth).
Each new item is added to the Resource tree [1], under the Items node. The item subtree reflects the structure
of the grid.
You can change this grid structure via drag&drop in the Resource tree.
A column has four different width properties, one for each type of computer
You can set a different width value for each property. Alternatively, you can only set one value, leaving the
others as 0. This way, UI Designer will then use this value for all types of computer.
Create Items
With Design mode active ( ), right-click within the page to add items (such as a button). Each item is mapped
to a Bootstrap component).
Each new item is added out of the grid, under the Items node. The Item subtree reflects the item hierarchy in
the page.
You can move the new item in the grid under a container item via drag&drop in the Resource tree.
If you change one property, the change is automatically reported in the Design view.
• General properties
• id: the item's unique ID
• parent: ID of the row or column which contains the item
• auto-declaration: If checked, the item can be managed using the standard methods (such as get
and set)
• Display properties
Instantiate a Popup
Popup management is implemented via the ctx.popupclass class.
Sample Code
// Instantiate myPopup
POPUPS.myPopup.open() ;
• POPUPS is the predefined application name for all popups designed using UI Designer,
• myPopup is the name of your popup.
Sample Code
// Instantiate myPopup
POPUPS.myPopup.open() ;
Sample Code
POPUPS.myPopup.onTest(function(popup)
{
// TODO : add your tests here
});
Wait until the Popup Closes and Get the Popup Result
You can wait until the popup closes using the waitResult method:
Sample Code
// Instantiate myPopup
POPUPS.myPopup.open() ;
POPUPS.myPopup.waitResult(function(res, ev)
{
if (res == "myBtOk")
{
// user has clicked on myBtOk : collect data
myData1 = POPUPS.myPopup.myItem1.get();
myData2 = POPUPS.myPopup.myItem2.get();
// and continue automation
sc.endStep();
By calling the waitResult method, you set a callback that will be called when the popup is closed. If the
popup is already closed when the waitResult method is called, the callback is triggered immediately.
The callback receives an object as a parameter. This contains the popup result. The result depends on the
template used:
The UIDesigner perspective is where you design user interfaces, such as input forms or custom pages. When
you select the UIDesigner perspective tab, Desktop Studio displays the UIDesigner perspective panel:
The Resources tree displays a list of the popups included in the project. It allows you to:
Add a new popup: To create a new popup, right-click the POPUPS root node of the Resources tree and select
Add a new Popup … from the context menu. This displays a dialog where you have to:
• Enter the name of the popup – this name must be unique among the popups of the project
• Choose the template that best meets your needs
Edit a popup: To edit a popup, right-click the corresponding Popup node in the Resources tree and select Edit
from the context menu. A new editor then opens in the popup editor zone.
Note
If the popup editor is not yet open, the properties of the popup are displayed in the Properties tool window.
Each popup subtree displays the list of files used by the popup:
This list automatically includes all of the project files in the page subdirectory found in the local folder of your
project.
• Right-click the popup node in the Resources tree and select Add a new file … from the context menu
• Enter the name and the type in the displayed popup and validate
• The new file is created in the page subdirectory
• It is added to the Resources tree, which means you can edit it in the UI Designer
• Note
You can also manually add any existing file (for example, an image) as follows:
The added file appears in the Resources tree, allowing you to edit it in the UI Designer.
Note
In this case, the added file is not included in the popup.html file. If necessary, update the file manually.
Delete a file: To delete a file, you need to remove it manually in Windows Explorer. If necessary, manually
update the popup.html file to remove any “include” clauses.
The Popup subtree also contains an Items node that contains a hierarchical view of the popup items.
Add a new item: You cannot add a new item using the Resources tree. You must do it in the Designer view.
Edit an item: To edit an item, right-click the Item node in the Resource tree and select Edit from the context
menu. The item properties are then displayed in the Properties window, where you can edit them.
You can move an item within the hierarchy using drag&drop in the Resources tree.
Delete an item: To delete an item, right-click the Item node in the Resources tree and select Delete from the
context menu. A confirmation message is displayed before the popup is deleted.
Caution
If you delete a container item that has children, the children will be deleted too.
The popup editor zone allows you to design popups. It can contain one or more popup editors, each of
which lets you design one popup. You can switch between them using the document selector (see The Editor
Perspective [page 23]). Each popup editor instance consists of the following:
The designer view displays the popup in an embedded Internet Explorer window. This allows you to graphically
design your popups. The toolbar contains the following items:
Design Mode
When design mode is active, each item is surrounded by a dotted rectangle with the Name property in the
top-right corner. In this mode, you can:
• A context menu is displayed showing all available items (button, edit, table, and so on). Each item is
mapped to a bootstrap component.
• Select the desired item type and validate.
• The new item is added to the Resources tree, under the Items node.
Edit an item:
With design mode active ( ), click the item in the designer view. The item properties are then displayed in the
Properties window, where you can edit them.
UI Designer uses the Bootstrap-3 framework to manage popups. That means that you cannot simply set (X,Y)
properties to choose the position of an item. Instead, you have to create a grid using row and columns items.
With design mode active ( ), right-click within the page in the design view:
• Expand the Insert grid menu item and choose a grid item to add (such as containers, rows, columns).
• The new grid item is added to the Resources tree [1] under the Items node.
The Items subtree reflects the structure of the grid. You can change this grid structure using drag&drop in the
Resources tree.
For a full description of how to design a grid, see Managing Custom Pages With UI Designer [page 404].
This is not possible in design view. You must do it in the Resources tree.
Delete an item:
You cannot delete an item in design view. You have to do it in the Resources tree.
The editor zone allows you to edit the text files associated with the popup: settings.js, popup.html, and so on.
You can open multiple files at the same time and switch between them using the document selector (see The
Editor Perspective [page 23]).
Each file is opened in an editor that provides a wide range of features, including syntax highlighting, unlimited
undo/redo, IntelliPrompt, outlining, and zoom. For a complete description of these features, see The Code
Editor section in The Editor Perspective [page 23].
Note
By editing the settings.js file, you can change the design of your popups in JavaScript.
• Properties
• Code Map (see Navigation Features [page 44])
• Find Results (see Search Features [page 48])
The Properties tool window allows you to change the properties of popups and their items. The toolbar contains
the following items:
Edit Properties
• From the Resources tree, right-click the corresponding node and select Edit from the context menu.
• From the design view, either select the item in design mode, or right-click the item and select Edit Item or
Edit Popup from the context menu.
Refresh Mode
If auto-refresh mode is on, the design view is automatically updated each time you validate a property change
in the property grid. If not, you need to update the design view manually using the button.
Most properties are simple to edit. But some items, such as radio buttons and checkboxes, have complex
properties that are editable as arrays of objects.
Note
Docking Management
The layout of the UI Designer perspective is a DockSite comprising:
• Four tool window zones at the left, right, top and bottom
• One documents zone in the center. This zone can be split into multiple documents zones.
As in the editor perspective, the layout can be modified and saved (see Docking Management in the The Editor
Perspective [page 23]).
Related Information
If necessary, you can use advanced techniques to customize your custom page:
Sample Code
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- saved from url=(0014)about:internet -->
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
<div id="includes">
<includes/>
</div>
<LINK href="popup.css" rel="stylesheet" type="text/css" />
<script src="settings.js"></script>
<script src="popup.js"></script>
</head>
<body>
<!-- insert your code here -->
</body>
</html>
Caution
Take care to leave the ‘includes’ node unchanged: it is replaced at build time by the list of required included
files (bootstrap scripts, css, and so forth).
You can freely edit the popup.js and popup.css files, to include any required customization.
UI Designer automatically includes in the project all the files present in the page subdirectory, in the local folder
of your project.
To add a new javascript or css file, you can add it using the context menu in the Resource tree:
You can also manually add any existing file (for example, image) as follows:
The added file then appears in the Resources tree, allowing you to edit it in the UI Designer
Note
In this case, the added file is not included in the popup.html file. If necessary, manually update the
popup.html file.
In this chapter we will explain how to test, deploy and troubleshoot your project. At the early stage of
your project and specifically when making your application capture, it is recommended to test the behavior.
Typically, you need to check how the application responds to event you send (set, click...) or retrieve (get).
Once done, you can make end-to-end testing with the scenario you designed on your workstation.
To deploy the project and the scenario for unattended or attended usage, you simply need to export the
project. Import the zip file generated to Cloud Factory.
Tip: To successful execute a project in unattended mode, you need to define an environment and allocate time
for unattended within the hierarchy definition. For more information, please refer to the corresponding topic.
• Synchronizing SDK libraries and resources (HTML, bitmaps, and so forth) to the local execution folder
• Compiling and minimizing JavaScript (based on Google Closure Compiler),
• Completing XML declarations and checking consistency
The project is rebuilt before each launch for testing. Once it has been developed and tested, the project can be
exported as an archive for deployment purpose.
Desktop Studio automatically compiles the project before running it. The project can also be manually
compiled using the button in the Debugger toolbar.
The results of compilation are displayed in the Error List Tool Window.
Note
• Compilation errors prevent the project from being executed. This can be bypassed by checking Allow
Run with Compile Errors in the Debugger Settings.
• Some compilation errors can be qualified in compilation warnings using the CompilerFilters entry in
the SDK.xml file (where the SDK configuration is stored.)
Overview
Once compilation is completed, Desktop Studio generates project output in the bin directory (see Typical
Structure of a Project [page 61]).
The Error List window in the Editor perspective displays the compilation results. Lines are grouped by script file
or XML block.
By double-clicking a line, you can navigate to the corresponding line in the script file or the XML block.
The Output window in the Editor perspective displays the output generated by Desktop Studio:
• Compilation output
• Export output
• Project execution output
When you export a project, a new export output folder is generated in the export subfolder. Based on the
project structure, the output folder contains:
• The local folder in an output ZIP file if the compression option was selected before generation. If the
compression option was not selected, all files from the local folder are copied as raw data files.
• The server folder
• The key.xml markup file
The name of the export output folder has the following structure: <project name>_<project version>
If any of these conditions are invalid, the export will not work.
Note
The export action also produces a raw ZIP file in the root export folder. The name of the ZIP file is:
<project name>_<project version>.zip.
Once exported, you can import your project to the Cloud Studio as 'read-only'. To edit your Desktop Studio
project in the Cloud Studio, you must convert [page 424] it first.
Converting a project from the Desktop Studio enables you to use and edit it into the Cloud Studio.
Check the dedicated Procedure to learn how to convert a project from the Desktop Studio.
5.2.3 Deploy
Desktop • Is a software component that is installed on a user's workstation and leverages the user
Agent session. It executes a set of scripts (the project archive) to optimize business processes.
• When launched and whenever the local project cache is empty or outdated, it retrieves the
project archive which is stored on Cloud Factory.
Desktop • Is installed on one or more development workstations that have access to the client
Studio applications to integrate the business processes.
• Is the tool for authoring all process automation aspects.
Cloud • Is a software component that runs and is hosted on SAP BTP (Business Technology
Factory Platform).
• Centrally manages all common resources related to SAP Intelligent Robotic Process
Automation.
Once the project is ready for deployment, an archive is generated by Desktop Studio in the form of a
compressed file and a validation file in XML format. You use Cloud Factory to import the archive and
configuration for attended or unattended usage.
5.3 Debugging
Desktop Studio helps you to test and troubleshoot your project. You can set breakpoints in your code to enable
step-by-step execution, view the values of local and watch variables, and execute code on the fly.
The shortcut generated by Desktop Studio (at export time) starts the Engine in Release mode.
Alternatively, it can be started in Debug mode by adding the command line argument: -t 512 to the shortcut
arguments (see the Installation Guide for details of command line options).
If the project is started in Debug mode via a shortcut, Desktop Studio is not required. In this case, however,
interaction with Desktop Studio is disabled. Debugging will then be performed via the Control Pane.
Debug in Export mode Starts the project from the Export re
sult in Debug mode
Working Directory
The working directory is mandatory to launch the project in Release or Debug mode. This working directory
must be write-enabled in order to host the log files. If the working directory is missing, the launch of Desktop
Agent will fail.
By default, Desktop Studio sets the working directory in the folder containing the project file.
If the project file is opened from a Web URL or if it is located in a read-only directory, Desktop Studio uses a
temporary working directory. For example: C:\Users\<user login>\AppData\Local\Temp\
The Debugger tab lets you choose the Debugger that will be used:
• Debugger in Popup or Embedded mode (see Debugging and Testing with the Debugger [page 432])
• Control Pane
This dialog also lets you specify whether you wish to automatically minimize Desktop Studio when running.
The Trace options tab lets you choose the trace level:
The Technical options tab lets you choose the technical trace level.
Step-By-Step Execution
Desktop Studio supports step-by-step execution. This enables code to be executed line by line.
Manage Breakpoints
Breakpoints are set or removed on a script or XML block line in the Code Editor using the Toggle Breakpoint
command from the Main menu or from the Debugger toolbar:
When a breakpoint is set, the icon is set in the margin and the line is highlighted in red:
The Breakpoint tool window in the Editor Perspective displays a list of breakpoints that have already been set.
• Execution is suspended.
• The script or XML block containing the line with the break is automatically brought to the front.
• A indicator is set in the Indicator Margin and the Running line is highlighted in yellow:
• The Call Stack, Locals, and Watch tool windows are refreshed.
To resume execution, use one of the following commands from the Main menu or the Debugger toolbar:
Debug Commands
Break All
It is possible to break execution even if no breakpoint is reached. To do this, use the Break all command from
the Main menu or from the Debugger toolbar:
This command is particularly useful when you want to find out what code is currently being executed (in other
words, in infinite loops).
Manage Watches
The Watches tool window in the Editor perspective displays a list of watched
variables.
The value and type data are only filled when the project is running in debug mode and when execution is
halted at a break.
Simple Variable
Object or Array
Properties or Method
Undefined
• Delete a watch
• Copy the variable value to the clipboard
Note
A watch can be added at any time, whether or not the project is running.
The Locals tool window in the Editor perspective automatically displays a list of variables local to the current
execution context.
• The name
• The value
• The type (Integer, Boolean, String, Object, Array, and so forth)
Simple Variable
Object or Array
Properties or Method
Undefined
When execution halts on a break, the Call Stack tool window in the Editor perspective displays the call stack.
The call stack is the set of nested function calls that are currently running and waiting to return.
By double-clicking a function’s line, you can navigate to the corresponding line in the script file.
When you start a project in Debug mode, and depending on the chosen debug options, the Debugger is
launched in:
Regardless of the chosen mode, the Debugger is composed of the following parts:
Main Menu
Menu ‘File’
Menu ‘Debug’
Menu ‘Settings’
Event history
Show all events Displays the whole events history in the Events view
Show last 30s Displays only the last 30 seconds of the events history in the
Events view
Show last minute Displays only the last minute of the events history in the
Events view
Show last 2 minutes Displays only the last two minutes of the events history in
the Events view
Menu ‘view’
ToolWindows
Layout
Events View
The Events view displays all the events generated by Desktop Agent during execution. All events are time-
stamped, the oldest at the beginning of the list and latest at the end of the list. The timestamp can be hidden
using the Show timestamp context menu item.
Icons at the head of each line indicate the type of the line, as follows:
Context Menu
The Events view has a contextual menu allowing the following actions:
Show event detail Displays the event’s detail in the Detail view
Show in Scenario View Selects the event’s handler in the Scenarios view
Hide all actions Collapse all the lines to hide the associated code trace lines
Show in Page Viewer Display the page captures associated with the event
Insert code in Tester with Instances Insert corresponding code in the Tester view with instance
values
Clear list before this event Deletes all of the events before the selected event
Using the Settings/Event historic item on the Main menu, you can limit the history duration displayed:
Each time a new event is received, the list gets updated in order to reflect the selected history duration.
Note
Events that have been removed from the display are not actually deleted. They can be displayed again via
the Show all events item from the context menu.
Using the Filter view, you can filter the list of events displayed:
Note
A filtered event is never displayed, even if it matches the current scope. The only way to display a filtered
event is to change the filter.
Display Actions
Code Instruction
Code instruction
Messages
Scenario start
Scenario end
Step start
Step end
Handler run
Other
To find a text:
The search is performed within the scope of the list of events displayed. For example, a filtered event will
never be found, even if it matches the search
You can display details of an event or an action by selecting Show Details from the context menu. The Details
view displays:
If the Details view is already visible, simply select an event or action to display its details.
In order to automatically capture screenshots, check the Capture screenshots option in the Manage Debug
options. In this case, Desktop Agent automatically captures a screen image during execution based on page
LOAD and UNLOAD events.
To display the screenshot associated to an event, display the Screenshots view and select the desired event. If
the Screenshots view is already visible, simply select an event or action to display its associated screenshot.
Note
• If an event has no associated screenshot, the screenshot of the previous event is used.
• Unlike page captures, the screenshots are simple images. It is impossible to select components in
screenshots.
If an event or action is associated with a page, you can display the page capture associated with the page in
the Page Viewer view. If the Page Viewer view is already visible, simply select the event or action to display its
associated page capture.
If it is associated with a page item, the corresponding recognized items are highlighted in the page capture.
This view displays the tree of the applications, pages and items declared in the project. For each element of the
tree, the following color code is used to display the loading status:
Note
Context Menu
The view provides a shortcut menu that offers the following actions:
Show in Page Viewer Display the page captures associated with the page or Item
Show in Page Tester Display the page captures associated with the page or Item
Search in Events view Search in the Events view for the events received for this
page, and display handling actions
Insert code in Tester with Instances Insert corresponding code in the Tester view with instance
values
Hide never loaded Applis/Pages Hide/show never loaded (gray) applications and pages
Copy Name Copies the name of the selected item, page or application to
the clipboard
Copy Value Copies the value of the selected item to the clipboard
To display item values, open the context menu on the item or on the page and select Update item values.
For simple items, the item’s value is captured from the page and displayed after the item’s name.
• The Item’s count is captured and displayed before the item’s name (1)
• The value of the item's first s occurrence is displayed after the item’s name
• For multiple WEB Items, the count can’t be captured without capturing all of the values. To show this, [??]
is displayed instead of the count value
You can display all the of a multiple item's values by double-clicking the item. A subtree opens (2) displaying all
of the values with the corresponding index values.
If more than one instance of the page is loaded, select the desired instance in the Instances combobox to
display the values of its items (see Multi-instance management).
Note
• The running project may describe items that are not present in the running application. In this case, the
view displays the following message:
>[Item name] = [Pilot name] – ERROR ...
• Using the ‘Update Items values’ command generates a line in the Events view. By double-clicking this
line, you can display all the actions performed in response to this command.
Multi-Instance Management
• For applications, the current and max number of running instances of the application (1) are displayed
• For pages:
• The current number of running instances (2) of the page, across all running instances of the
application
Note
The current and max values are only displayed if they are greater than 1.
Scenarios View
The Scenarios view in Desktop Studio displays a tree that shows the running or ended scenarios (1), steps (2)
and handlers (3). It also displays, for each handler, the log messages and a trace of executed commands (4):
• Scenario and step items display the scenario or step name, its internal Id and its starting timestamp.
• Handler items display events handled within each step. The special 'Init' handler display commands
executed at the start of steps or scenarios.
• Command items display the automatic trace generated by the framework.
• Log and error items display script trace generated via the ctx.log command.
Note
• Handlers executed outside the scope of a step (for example: 'GLOBAL.Start' handlers) are displayed in
the second column.
• The visibility of log items is managed in a special way.
• You can show or hide the timestamp by clicking in the toolbar.
• Command items icons can be hidden using the button in the toolbar.
Column Management
The Scenarios view displays data in a structured way using columns. It can display several scenarios executing
simultaneously, by displaying each scenario in a separate column (see columns (3), (4) and (5)).
You can manage columns using the column header. You can show or hide a column by clicking the arrow, and
you can change the column widths by dragging the splitter between the columns.
• The Events column (column 1) lets you display/hide technical events (1).
Note
• The Events column and the OutOfScenario column have independent widths. All other columns
(scenario columns) have a uniform width.
• It is sometimes difficult to reduce column widths. If this problem occurs, simply reset the column width
using the button in the toolbar and then expand the desired columns.
Navigate to Code
Within a script, you can navigate to the code corresponding to an item using Goto Definition/Code from the
context menu:
Take care: this navigation is rather approximate. Trace items and code in scripts are not linked by script line
number, but by search in the script's code map. To minimize navigation errors, use unique scenario and step
names.
Note
‘Goto Code’ on an item searches for the first matching entry in the script's code map. For example, if there
are two ‘ctx.log’ commands in the same handler, ‘Goto Code’ on the second log item will navigate to the
first ‘ctx.log’ command in the handler.
Command items are only displayed if their corresponding handler’s item is expanded. The visibility of log and
error items can be managed in two different ways:
• An error item is always visible if the item of the scenario in which the error occurs is visible (even if
collapsed)
• A log item is visible if the item of the scenario in which the log is generated is expanded. You can display log
items the same way as you display error items: using the button in the toolbar.
This way of displaying log and error items provides a useful view of the log generated plus quick access to the
handler where the log message occurred.
You can display the execution context of a log message using Display executing context from the context menu
or by clicking its icon (1). The executing handler/step/scenario are expanded to display the log item within its
execution context.
For each item in the tree, the following color code is used to display the activity status:
The icons at the head of each item in the tree indicate the item type:
Scenario
Step
Handler
Command items
Start scenario
End scenario
Set handler
Framework Command
Script Command
Log items
Information
Warning
Error
Question
Data
Other
Toolbar
Expand All
Collapse All
Show/Hide timestamps
Show/Hide Log
Show/Hide icons
Show event detail Displays the event’s detail in the Detail view
Show in Page Viewer Displays the page captures associated with the event
Show in Page Tester Select the corresponding page or item in the Tester view
Goto Definition/Code
Insert code in Tester Insert the corresponding code in the Tester view
Insert code in Tester with Instances Insert the corresponding code in the Tester view with in
stance values
Hide Scenario history Hide/show all ended scenarios. Running scenarios remain
visible
The view has a shortcut menu that lets you do the following:
Show in Page Viewer Displays the page captures associated with the event waited
by the handler
Set Scope in Events view Set the current scope in the Events view
Display actions in Events view Search in the Events view for the events that run the handler
and display handling actions
Search sets in Events view Search in the Events view the actions that change the items
activity status
Insert code in Tester Insert the corresponding code in the Tester view
Insert code in Tester with Instances Insert the corresponding code in the Tester view with in
stance values
Clear Scenario History Clear all ended scenarios. Running scenarios remain visible
Tester View
There is no need to validate as the current filter is automatically applied when options are modified. Choices
are saved in the .user project file.
Filter on Events
To filter on Events, select the Events tab item. The view then display all the events received during execution of
the project. You can then:
There is no need to validate as the current filter is automatically applied when you change the checks. Your
choices are saved in the .user file of the project.
Context View
This view display the internal context of the Desktop Agent engine. To update data, choose Refresh from the
context menu. When you select a node, the corresponding JavaScript command that lets you get the node
value is displayed (1).
The view has a shortcut menu that lets you do the following:
Insert code in Tester Insert the corresponding code into the Tester view
Tool windows can be docked anywhere by dragging and dropping their titlebars. Some of them can be closed
using the cross button on the titlebar.
Caution
If the debugger is in topmost state, the docking guide will not be displayed. To view the docking guide while
dragging and dropping, temporarily disable topmost mode.
All available tool windows are listed in the View\Tool Windows menu. You can show or hide a tool window by
checking or unchecking it in this menu.
You can save a customized layout via View\Layout\Save on the main menu. This layout will then be
restored the next time you launch the debugger. To restore the layout without restarting the debugger, use
View\Layout\Restore from the main menu.
A debug session is a set of trace lines shown in JSON format. There is one line for each:
The session can also include .PNG files that correspond to the screenshots captured during execution.
When a debug session is loaded into Desktop Studio, a new debugger instance is launched in a new debug
perspective:
The current session can be saved via the File Save last Debug Session option from the menu.
The first time it is saved, Debugger asks for the file path and the name of the file to save the debug session in.
Debugger will then automatically save the complete debug session in this file when execution ends.
When execution ends, Desktop Studio automatically keeps the last debug session in the memory.
It can be opened using the File Open last Debug Session item from the Desktop Studio menu.
A previously saved debug session can be loaded using the File Open Debug Session item from the
Desktop Studio menu.
SAP Intelligent RPA components generate different types of trace, depending on the configuration.
Content
In Release mode (not started from Desktop Studio), Desktop SDK systematically generates
a trace file containing ‘ctx.log’ verbs. Traces are generated in the ‘Traces.pscl’ file
located in the following directory: %localappdata%/SAP/Intelligent RPA/Projects/id/Log/
log.<login>.<machine>.<timestamp>.
Analyze
Basic trace can be manually collected and displayed using the Desktop Studio Debugger. Log messages are
simply displayed in the Events view or in the Scenario view.
Note
Basic trace doesn’t provide any information about running scenarios, technical events, and so on. To get
such information, Detailed traces must be enabled (see below).
Content
Traces, in JSON format, are generated in the Traces.pscl file located in the following directory:
%localappdata%/Projects/id/Log/record.<login>.<machine>.<timestamp> (Release mode)
Optionally, screenshots can be generated by Desktop SDK on LOAD/ACTIVATE events of the declared pages.
These PNG generated files are located in the same directory as the Traces.pscl file.
In Release mode, the detailed trace file is generated on demand (see Manually Record Detailed Trace or
Auto-Recording Mode). After collection, the file can be loaded and analyzed in a Debug perspective of Desktop
Studio (see Debugging Offline with Debug Sessions [page 455]).
Debug Mode
In Debug mode, the detailed trace is automatically collected and loaded in the Debugger at start time. The
Traces.pscl file can be generated on demand by Debugger (see Save DebugSession).
Screenshots collection can be activated before running the project via the Manage Debug options.
Analyze
Content
Technical trace files are generated by Desktop Agent and its connectors. There is
one file per tracing component. For example, CtxtRun.exe_CxAppWeb3.dll_10980.log or
iexplore.exe_CxAppWeb3.dll_10312.log.
Note that collecting Technical Trace can be time-consuming and generates large files. It must ONLY be
performed at the request of SAP Intelligent RPA Support.
• Release Mode
In Release mode, Technical Trace files can be generated on demand (see Record Technical Trace).
• Debug Mode
In Debug mode, Technical Trace files generation can be activated before running the project via the
Manage Debug options of Desktop Studio .
• Any Mode
In any mode, Technical Trace files generation can be activated using the TraceViewer external tool (see
Using TraceViewer [page 466]).
• Analyze
Technical trace files contain technical information generated by the connectors or the engine. This
information can only be analyzed by SAP Intelligent RPA Support.
Analyze
Interactive trace files are simple text files: They cannot be analyzed using Desktop Studio. You can also use
any text editor for this job.
Desktop SDK implements a set of features to help with troubleshooting issues and to carry out local or remote
analytics.
These features let you collect data to establish diagnoses and trace information from an SAP Intelligent
RPA script running in production mode.
The collection process can be started by the user manually, or automatically by Desktop Agent if an error or
timeout occurs (see Auto-recording mode).
Once implemented, the following menu items are added to the project systray:
Diagnosis Data
Diagnosis data is a snapshot containing information about the workstation running the script, the state of the
running project, and so forth. The default content of diagnosis data includes:
screenshot A screenshot
Project state
Note
Some options in the SAP Intelligent RPA script allow you to customize the content of diagnosis data:
Once the script is started, the user can trigger the collection of diagnosis data using the Report an incident
menu item in the systray.
The following popup opens allowing the user to enter a free comment describing the incident, before clicking
the Submit button:
The Open button opens the Windows Explorer and automatically selects the archive file.
The ZIP archive must be collected on the production workstation in order to be analyzed on a development
workstation using Desktop Studio.
By default, the ZIP archive is collected by manual copy. Alternatively, the ZIP archive can also be collected by
one of the following methods:
Note
You need to ensure the ‘ctx.outlook’ library is included in the project and that Outlook is correctly
setup on the desktop
Sample Code
ctx.options.diagnostic.outlookSend.enabled = true;
ctx.options.diagnostic.outlookSend.destination = 'support@sap.com'
• Copying archive on a shared network (Note that we need to provide a write access on the shared folder)
Note
Sample Code
ctx.options.diagnostic.archiveCopy.enabled = true;
ctx.options.diagnostic.archiveCopy.remoteFolder = "\\\\IntranetServer\
\test\\archive";
• Uploading archive with FTP (Note that you need to enable write access on the FTP site)
Sample Code
ctx.options.diagnostic.archiveFTP.enabled = true;
ctx.options.diagnostic.archiveFTP.site = "ftp.server.net";
ctx.options.diagnostic.archiveFTP.remoteFolder = "home/archive";
Note
Introduction
If necessary, detailed trace can be activated before collecting diagnosis data by means of the recording
feature.
In order to do this, once the script is running, the user starts recording by using the Record traces menu item in
the systray:
• During recording, the user can insert comments to help later analysis, by filling the entry field and clicking
the Comment button.
• When finished, the user clicks the Stop button. Diagnosis data is automatically collected. The ZIP archive is
then generated and can then be collected.
Sample Code
-t 4096
Screenshots can be added to the detailed Trace by setting the following trace option in the project shortcut:
Sample Code
-t 8192
When recording is enabled by this method, diagnosis data is automatically collected when Desktop Agent
stops. The ZIP archive is then generated and can then be collected.
Note
In this case, for performance reasons, only partial diagnosis data is collected.
Auto-Recording Mode
Auto-recording mode allows the user to collect detailed Trace and Diagnosis data every time an error or
a timeout occurs. This collection doesn’t require any user action apart from for ZIP archive collection, if
automatic collection has not been parametrized.
• When the first scenario starts, Desktop SDK automatically starts recording detailed trace,
• When the last scenario terminates, Desktop SDK automatically deletes the recorded detailed trace,
• When an error or a timeout occurs in a running scenario, diagnosis data is automatically collected. The ZIP
archive is then generated and can then be collected.
• Activation by script
You can activate auto-recording mode explicitly in the script using the following option:
Sample Code
ctx.options.trace.autoRecording = true;
Sample Code
-o trace.autoRecording=true
• Activation by file
It is possible to selectively activate auto-recording mode for specific users by providing the users.csv
file. This file will contain the list (one per line) of UserId(s) that have auto-recording mode enabled. It must
be delivered along with the project package and deployed on the delivery server. It will be downloaded by
Desktop Agent every time the project starts.
If requested by SAP Intelligent RPA Support, the user can also record Technical Trace before collecting
diagnosis data.
Technical trace is generated by Desktop Agent and its connectors (see Offline Debugging – Trace Management
[page 457]).
Technical Trace can be activated by setting the following options in the project shortcut:
Sample Code
where:
• -comp WEBWIN indicates the list of technical components permitted to generate a trace (the WEB and
WIN connectors in this example). The list will be provided by SAP Intelligent RPA Support.
• -r %localappdata%Low indicates the directory where this trace will be generated.
In order to generate diagnosis data, use one of the preceding methods. The resulting ZIP archive will
automatically include the generated Technical Trace files.
• Ensure the following libraries are included in the project: ctx.fso.js, ctx.wmi.js, ctx.wscript.js,
ctx.diagnostic.js:
Sample Code
<SCRIPTS>
<SCRIPT Name="Constants" Src="%sdk%\lib\common\ctx.enum.js"
Folder="Framework" />
...
<!-- framework extensions -->
<SCRIPT Name="FSO library" Src="%sdk%\lib\utils\fso.js"
Folder="Libraries" />
<SCRIPT Name="WMI library" Src="%sdk%\lib\utils\wmi.js"
Folder="Libraries" />
<SCRIPT Name="WScript library" Src="%sdk%\lib\utils\wscript.js"
Folder="Libraries" />
<SCRIPT Name="Ctx Diagnostic" Src="%sdk%\lib\ctx\ctx.diagnostic.js"
Folder="Framework" />
...
</SCRIPTS>
Sample Code
<RESOURCES>
<!-- bitmaps -->
...
<RESOURCE Name="record 16px" Src="%sdk%
\templates\resources\bmp\record.png" Dest="bmp" />
...
</RESOURCES>
Sample Code
GLOBAL.labels.set({
...
menu: {
reportIncident: { en:"Report an incident", fr:"Soumettre un incident",
de:"Report an incident" },
recordTraces: { en:"Record traces", fr:"Enregistrer des traces",
de:"Record traces" }
}
});
GLOBAL.events.START.on(function (ev) {
systray.loadImage('ICON2', 'FILE', ctx.options.resourceURL + '/bmp/
record.png');
The above code adds the following menu items to the systray:
General Principles
• Write-enabled, even for a low level privilege process such as Internet Explorer in protected mode
• Local (tracing on a network drive is not recommended)
Unfortunately, there is no simple, standard way of knowing where that directory is located. The
CxTraceViewer.exe tool lets you locate it (see Specify the Trace Directory).
Note
The Trace directory must exist; it will not be created by the Desktop Studio Trace tools.
You need to choose which components will effectively trace, as tracing everything would be too slow and would
produce too much data.
Trigram Component
DES Desktop
Using CxTraceViewer.exe
Background
The CxTraceViewer.exe program is located in the Desktop Studio directory, which is typically C:\Program
Files (x86)\SAP\Intelligent RPA\Desktop Studio
You must ensure that the directory exist. If not, the tools will not create.
When you have selected each component (and checked File Only for that component), click OK to close the
Parameters dialog box.
Note:
• Do not close the Trace Viewer program during your trace session. You can, however, minimize the program.
Try to modify ‘MyPage’ recognition criteria so the wrongly recognized page doesn’t match the criteria.
Try to detect some components which are only present in MyPage, and declare them as MustExist Items (see
MustExist Method [page 284] or MustNotExist Method [page 284]).
• Try declaring MyPage as a subpage of another page (see the description of subpages in Declaring a Page
[page 243])
• Try using Root Item Method [page 284] (UI Automation only)
This means that the page matches the MyFirstPage recognition criteria.
Try modifying the declaration of MyFirstPage so that MySecondPage doesn’t match its recognition criteria
Move MySecondPage so that it is aboveMyFirstPage in the project tree. MySecondPage will then be tested
BEFORE MyFirstPage is tested
This means that recognition criteria are correct, but recognition is not refreshed after Desktop Agent has
started.
Set the page’s Refresh mode to Window or Polling so that page recognition is performed after Desktop Agent
has started (see Subpage Recognition [page 109])
Solution 1 – Improve MyItem recognition criteria: Try improving the recognition criteria for MyItem so the right
component is targeted.
Depending on the technology, you can use one or more of the following methods:
Solution 2 – Use the ‘Occurs’ method: Declare ‘MyItem’ as a multiple item (for details, see Item Definition
[page 263]), and use the right index to target the right component (see Controlling a Multiple Item [page 228] )
Try setting MyItem as MustExist (see MustExist Method [page 284]). You will then receive MyPage’s LOAD
Event only after MyItem has been created.
Use the Polling pattern to wait until ‘MyItem’ is present (see The ‘Polling’ pattern here: Control Sequences
[page 343])
If you cannot find recognition criteria that match in the two versions, you must declare two version of MyItem.
• Make a new capture of MyPage with the second version of the application
• Try to change MyItem recognition criteria to target the desired component in both versions
• Make a new capture of MyPage with the second version of the application
• Declare MyItem_2 with recognition criteria to target the desired component in the second version
• In your script, test which version is present:
Sample Code
if (MyAppli.MyPage.MyItem.exist()) MyAppli.MyPage.MyItem.set(myValue) ;
else if (MyAppli.MyPage.MyItem_1.exist())
MyAppli.MyPage.MyItem_1.set(myValue) ;
If you cannot find recognition criteria that are language-independent, update the criteria to match the different
languages.
Project Commands
Project Commands
Save Last Debug Session... Save the last DebugSession from mem
ory to disk
Generate Diagnosis
View Commands
View Commands
Help Commands
Help Commands
Related Information
Clipboard Commands
Clipboard Commands
Editing Commands
Navigation Commands
Navigation Commands
Debugging Commands
Debug Commands
Help Commands
Help Commands
Related Information
Project Nodes
Process Nodes
Process Nodes
Application Nodes
Application Nodes
All Perspectives
Page Nodes
Page Nodes
Make a new capture of this Page Replace the current capture by a new
one or add a new capture
Move Page (top, up, down, bottom) Move the page in the list of the applica
tion’p Pages
All Perspectives
Item Nodes
Item Nodes
All Perspectives
Move Item (top, up, down, bottom) Move the item in the list of the item’s
page
Overview
A snippet is a programming term for a set of re-usable source code. Snippets are often used to minimize the
repeated use of the same code.
Desktop Studio can generate code to avoid tedious and repetitive operations, simplify maintenance, and
improve productivity. Snippets complement other ways to generate code:
Snippet Generation
Some parameters are reserved and can be dynamically replaced, depending on the entity selected:
Predefined Snippets
Types of Snippet
Snippet templates are defined in configuration files, which can evolve and be enriched. They are grouped by
category:
Menu Snippets
Name Description
Filter None.
Parameters
Caption Display label Default value: ‘Function < function name >’
Result Creates < function name > if it doesn’t exist, • Adds ‘ev
Start<function name>’ menu declaration, • Adds a new
CASE to handle ‘evStart<function name>’ event.
Item Snippets
Name Description
Parameters
Source
Application Application
Page Page
Item Object
Editing Snippets
Global Structure
Snippet declaration files are located in the ‘snippets’ sub-folder. This folder can contain any number of files, as
long as each one complies with the correct structure.
The format of a snippet file is based on standard snippet format from Microsoft.
Sample Code
Associated Icons
A set of icons is provided to be optionally associated with each snippet: The icon is added by mentioning its
(zero-based) index.
This library provides a collection of functions for accessing and manipulating files and folders. It is
automatically included in new projects.
The FSO library provides two methods to initialize and end usage of the library:
The call to the end free the ActiveX. None of these calls is required anymore as they are automatically called, if
needed, by other methods.
Manage Files
Here are the main functions provided by the FSO library for managing files.
Manipulate Files
The FSO library provides functions to manipulate files:
Manipulate Filepaths
The FSO library provides functions to parse the filepath:
Zip Files
The FSO library provides functions to manipulate ZIP files:
Manage Folders
The FSO library provides functions to access files through FTP sites:
Applications and processes implement a multilingual label manager in the ‘ctx.labelManager’ object:
• English, French and German are provided by default, and other languages can be added later.
• English is the default language.
In order to manage all labels in a centralized manner, it is recommended to use the label manager for all
projects, including monolingual ones.
Define Labels
Some labels are predefined when creating the project (standard buttons, ‘About’ popup, ‘Close’ popup, etc.):
Sample Code
Sample Code
MyAppli.labels.set({
messages: {
confirm: { en:'Please confirm', fr: 'Veuillez confirmer' },
cancel: { en:'Do you want to cancel ?', fr: 'Voulez vous annuler ?' },
close: { en:'Do you want to close ?' fr: 'Voulez vous fermer ?' }
}
});
For mono-language projects, you can use simplified declarations without specifying the language:
Sample Code
MyAppli.labels.set({
messages: {
confirm: 'Please confirm',
cancel: 'Do you want to cancel ?',
close: 'Do you want to close ?'
}
});
Sample Code
To change the language on all the applications, use a loop on the ‘ctx.app’ object (application container).
Sample Code
Use Labels
To use labels in the code, just type the object name (with IntelliSense help):
Sample Code
A new language can be added by using the ctx.labelManager.addLanguage() method. The new language must
be declared in all applications in which labels are managed.
Sample Code
Sample Code
GLOBAL.labels.set({
buttons: {
yes: { nl:"Ja" },
no: { nl:"Niet" },
ok: { nl:"Ok" },
cancel: { nl:"Annuleren" },
...
}
...
});
Sample Code
MyAppli.labels.set({
messages: {
confirm: { en:'Please confirm', nl:'Bevestig alstublieft' },
cancel: { en:'Do you want to cancel ?', nl:'Heeft u wilt annuleren ?' },
A language can be automatically detected by checking a label value. If the label value exists, the corresponding
language is already defined and can be used as the current language.
Sample Code
MyAppli.pSearch.events.LOAD.on(function(ev) {
if (this.btSearch.get().indexOf('Opzoeken klanten') != -1) {
// select Dutch language
for (var id in ctx.app)
{
ctx.app[id].labels.setLanguage(e.language.Dutch);
}
} else {
// select French language
for (var id in ctx.app)
{
ctx.app[id].labels.setLanguage(e.language.French);
}
}
});
The user can be asked to select the current language. Once selected by the user (via a popup), the information
is stored in the HKCU registry and restored at each time Desktop Agent restarts.
Sample Code
Desktop SDK provides the ctx.registry class to access the Windows registry.
Sample Code
Sample Code
You create a key or a value in the Registry by using the ctx.registry.set method:
Sample Code
Note
You delete a key or value from the Registry by using the ctx.registry.del method:
Sample Code
Desktop SDK provides the ctx.cryptography class allowing to encrypt data (see Cryptography Management
[page 499]).
This makes it possible to mask sensitive data stored in the registry. For example, you can encrypt a login/
password used in a Single Sign On (SSO) mechanism.
The ctx.cryptography class performs symmetric encryption using keys specific to the PC and the user session.
This means that these values cannot be encrypted from another PC and/or user session.
Sample Code
Sample Code
The ctx.xml and ctx.json libraries implement XML and JSON management functions:
• ctx.xml:
• IXMLNode object serialization / unserialization
• XML / JSON transcoding functions
• And more
• ctx.json:
• encapsulates JSON object: Javascript object serialization / unserialization
• CSV file reading
• And more
Desktop SDK provides basic methods to manage the clipboard via the ctx.clipboard class:
To receive a notification whenever the clipboard content changes, use the ctx.clipboard.enableTrack method:
Sample Code
...
The ‘Smart Clipboard’ tool makes it possible to memorize data collected during a control sequence. The data
collected is displayed in a popup on demand. The user can choose what data to paste.
• Puts the input focus on any field of an application where the user wants to paste the data
• Hits the parametrized shortcut ('Ctrl+Shift+V' for instance): this displays the popup
• Clicks the desired link : the value is inserted.
Here is how to use the ‘Smart Clipboard’ tool in an SAP Intelligent RPA project:
At startup
• Initialize the memorized data structure using the ctx.smartClipboard.init method. For each field, the
following information must be provided:
• An identifier,
• A label,
• An optional initial value,
• An optional icon (if the path is relative, the path is : ctx.options.resourceURL + ‘/bmp/’ + icon + ‘.png’).
Sample Code
ctx.smartClipboard.init({
id: { label:'Id', value:'', icon: 'key' },
name: { label:'Name', value:'', icon: 'user' },
firstname: { label:'Firstname', value:'', icon: 'user' },
email: { label:'Email', value:'', icon: 'mail2' },
mobile: { label:'Mobile', value:'', icon: 'phone' },
street: { label:'Street', value:'', icon: 'mail_yellow' },
number: { label:'Number', value:'', icon: 'mail_yellow' },
zip: { label:'Zip', value:'', icon: 'house' },
label: { label:'City', value:'', icon: 'house' }
});
Sample Code
GLOBAL.events.START.on(function (ev)
Sample Code
ctx.smartClipboard.clear();
Sample Code
ctx.smartClipboard.data.id = ...;
ctx.smartClipboard.data.name = ...;
ctx.smartClipboard.data.firstname = ...;
ctx.smartClipboard.data.email = ...;
ctx.smartClipboard.data.mobile = ...;
...
Sample Code
The ctx.cryptography class implements a set of cryptographic functions to be used in projects. These include:
The ctx.excel library implements a set of functions used to facilitate Microsoft Excel automation for
accessing and manipulating Excel files.
Sample Code
<SCRIPTS>
<!-- framework files -->
...
<!-- framework extensions -->
<SCRIPT Name="Excel library" Src="%sdk%\lib\office\excel.js"
Folder="Libraries" />
...
<!-- project files -->
...
</SCRIPTS>
Global variables and functions used to handle the Excel instance: start, maintain and stop the Excel engine.
Attention must be paid to the management of the Excel instance used during a process. The Excel library offers
a variety of options, enabling you to design and realize many functional scenarios.
• Create a new Excel instance, use it to manipulate Excel file and quit it at the end of process.
• Use an existing Excel instance created manually by the user, with the ability to manipulate Excel documents
that are already open.
• Release the instance that is currently in use for the user. In this case, the Excel process is still running and
the user has to end it.
Sample Code
// Set the new excel instance option: allows you to initialize the Excel
library using an existing Excel instance if found
ctx.options.excel.newXlsInstance = false;
// Set the new excel instance option: allows you to initialize the Excel
library with a new Excel instance
ctx.options.excel.newXlsInstance = true;
// Set the display alerts option: allows you to display excel alerts
ctx.options.excel.displayAlerts = true;
Once an instance of Excel is initialized, all of its workbooks are accessible to the Excel library and can be
manipulated.
Example:
Sample Code
ctx.excel.initialize();
var list = ctx.excel.getWorkbooks();
var nbWB = ctx.excel.getWorkBooksLength();
ctx.log('There is '+nbWB+' workbooks associated to the current Excel
instance.');
Output:
At the end of excel processing, the Excel instance used must be ended properly.
Example:
Sample Code
ctx.excel.end();
At the end of Excel processing, sometimes the developer has to release the Excel instance and let the user
manage the Excel instance. The user then decides whether or not to end the Excel process. The user must end
the Excel process explicitly and properly.
Example:
Sample Code
ctx.excel.release();
The Microsoft Office Outlook integration library is a collection of functions used to manage Microsoft Outlook.
Sample Code
<SCRIPTS>
To enable the manipulation of Outlook mails, Microsoft Outlook Library must be initialized using the
ctx.outlook.init() method.
Sample Code
ctx.outlook.init();
Once an instance of Outlook is initialized, all methods are accessible and can be used.
At the end of Outlook processing, the Outlook application used should be ended properly.
Sample Code
ctx.outlook.end();
Retrieve Mails
To retrieve mails from Outlook application, the following steps must be performed:
resetMailCollection The mails will be stored in the working mails list, so it's
important to reset this list and make that it’s empty, because
the working mails list may contain mails searched for previ
ously.
getFilteredTable Gets the filtered table that contains the searched mails but
without full details of each mail.
retrieveMail Retrieves mails stored in the filtered table using the “En
tryID” and “StoreID”, and then builds the working mails list
with the retrieved mails.
The following example shows how to retrieve the Unread Mails from Outlook using the methods mentioned
above and complying with the steps involved in mail retrieval.
Sample Code
function retrieveUnreadMails() {
var mails = [];
var i = 0;
ctx.log("---------------------------------------------------------");
}
}
// Ends “Microsoft Outlook” application.
ctx.outlook.end();
}
As a best practice, always wrap up the functional methods with a try...catch statement.
The following example is about how to retrieve mails received between “January 21, 2018” and “February 12,
2018” and sent by “hismail@example.com” using the searchByCriteria function.
Sample Code
function retrieveMails() {
var mails = [];
var i = 0;
ctx.log("---------------------------------------------------------");
}
}
// Ends “Microsoft Outlook” application.
ctx.outlook.end();
}
Note
As a best practice, always wrap up the functional methods with a try...catch statement.
To send mails from Outlook, you need to use the following methods:
send Sends mail and removes the mail from the working mail
collection.
Sample Code
function sendBasicMail() {
// Initializes “Microsoft Outlook” application.
ctx.outlook.init();
// Creates a basic mail.
ctx.outlook.mail.create({To:'name@company.com', Subject:'Test mail from
SAP', Body:'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed
do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex
ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate
velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat
cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est
laborum.'});
try {
// Sends the mail.
var res = ctx.outlook.mail.send(0);
} catch (err) {
ctx.log("Sending of “Microsoft Outlook” mail in failure (" +
err.description + ").");
return e.error.KO;
}
// Ends “Microsoft Outlook” application.
ctx.outlook.end();
}
Note
As a best practice, always wrap up the functional methods with a try...catch statement.
The ctx.pdf library enables data to be extracted from text-searchable PDF documents within the scope of
Desktop Studio projects.
Note
This PDF library for Desktop Studio has some limitations regarding the documents it can read. They must
be smaller than 15MB and contain fewer than 100 pages or 10,000 words. Failure to comply with these
limits results in an error.
Both methods and activities are available to handle text-searchable PDF documents:
We recommend ending your PDF-related workflow with the Release PDF activity in order to release all
resources associated with it.
Code Examples
Sample Code
ctx.pdf.openPdf('..//Ticket.pdf', function(error) {
if (error) {
ctx.log("FAILURE: Opening Ticket.pdf failed");
}
var completeText = ctx.pdf.getText();
ctx.log("Complete Text in pdf :" +completeText);
ctx.pdf.release();
});
Sample Code
ctx.pdf.openPdf('..//Invoice.pdf', function(error) {
if (error) {
ctx.log("FAILURE: Opening Invoice.pdf failed");
}
var filter = ctx.pdf.createFilter('2');
var textPage2 = ctx.pdf.getText(filter);
ctx.log("Text on Page 2:" +textPage2);
ctx.pdf.release();
});
Sample Code
ctx.pdf.openPDF('..//Ticket.pdf', function(error) {
if (error) {
ctx.log("FAILURE: Opening Ticket.pdf failed");
}
var extractedTextRegEx = ctx.pdf.extract(/Order Number: ([A-Z0-9]+)/);
In the above example of calling the extract method, the regular expression /Order Number: ([A-
Z0-9]+)/ includes a capturing group, which is denoted by parentheses. As a result, only the string that meets
the criteria and comes after "Order Number: " is returned. If the parentheses are omitted, the entire matching
string is returned.
The ctx.sso class implements a set of functions to enable Single Sign On in any declared application.
• When the login page appears for the first time, the login/password are manually inserted by the user. As
soon as a target page is reached, the SSO library captures and stores this information as cyphered data in
the user registry base (HKCU).
• The next times the login page appears, the login/password are automatically inserted by the SSO library
from the cyphered data in the registry base.
• If the login fails (due to an invalid username or an incorrect password, for example), the mechanism aborts
and the user needs to log on manually. Once this is achieved, the new login/password are stored in the
registry base.
Sample Code
<SCRIPTS>
<!-- framework files -->
<SCRIPT Name="Constants" Src="%sdk%\lib\common\ctx.enum.js"
Folder="Framework" />
...
<SCRIPT Name="SSO library" Src="%sdk%\lib\ctx\ctx.sso.js"
Folder="Framework" />
...
<!-- project files -->
...
</SCRIPTS>
• A login item (enable ‘CaptData’ property to ensure data reading when the page is closed),
• A password item (enable ‘CaptData’ property to ensure data reading when the page is closed),
• A button item clicked to login to application (optional),
• An error item displayed when login fails (optional).
Example
The SSO mechanism gets enabled by using the ctx.sso.setup method with the following items:
Sample Code
When a user explicitly logs out from the application (in order to login with another credentials/account
for example), the SSO mechanism must be skipped. Otherwise, the application will immediately login
automatically with the SSO mechanism credentials.
In order to avoid this behavior, the click event on the Logout button in the application should be detected in
order to call the ctx.sso.disable method. Here’s how to implement this:
• Declare the Logout item and set a COMMAND or CLICK track event on this item.
• Once the login page is reached, the mechanism is skipped once and then re-enabled for the next
occurrences.
Sample Code
Mantis.pHome.btLogout.events.COMMAND.on(function(ev) {
// if user logs off explicitly (for example. to logon with another login),
disable auto-login
ctx.sso.disable(Mantis.pLogin);
});
If there are multiple pages containing a Logout button, declare all items with the same name, and use a generic
event handler:
Sample Code
Mantis.events.COMMAND.on(function(ev) {
if (ev.itemName == 'btLogout') {
// if user logs off explicitly (for example to logon with another login),
disable auto-login
ctx.sso.disable(Mantis.pLogin);
}
});
Most SAP Intelligent RPA projects have to manage data which must be parametrizable, such as:
It’s also good practice to initialize these variables with values coming from outside of the scripts, so that:
Desktop SDK does not provide a standard mechanism to initialize variables from an external source. It does,
however, provide basic features that allow custom management.
This chapter explains the two main methods used for this purpose in most projects.
The most frequently used method of managing external parameters is to store their initial values in an external
parameters file.
The content of a parameters file is free and depends on your project's external parameters. You can use any
format you want for the parameters file.
• JSON format,
• XML format,
• CSV format
At runtime, you load the content of the file as a string using the fso.file.read method.
You can then interpret the return string depending on the format used in the file :
JSON format
Sample Code
Sample Code
{
"Param1" : "value1",
"Param2" : "value2"
}
Sample Code
Note
Don’t forget any quotation marks in your JSON file, otherwise the ctx.json.parse method will return
null.
XML format
Sample Code
Sample Code
<PARAMS>
<Param1>value1</Param1>
<Param2>value2</Param2>
</PARAMS>}
Sample Code
CSV format
You can interpret a string in CSV format using the ctx.json.CSV2Object method:
Sample Code
Sample Code
Param1,Param2
value1,value2
value3,value4
Sample Code
strContent = fso.file.read(pathFile) ;
var oParameters = ctx.json.CSV2Object(strContent);
if (oParameters[0].Param1 == "value1")
...
Sample Code
Sample Code
Note
• The parameters file is reloaded from the delivery package directory each time the user runs your
project.
• If you modify the parameters file outside the project, be careful not to overwrite the modified the
parameters file when you make a new delivery.
Another way to initialize external parameters is to pass initial values via the -o option of the command line:
Sample Code
At runtime, you can obtain the provided values using the following method:
Sample Code
This way, you can initialize predefined options or define and initialize your own custom options.
Desktop SDK provides a set of features that help implement Ajax mechanisms and HTTP requests.
Web Service calls are implemented using the ctx.ajax.call method that encapsulates HttpRequest
management, including:
e.ajax.method )
contentType Data type : ‘form’, ‘json’, ‘xml’, … (see e.ajax.con ‘json’, if omitted
tent )
success Callback called when the call is successfully ter mandatory to get a result
minated
For a complete description of all possible parameters, see the ctx.ajax.call method.
Sample Code
var data = {
filter: "Industry='Technology'",
sort: '-Name'
}
Sample Code
var data = {
Name: "SAP SE",
Phone: "+33 1 69 29 82 32",
Type: "Technology Partner",
Website: "www.sap.com",
Industry: "Technology"
};
ctx.ajax.call({
method: e.ajax.method.post,
url: 'https://mycrm.com/accounts',
data: data,
contentType: e.ajax.content.json, // add input data in
request body (JSON format)
success: function(res, xhr) {
ctx.log(res);
},
error: function(res) {
ctx.log(' ctx.ajax.call error: ' + res);
}
});
Download a File
As for Web Service calls, file downloads are implemented using the ctx.ajax.call method.
success Callback called when the download is success mandatory to get a result
fully terminated
Sample Code
var files = [
{src: 'https://upload.wikimedia.org/wikipedia/fr/9/9e/
Google_Chrome_logo.png', dest: ctx.options.currentDir + '\\chrome.png' },
{src: 'https://upload.wikimedia.org/wikipedia/commons/thumb/c/c9/Intel-
logo.svg/2000px-Intel-logo.svg.png', dest: ctx.options.currentDir + '\
\intel.png' }
];
// launch parallel download
for (var id in files) {
ctx.ajax.call({
url: files[id].src,
localFile: files[id].dest,
success: function(res, xhr) {
ctx.log(res, e.logIconType.Info, 'evTestAjax done: ' + xhr.status);
},
error: function(res, obj) {
ctx.log(obj, e.logIconType.Error, 'evTestAjax failed: ' + res);
}
});
}
Related Information
Desktop Agent is a process that performs controlling on an application running in another process.
Most of time, you can develop projects without this knowledge, but it can be useful to understand the concept
of asynchronism and multitasking implemented in Desktop Agent.
This article briefly describes the multitasking architecture of Desktop Agent. It then presents some questions
submitted by developers, where the answers relate to asynchronism and multitasking.
• A Listener thread that listens for technical events notified by Desktop Agent connectors
• Received events are stored in an Events queue
• A Dispatcher thread which peeks events from the Events queue and injects them into the JavaScript
engine
• A JavaScript engine which receives injected events and executes associated Event handlers
Use Cases
• It injects all JavaScript files of your project into the JScript engine
• JScript engine then executes all the global code (code outside functions) written in the injected scripts
• It triggers the GLOBAL.START event in the Desktop SDK
• Desktop SDK then executes all of the Event handlers associated with this event, one by one
Example:
Sample Code
}) ;
Generally speaking, only one callback is executed at one time. You must return from a callback before another
callback can be executed.
Example:
Sample Code
MyAppli.MyFirstPage.wait(function(ev)
{
ctx.log('Before MySecondPage.wait') ;
// Suppose that MySecondPage exists
MyAppli.MySecondPage.wait(function(ev)
{
ctx.log('In MySecondPage.wait') ;
}, 0);
ctx.log('After MySecondPage.wait') ;
}, 0);
Sample Code
- Before MySecondPage.wait
- In MySecondPage.wait
- After MySecondPage.wait
That means that the Functional event handler is not executed during execution of the notify method.
When the Desktop Agent connector detects that a declared MyPage closes, it immediately notifies an UNLOAD
event.
This event is processed by the Framework, which updates its list of living MyPage instances. A call to
MyPage.exist() method then returns false.
As mentioned above, processing of the UNLOAD event is delayed until the previously received events have been
processed completely. During processing, a call to MyPage.exist() method returns true, while MyPage doesn’t
exist any more.
Note
The UNLOAD event doesn’t appear in the Debugger's Events view (see Events View [page 435] until it is
treated by the Desktop SDK. When this kind of problem happens, you generally find the MyPage UNLOAD
event just after the error message.
In a scenario, I open a page in one step and wait until this page opens in the next step. Can I miss the
reception of the LOAD event during step transition?
An Event handler set in this callback will be armed before you exit the current handler. This ensures that you
handle the LOAD event.
Example:
Sample Code
When I perform a control action (get, set, and so on), is it executed synchronously? Must I wait between
two control actions?
• Desktop Agent transmits this action to the Desktop Agent connector and waits until it returns.
• The Desktop Agent connector receives the action, executes it, and then returns
So, generally speaking, all the control actions are executed synchronously. There is one exception with the
click() action.
To avoid Desktop Agent being locked while waiting for the end of the processing, Desktop Agent connectors
execute the click() action asynchronously and return immediately.
So, after a click(), it is not recommended to execute control actions without waiting until the controlling
application has finished its job.
Desktop SDK provides two methods for waiting for a given time:
Sample Code
MyAppli.MyPage.MyFirstItem.set(myValue1) ;
// Waits for 100 ms before continuing
ctx.wait(function(ev)
{
// Wait has elapsed: continue
MyAppli.MyPage.MySecondItem.set(myValue2) ;
...
}, 100);
Sample Code
...
MyAppli.MyPage.MyFirstItem.set(myValue1) ;
// Waits 100 ms before continuing
ctx.sleep(100) ;
MyAppli.MyPage.MySecondItem.set(myValue2) ;
...
The drawback of using the ctx.sleep method is that Desktop Agent is frozen during the waiting time:
Using the ctx.wait method doesn’t freeze Desktop Agent: it is the safest and recommended way to wait for a
given time.
• You wait for a short time to let the controlled application do its job
• No Technical event is generated during this time
Communication between Desktop Agentand its connectors takes place synchronously using the COM protocol:
If an exchange takes too long, the COM protocol falls in timeout and the ‘Server busy’ message is displayed.
If you encounter this message, check whether the last executed control order does not take too long:
Because your waiting loop may take a significant amount of time, you must use an asynchronous method to
implement your waiting loop.
The best way is to use the ctx.polling method provided by the Desktop SDK.
Sample Code
During the delay between the start and the end of the timer, Desktop Agent is free to receive and manage
events.
Sample Code
// The loop
MyAppli.events.MyFuncEvent.on(function(ev)
{
// Get the turn count
var iCount = ev.data ;
This pattern was used before the ctx.polling method existed. It is still efficient and given here for your
information, but using ctx.polling is easier.
Sample Code
This pattern has several drawbacks, the most severe being that it locks Desktop Agentfor the entire duration of
the loop. In any case, don’t use this pattern (otherwise there may be problems).
The Desktop Studio development model is an event-driven model. This means that all of the controlling code
(except for global code) must be associated with technical or functional events, and implemented within
callback functions (termed event handlers).
Sample Code
Sample Code
// Register an event handler which will be called when user clicks on myButton
myAppli.myPage.myButton.events.CLICK.once(function (ev)
{
// user has clicked on myButton : execute control actions
});
Note
• In Desktop Studio projects, event handlers are implemented using JavaScript closures. A complete
description of these can be found on the Web.
• Event handlers can be registered to applications, pages and items.
An event handler receives a parameter corresponding to the triggered event. This parameter is an instance of
the ctx.event class whose members provide access to event properties:
Sample Code
myAppli.myPage.events.LOAD.on(function(ev)
{
... = ev.appliName; // 'myAppli'
... = ev.pageName; // 'myPage'
... = ev.appliInst; // 26541
... = ev.pageInst; // 1547
... = ev.data; // ...
... = ev.appli; // myAppli application object
For a complete list of ctx.event class members, see the Desktop SDK Reference Guide.
Modes of Registration
Sample Code
<object>.events.<event>.once(function(ev)
{
// continue controlling
});
Sample Code
Note
Once the handler has been run, the handler is removed and the callback will not be re-executed the
next time the event arises.
To quickly generate the once method syntax in your code, use an appropriate snippet or type
<object>.events.<event>.once and hit the tab key in the Desktop Studio Editor.
Sample Code
<object>.events.<event>.on(function(ev)
{
// continue controlling
});
Sample Code
Once the handler has been run, the handler is automatically rearmed, and the callback will be re-
executed the next time the event arises.
To quickly generate the on method syntax in your code, use an appropriate snippet or type
<object>.events.<event>.on and hit tabl key in Desktop Studio Editor
Sample Code
<page>.wait(function(ev)
{
// continue controlling
});
Sample Code
Note
• If the page already exists, the callback is called immediately, else a 'once' handler is set on the
LOAD event of the page
• To quickly generate the on method syntax in the code, use an appropriate snippet or type
<page>.wait and hit the Tab key in Desktop Studio Editor
• You can use the waitAll method instead. In this case, an on handler is set instead of a once
handler.
Sample Code
<appli>.waitPages(function(ev)
{
// continue controlling
});
Sample Code
If a page already exists, the callback is called immediately. Otherwise, a 'once' handler is set on the
'LOAD' event of any page of the application.
Sample Code
<page>.waitClose(function(ev)
{
// continue controlling
});
Sample Code
Note
• If the page is already closed, the callback is called immediately, else a 'once' handler is set on
the 'UNLOAD' event of the page
• To quickly generate the on method syntax in the code, use appropriate snippet or type
<page>.waitClose and hit the tab key in Desktop StudioEditor.
Sample Code
You can also add the menu item in the systray, then set a handler on the associated event:
Sample Code
Note
Sample Code
myAppli.myPage.events.LOAD.on(function (ev)
{
// register an event handler which will be called when user clicks on
myButton1
myAppli.myPage.myButton1.events.CLICK.on(function (ev)
{
// user has clicked on myButton1 : execute control actions
});
• Event handlers on myButton1.CLICK and myButton2.CLICK are not registered until myPage.LOAD is
triggered.
• When myPage.LOAD is triggered, myButton1.CLICK and myButton2.CLICK handlers are both registered.
For more technical information on this topic, see Understanding Asynchronous and Synchronous Processes
[page 517]
1. Once page1 has been loaded, fill the zipcode field of page1
2. WAIT UNTIL THE cityname field has been computed
3. The then get the value of the cityname field on page1
The best implementation consisted in waiting for a CHANGE event on the zipcode field before continuing
to control the page. This implies that this technical event is notified when the zipcode field is filled. If this
implementation is not successful, you must use the following Polling pattern:
Perform asynchronous polling every xx ms until ending condition is satisfied, then continue controlling.
Sample Code
page1.zipcode.set(zipcode_value) ;
// Make polling
ctx.polling({
delay: 10, // every 10 ms
test: function()
{
// until 'cityname field is filled
return (page1.cityname.get() != '') ;
},
done: function()
{
// then, continue controlling
var data = page1.cityname.get() ;
...
},
}
Note
• The ctx.polling method is asynchronous. This mean that event handlers can be executed during
the waiting delays (see Understanding Asynchronous and Synchronous Processes [page 517])
• To quickly generate the polling pattern syntax in your code, use an appropriate snippet or type
ctx.polling and hit the tab key in Desktop Studio Editor.
As explained in Example 2 - page with dynamic behavior,this solution is not very reliable because you can't be
sure that you have waited long enough:
• "Some time" can be too short if the application being controlled is slow
• If "some time" is too long, controlling will be too slow.
But it is a solution that you can use if no other meets your needs.
// wait 50 ms
ctx.wait(function(ev)
{
// 50 ms later: continue controlling
...
}, 50);
Note
• The ctx.wait method is asynchronous. This mean that event handlers can be executed during the
waiting delays.
• The ctx.sleep method is recommended instead; it is synchronous and blocks execution of Desktop
Agent (see Understanding Asynchronous and Synchronous Processes [page 517])
• To quickly generate the pattern syntax in the code, type ctx.wait and hit the TAB key in Desktop
Studio Editor
Desktop Agent can enrich Windows applications by inserting objects. Compared to Web applications, the
possibilities are limited, however.
Sample Code
// create a button with label 'Start scenario' with size (150, 20), at
position (10, 100) relative to CRM.pCRM.btSearch
CRM.pCRM.createButton(
6002, // Windows numeric identifier
'Start scenario', // label
10, 100, 150, 20, // position (X, Y, CX, CY)
CRM.pCRM.btSearch // position relative to this object
);
Sample Code
// create an edit box with default text label 'Name...' with size (200, 20),
at position (10, 100) relative to CRM.pCRM.btSearch
CRM.pCRM.createEditbox(
6003, // Windows numeric identifier
'Name...', // default label
10, 100, 200, 20, // position (X, Y, CX, CY)
CRM.pCRM.btSearch // position relative to this object
);
// create a static text with text label 'Name : ' with size (200, 20), at
position (10, 100) relative to CRM.pCRM.btSearch
CRM.pCRM.createStatic(
6004, // Windows numeric identifier
'Name:', // label
10, 100, 200, 20, // position (X, Y, CX, CY)
CRM.pCRM.btSearch // position relative to this object
);
Web technology provides additional customization possibilities, as a DOM structure can be modified in a page
on the fly.
Sample Code
Sample Code
res = Mantis.pMonAffichage.insertLink(
'myLinkSAP', // id
Mantis.pMonAffichage.oLoginText, // adjacent item
'http://www.sap.com', // link to be triggered
'SAP Web Site' // label
);
Sample Code
var obj = {
color: e.popup.color.Blue,
buttons: {
...
}
}
Example: inject JavaScript functions inside the Web page, to be called on items
Sample Code
When using the Desktop Studio, you may face some limitations.
Here is a list of these limitations and the best practices to solve them:
• You can find here Knowledge Base notes and How-tos for the Desktop Studio: Desktop Studio.
• You may face errors with the screen lock and the Virtual Desktop Infrastructure. For more information
on how to solve these errors, see: Best Practices for Screen Lock and Disconnected Virtual Desktop
Infrastructure.
• You may face errors when using the PDF Library. For more information on how to solve these errors, see:
Best Practices for PDF Library.
• You may face errors when using web service calls. For more information on how to solve these errors, see:
Best Practices for Web Service Calls.
Hyperlinks
Some links are classified by an icon and/or a mouseover text. These links provide additional information.
About the icons:
• Links with the icon : You are entering a Web site that is not hosted by SAP. By using such links, you agree (unless expressly stated otherwise in your
agreements with SAP) to this:
• The content of the linked-to site is not SAP documentation. You may not infer any product claims against SAP based on this information.
• SAP does not agree or disagree with the content on the linked-to site, nor does SAP warrant the availability and correctness. SAP shall not be liable for any
damages caused by the use of such content unless damages have been caused by SAP's gross negligence or willful misconduct.
• Links with the icon : You are leaving the documentation for that particular SAP product or service and are entering an SAP-hosted Web site. By using
such links, you agree that (unless expressly stated otherwise in your agreements with SAP) you may not infer any product claims against SAP based on this
information.
Example Code
Any software coding and/or code snippets are examples. They are not for productive use. The example code is only intended to better explain and visualize the syntax
and phrasing rules. SAP does not warrant the correctness and completeness of the example code. SAP shall not be liable for errors or damages caused by the use of
example code unless damages have been caused by SAP's gross negligence or willful misconduct.
Bias-Free Language
SAP supports a culture of diversity and inclusion. Whenever possible, we use unbiased language in our documentation to refer to people of all cultures, ethnicities,
genders, and abilities.
SAP and other SAP products and services mentioned herein as well as
their respective logos are trademarks or registered trademarks of SAP
SE (or an SAP affiliate company) in Germany and other countries. All
other product and service names mentioned are the trademarks of their
respective companies.