- Overview
- UI Automation
- Applications and technologies automated with UI Automation
- Project compatibility
- UI-ANA-016 - Pull Open Browser URL
- UI-ANA-017 - ContinueOnError True
- UI-ANA-018 - List OCR/Image Activities
- UI-DBP-006 - Container Usage
- UI-DBP-013 - Excel Automation Misuse
- UI-DBP-030 - Forbidden Variables Usage In Selectors
- UI-PRR-001 - Simulate Click
- UI-PRR-002 - Simulate Type
- UI-PRR-003 - Open Application Misuse
- UI-PRR-004 - Hardcoded Delays
- UI-REL-001 - Large Idx in Selectors
- UI-SEC-004 - Selector Email Data
- UI-SEC-010 - App/Url Restrictions
- UI-USG-011 - Non Allowed Attributes
- UX-SEC-010 - App/Url Restrictions
- UX-DBP-029 - Insecure Password Use
- UI-PST-001 - Audit Log Level in Project Settings
- UiPath Browser Migration Tool
- Clipping region
- Computer Vision Recorder
- Activate
- Anchor Base
- Attach Browser
- Attach Window
- Block User Input
- Callout
- Check
- Click
- Click Image
- Click Image Trigger
- Click OCR Text
- Click Text
- Click Trigger
- Close Application
- Close Tab
- Close Window
- Context Aware Anchor
- Copy Selected Text
- Element Attribute Change Trigger
- Element Exists
- Element Scope
- Element State Change Trigger
- Export UI Tree
- Extract Structured Data
- Find Children
- Find Element
- Find Image
- Find Image Matches
- Find OCR Text Position
- Find Relative Element
- Find Text Position
- Get Active Window
- Get Ancestor
- Get Attribute
- Get Event Info
- Get From Clipboard
- Get Full Text
- Get OCR Text
- Get Password
- Get Position
- Get Source Element
- Get Text
- Get Visible Text
- Go Back
- Go Forward
- Go Home
- Google Cloud Vision OCR
- Hide Window
- Highlight
- Hotkey Trigger
- Hover
- Hover Image
- Hover OCR Text
- Hover Text
- Image Exists
- Indicate On Screen
- Inject .NET Code
- Inject Js Script
- Invoke ActiveX Method
- Key Press Trigger
- Load Image
- Maximize Window
- Microsoft Azure Computer Vision OCR
- Microsoft OCR
- Microsoft Project Oxford Online OCR
- Minimize Window
- Monitor Events
- Mouse Trigger
- Move Window
- Navigate To
- OCR Text Exists
- On Element Appear
- On Element Vanish
- On Image Appear
- On Image Vanish
- Open Application
- Open Browser
- Refresh Browser
- Replay User Event
- Restore Window
- Save Image
- Select Item
- Select Multiple Items
- Send Hotkey
- Set Clipping Region
- Set Focus
- Set Text
- Set To Clipboard
- Set Web Attribute
- Show Window
- Start Process
- System Trigger
- Take Screenshot
- Tesseract OCR
- Text Exists
- Tooltip
- Type Into
- Type Secure Text
- Use Foreground
- Wait Attribute
- Wait Element Vanish
- Wait Image Vanish
- Application Event Trigger
- Check/Uncheck
- Check App State
- Check Element
- Click
- Click Event Trigger
- Close Popup
- Drag and Drop
- Extract Table Data
- For Each UI Element
- Get Attribute
- Get Browser Data
- Get Text
- Get URL
- Go to URL
- Highlight
- Hover
- Inject Js Script
- Keyboard Shortcuts
- Keypress Event Trigger
- Mouse Scroll
- Navigate Browser
- Select Item
- Set Browser Data
- Set Runtime Browser
- Set Text
- Take Screenshot
- Type Into
- Use Application/Browser
- Perform browser search and retrieve results using UI Automation APIs
- Web Browsing
- Find Images
- Click Images
- Trigger and Monitor Events
- Create and Override Files
- HTML Pages: Extract and Manipulate Information
- Window Manipulation
- Automated List Selection
- Find and Manipulate Window Elements
- Manage Text Automation
- Load and Process Images
- Manage Mouse Activated Actions
- Automate Application Runtime
- Automated Run of a Local Application
- Browser Navigation
- Web Automation
- Trigger Scope Example
- Computer Vision Local Server
- Mobile Automation
- Release notes
- Project compatibility
- Get Log Types
- Get Logs
- Get Page Source
- Get Device Orientation
- Get Session Identifier
- Install App
- Manage Current App
- Manage Other App
- Open DeepLink
- Open URL
- Mobile Device Connection
- Directional Swipe
- Draw Pattern
- Positional Swipe
- Press Hardware Button
- Set Device Orientation
- Take Screenshot
- Take Screenshot Part
- Element Exists
- Execute Command
- Get Attribute
- Get Selected Item
- Get Text
- Set Selected Item
- Set Text
- Swipe
- Tap
- Type Text
- Terminal
Trigger and Monitor Events
The example below explains how to monitor user events and trigger different actions by using different hotkeys for opening certain applications. For example, the user can use a hotkey combination for opening the Calculator app from Windows.
It presents activities such as Hotkey Trigger, Monitor Events, or Get Event Info. You can find these activities in the UiPath.UIAutomation.Activities package.
This is how the automation process can be built:
- Open Studio and create a new Process named by default Main.
- Drag a Sequence container in the Workflow Designer.
-
Create the following variable:
Variable Name
Variable Type
Default Value
ContinueMonitor
Boolean
-
Drag a Log Message activity inside the Sequence container.
- In the Properties panel, select the Level option from the Message drop-down list.
- Add the expression
"Start monitoring..."
in the Message field.
-
Add an Assign activity under the Log Message activity.
- In the Properties
panel, add the variable
ContinueMonitor
in the To field. - Add the condition
True
in the Value field.
- In the Properties
panel, add the variable
-
Place a Monitor Events activity below the Assign activity.
- In the Properties
panel, add the value
ContinueMonitor
in the RepeatForever field.
- In the Properties
panel, add the value
-
Drag a Hotkey Trigger activity inside the Monitor Events activity. This activity opens the Calculator app from Windows.
- Select the checkboxes for the
Alt
andShift
options. - In the
Key
field, type the letterc
. - In the Properties panel, select the option EVENT_BLOCK from the EventMode drop-down list.
- Select the checkboxes for the
-
Drag another Hotkey Trigger activity and place it next to the previous Hotkey Trigger activity. This activity opens a new browser tab and searches on Google the text previously selected by the user.
- Select the checkboxes for the Alt and Shift options.
- In the Key field, type
the letter
g
. - In the Properties panel, select the option EVENT_BLOCK from the EventMode drop-down list.
-
Drag another Hotkey Trigger activity and place it next to the previous Hotkey Trigger activity. This activity stops monitoring the events.
- Select the check boxes for the Alt and Shift options.
- In the Key field, type
the letter
s
. - In the Properties panel, select the option EVENT_BLOCK from the EventMode drop-down list.
-
Add a new Sequence container and place it below the Hotkey Trigger activity.
- In the Properties
panel, add the name
Event Handler
in the DisplayName field. -
Create the following variable:
Variable Name
Variable Type
Default Value
TriggerHotkey
UiPath.Core.EventInfo
ContinueMonitor
Boolean
- In the Properties
panel, add the name
-
Drag a Log Message activity inside the Event Handler.
- In the Properties panel, select the Info option from the Level drop-down list.
- Add the expression
"Event triggered"
in the Message field.
-
Drag a Get Event Info activity below the Log Message activity.
- In the Properties
panel, add the variable
TriggerHotkey
in the Result field. - Select the UiPath.Core.EventInfo option from the TypeArgument drop-down list.
- In the Properties
panel, add the variable
-
Place a Switch activity below the Get Event Info activity. All Hotkey Triggers are described inside this activity and treated as cases.
- In the Properties
panel, add the value
TriggerHotkey.KeyEventInfo.KeyName.ToLower
in the Expression field. - Select the String option from the TypeArgument drop-down list.
- In the Properties
panel, add the value
-
Click the Add new case button from the Switch activity.
- Add the value
c
in the Case value field.
- Add the value
-
Place an Open Application activity and place it inside the Case c container. This represents the first Hotkey Trigger case that opens the Calculator app.
- In the Properties
panel, add the expression
"calc.exe"
in the Arguments field. - Add the expression
"<wnd app='applicationframehost.exe' title='Calculator' />"
in the Selector field.
- In the Properties
panel, add the expression
-
Click the Add new case button from the Switch activity.
- Add the value
g
in the Case value field.
- Add the value
-
Drag a Sequence container and place it inside the Case g container. This represents the second Hotkey Trigger case that initiates a Google search for the previously selected text.
- In the Properties
panel, add the name
Google selected text
in the DisplayName field. -
Create the following variable:
Variable Name
Variable Type
Default Value
TextToSearch
GenericValue
- In the Properties
panel, add the name
-
Drag a Delay activity and place it inside the Google selected text sequence.
- In the Properties
panel, add the value
00:00:00.5000000
in the Duration field.
- In the Properties
panel, add the value
-
Add a Copy Selected Text activity below the Delay activity.
- In the Properties
panel, add the value
True
in the ContinueOnError field. - Add the variable
TextToSearch
in the Result field. - Add the value
2000
in the Timeout (milliseconds) field.
- In the Properties
panel, add the value
-
Drag an If activity under the Copy Selected Text activity.
- In the Properties
panel, add the expression
TextToSearch IsNot Nothing
in the Condition field.
- In the Properties
panel, add the expression
-
Place an Open Browser activity inside the Then box.
- In the Properties panel, select the IE option from the BrowserType drop-down list.
- Add the expression
"www.google.com"
in the Url field. - Select the checkbox for the NewSession option. This starts a new session in the selected browser.
-
Place a Type Into activity inside the Do sequence.
- In the Properties panel, select the Target option from the Target drop-down list.
- Add the expression
"<webctrl tag='INPUT' aaname='Search' />"
in the Selector field. - Select the INTERACTIVE option from the WaitForReady drop-down list.
- Add the variable
TextToSearch
in the Text field. - Select the checkbox for the Activate option. This option brings the UI element to the foreground and activates it before the text is written.
- Select the checkbox for the SimulateType option. This option simulates the type using the technology of the target application.
-
Drag a Send Hotkey application below the Type Into activity.
- In the Properties
panel, add the expression
"enter"
in the Key field. - Select the Target option from the Target drop-down list.
- Add the expression
"<webctrl tag='INPUT' aaname='Search' />"
in the Selector field. - Select the INTERACTIVE option from the WaitForReady drop-down list.
- Select the checkbox for the Activate option. This option brings the UI element to the foreground and activates it before the text is written.
- Select the None option from the KeyModifiers drop-down list.
- Select the checkbox for the SpecialKey option. This option indicates if the use of a special key in the keyboard shorcut.
- In the Properties
panel, add the expression
-
Drag a Message Box activity in the Else container.
- In the Properties panel, select the Ok button from the Buttons drop-down list.
- Add the expression
"Text could not be copied. Please try again."
in the Text field. - Select the checkbox for the TopMost option. This option always brings the message box to the foreground.
-
Click the Add new case button from the Switch activity.
- Add the value
s
in the Case value field.
- Add the value
-
Drag an Assign activity inside the Case s container. This represents the third Hotkey Trigger case that stops monitoring the events.
- Add the variable
ContinueMonitor
in the To field. - Add the condition
False
in the Value field.
- Add the variable
-
Place a Log Message activity below the Monitor Events activity.
- In the Properties panel, select the Info option from the Level drop-down field.
- Add the expression
"Stop monitoring.."
in the Message field. -
This is how the workflow should look:
- Run the process. The robot activates the Hotkey Triggers and you can use any of the set key shortcuts.