This is UltimateRPA Documentation
urpa Namespace Reference

The urpa module can be used for process automation. More...

Classes

class  App
 A class representing a general application. More...
 
class  AppElement
 This class represents the GUI element in an application. More...
 
class  AppExcel
 A class representing MS Excel. More...
 
class  AppIE
 This class is used to manage the Internet Explorer browser. More...
 
class  AppJavaElement
 
class  Condition
 This class is used to define conditions for GUI element searches. More...
 
class  ConditionFactory
 This class is used to create an instance of a Condition-type object and to define the conditions for searching for GUI elements in this instance of the object. More...
 
class  ElementNotFoundError
 Exception raised when the required GUI element is not found. More...
 
class  ExcelCells
 This method represents one cell, one row, a column or a block of cells in an MS Excel workbook sheet. More...
 
class  ExcelWorkbook
 This class represents a workbook in MS Excel. More...
 
class  ExcelWorksheet
 This class represents one sheet in an MS Excel workbook. More...
 
class  JavaCondition
 This class is used to define conditions for GUI element searches. More...
 
class  Transformation
 An auxiliary class that defines how images are to be transformed. More...
 
class  TransformationFactory
 An auxiliary class that defines how images are to be transformed. More...
 
class  VisualElement
 This class represents a visual GUI element in an application. More...
 

Functions

def set_password (system, user, password)
 The "Windows Credential Vault", separate for each user profile, is used to store login details. More...
 
def get_password (system, user)
 The "Windows Credential Vault", separate for each user profile, is used to store login details. More...
 
def set_debug_mode (debug_mode, sleep_time=None)
 If enabled, it marks the elements found and waits for a certain time after an element has been found. More...
 
def set_default_timeout (timeout)
 Defines the default timeout for all searches. More...
 
def set_default_text_action (type, char_delay=None, decomposition_delay=None)
 Defines the default text type and, optionally, the inter-character delay. More...
 
def set_default_mouse_action (type)
 This method defines the default mouse action type. More...
 
def set_default_focus_action (type)
 Sets the default action type for invoking AppElement.set_focus. More...
 
def set_default_key_action (type)
 Sets the default action type for send_key. More...
 
def set_default_keyboard_layout (kl)
 Sets the default keyboard layout for word processing. More...
 
def set_default_search_method (method)
 Sets the default search type for methods find_first, find_all. More...
 
def condition_factory ()
 Auxiliary class for entering more complex search conditions, see ConditionFactory. More...
 
def transformation_factory ()
 An auxiliary class that defines how images are to be transformed viz TransformationFactory. More...
 
def exec_app (cmd_line, show_window=None)
 Runs a general application, see the App class. More...
 
def exec_excel_app (filename=None)
 Runs Excel. More...
 
def exec_ie_app (url=None)
 Runs Internet Explorer and goes to the URL entered. More...
 
def open_app (pid)
 Opens the application with the process ID (PID) entered. More...
 
def find_first_app (name, timeout=default_timeout)
 Finds the application according to the name entered. More...
 
def find_first_excel_app (timeout=default_timeout)
 Finds Excel. More...
 
def find_first_ie_app ()
 Finds Internet Explorer. More...
 
def bring_to_foreground (foreground=True)
 Switches the simulation to the foreground/back. More...
 
def default_error_processing ()
 Executes default exception processing: i.e. More...
 
def check_screen_resolution (width, height, bits_per_pixel=None)
 Executes a resolution and colour depth check. More...
 
def set_clipboard_text (text)
 Inserts the text entered into the Windows clipboard. More...
 
def clipboard_text ()
 Returns text stored in the Windows clipboard. More...
 
def write_sydesk_measure (directory, source_id, value, expiration, description=None)
 It writes measurements in msr6 format to the directory entered. More...
 
def write_measure (name, status, value=None, unit=None, tolerance=0, description=None, precision=None, id=None)
 It writes measurements to the directory entered. More...
 

Variables

int default_timeout = 5000
 Default timeout for all searches, see set_default_timeout. More...
 
string default_kl = "00000409"
 
string default_text_action = "WM_CHAR"
 
int default_char_delay = 50
 
int default_decomposition_delay = 20
 
string default_key_action = "Hardware"
 
string default_mouse_action = "HW Left"
 
string default_focus_action = "Default"
 

Detailed Description

The urpa module can be used for process automation.

Calling from multiple threads is not supported.

The print function prints information to the log and the standard output.

Function Documentation

◆ bring_to_foreground()

def urpa.bring_to_foreground (   foreground = True)

Switches the simulation to the foreground/back.

Parameters
foregroundbool True to switch simulation to the foreground or switch to the simulation desktop. False to switch simulation back to the background.

◆ check_screen_resolution()

def urpa.check_screen_resolution (   width,
  height,
  bits_per_pixel = None 
)

Executes a resolution and colour depth check.

Parameters
widthint
heightint
bits_per_pixelint
Exceptions
ValueErrorif the resolution/colour depth does not match

◆ clipboard_text()

def urpa.clipboard_text ( )

Returns text stored in the Windows clipboard.

◆ condition_factory()

def urpa.condition_factory ( )

Auxiliary class for entering more complex search conditions, see ConditionFactory.

Returns
ConditionFactory

◆ default_error_processing()

def urpa.default_error_processing ( )

Executes default exception processing: i.e.

executes a screenshot and an error log in relation to the last exception raised.

◆ exec_app()

def urpa.exec_app (   cmd_line,
  show_window = None 
)

Runs a general application, see the App class.

Parameters
cmd_lineString
show_windowString
  • Minimize
  • Maximize
  • Normal
  • Hide
Returns
App

◆ exec_excel_app()

def urpa.exec_excel_app (   filename = None)

Runs Excel.

The path to the binary is detected automatically.

Parameters
filenameString
Returns
AppExcel

◆ exec_ie_app()

def urpa.exec_ie_app (   url = None)

Runs Internet Explorer and goes to the URL entered.

The path to the binary is detected automatically.

Parameters
urlString
Returns
AppIE

◆ find_first_app()

def urpa.find_first_app (   name,
  timeout = default_timeout 
)

Finds the application according to the name entered.

In this way, it is also possible to work with applications that are not run via urpa.exec_*.

Raises the urpa.ElementNotFoundError exception if the application has not been found within the time required.

Parameters
nameString The exact title name of the TP window or the ClassName of the TP window tied to an instance of the class returned.
timeoutint [ms] The maximum time in which a TP window meeting the name condition must be retrieved. If this parameter is not entered, the default value is applied, see urpa.default_timeout.
Returns
App
Exceptions
ElementNotFoundErrorthe application required has not been found within the time required.

◆ find_first_excel_app()

def urpa.find_first_excel_app (   timeout = default_timeout)

Finds Excel.

In this way, it is also possible to work with applications that are not run via urpa.exec_excel_app.

Raises the urpa.ElementNotFoundError exception if the application has not been found within the time required.

Parameters
timeoutint [ms] Maximum time to find Excel application. If this parameter is not entered, the default value is applied, see urpa.default_timeout.
Returns
AppExcel
Exceptions
ElementNotFoundErrorthe application required has not been found within the time required.

◆ find_first_ie_app()

def urpa.find_first_ie_app ( )

Finds Internet Explorer.

Returns
AppIE

◆ get_password()

def urpa.get_password (   system,
  user 
)

The "Windows Credential Vault", separate for each user profile, is used to store login details.

Records can be user-managed with Credential Manager, a standard tool where the general credential name, the username and then the password are entered.

◆ open_app()

def urpa.open_app (   pid)

Opens the application with the process ID (PID) entered.

Raises an exception if the process with the ID entered does not exist or cannot be opened.

Parameters
pidint
Returns
App
ElementNotFoundError

◆ set_clipboard_text()

def urpa.set_clipboard_text (   text)

Inserts the text entered into the Windows clipboard.

◆ set_debug_mode()

def urpa.set_debug_mode (   debug_mode,
  sleep_time = None 
)

If enabled, it marks the elements found and waits for a certain time after an element has been found.

Parameters
debug_modeBoolean Enables/disables debug mod
sleep_timeint [ms] Time in ms waited after an element has been found.

◆ set_default_focus_action()

def urpa.set_default_focus_action (   type)

Sets the default action type for invoking AppElement.set_focus.

The setting also affects the send_text and send_key methods, where the set_focus method is invoked automatically.

Parameters
typeString
  • Default - when a hidden desktop is used, this method takes a "long" time (2s)
  • Mouse - the element is enabled with a mouse click
  • None - the element will not be enabled

◆ set_default_key_action()

def urpa.set_default_key_action (   type)

Sets the default action type for send_key.

Parameters
typeString
  • Hardware
  • Standard

◆ set_default_keyboard_layout()

def urpa.set_default_keyboard_layout (   kl)

Sets the default keyboard layout for word processing.

It only affects writing with *_Scan_Virtual types.

Parameters
klString
  • 00000405 - Czech (Czech, CSY, Czech Republic)
  • 00000409 - English (US, ENU, United States)
  • 0000041B - Slovak (Slovak, SKY, Slovakia)

◆ set_default_mouse_action()

def urpa.set_default_mouse_action (   type)

This method defines the default mouse action type.

Parameters
typeString
  • HW Left
  • HW Right
  • HW Middle
  • HW Move
  • HW Left Down
  • HW Right Down
  • HW Middle Down
  • HW Left Up
  • HW Right Up
  • HW Middle Up
  • Left
  • Right
  • Middle
  • Left Down
  • Right Down
  • Middle Down
  • Left Up
  • Right Up
  • Middle Up

◆ set_default_search_method()

def urpa.set_default_search_method (   method)

Sets the default search type for methods find_first, find_all.

Parameters
methodString
  • default
  • tree_walk

◆ set_default_text_action()

def urpa.set_default_text_action (   type,
  char_delay = None,
  decomposition_delay = None 
)

Defines the default text type and, optionally, the inter-character delay.

For *_Scan_Virtual types, the keyboard layout must be configured correctly, see set_default_keyboard_layout. For *_Alt_code types, HKEY_CURRENT_USER\Control Panel\Input Method needs to have EnableHexNumpad enabled in the registers.

Parameters
typeString
  • HW_Alt_code
  • HW_Scan_Virtual
  • Standard_Alt_code
  • Standard_Scan_Virtual
  • WM_CHAR
char_delayint [ms] Inter-character delay in ms.
decomposition_delayint [ms] Character delay in ms.

◆ set_default_timeout()

def urpa.set_default_timeout (   timeout)

Defines the default timeout for all searches.

Parameters
timeoutint [ms]

◆ set_password()

def urpa.set_password (   system,
  user,
  password 
)

The "Windows Credential Vault", separate for each user profile, is used to store login details.

Records can be user-managed with Credential Manager, a standard tool where the general credential name, the username and then the password are entered.

◆ transformation_factory()

def urpa.transformation_factory ( )

An auxiliary class that defines how images are to be transformed viz TransformationFactory.

Returns
TransformationFactory

◆ write_measure()

def urpa.write_measure (   name,
  status,
  value = None,
  unit = None,
  tolerance = 0,
  description = None,
  precision = None,
  id = None 
)

It writes measurements to the directory entered.

The start of the measurement is the current time.

Parameters
nameString
statusString (SUCCESS|WARNING|ERROR|INFO|NONE)
valuefloat Measure value.
unitString Measurement value unit, e.g. %.
tolerancefloat
descriptionString Optional measurement caption.
precisionint
idString Optional measurement ID. If none is entered, this is taken to be the argument name ID.

◆ write_sydesk_measure()

def urpa.write_sydesk_measure (   directory,
  source_id,
  value,
  expiration,
  description = None 
)

It writes measurements in msr6 format to the directory entered.

The start of the measurement is the current time.

Parameters
directoryString The directory to which the data record is to be written.
source_idString Data source ID in SyDesk.
valuefloat or None Measure value. None means monitor failure.
expirationint Measurement validity in seconds.
descriptionString Optional measurement caption.

Variable Documentation

◆ default_char_delay

int urpa.default_char_delay = 50

◆ default_decomposition_delay

int urpa.default_decomposition_delay = 20

◆ default_focus_action

string urpa.default_focus_action = "Default"

◆ default_key_action

string urpa.default_key_action = "Hardware"

◆ default_kl

string urpa.default_kl = "00000409"

◆ default_mouse_action

string urpa.default_mouse_action = "HW Left"

◆ default_text_action

string urpa.default_text_action = "WM_CHAR"

◆ default_timeout

int urpa.default_timeout = 5000

Default timeout for all searches, see set_default_timeout.