User Events activity in UiPath can be used to trigger a specific sequence when the user clicks, keypresses on an element, clicks on an image, uses the mouse, or presses any key.
This activity triggers a sequence or executes a workflow when a particular element is clicked. Upon selecting the “On Click Element” option, the user is guided to select their desired element. Upon selection, UiPath automatically maps it into the workflow.
In the above example, the user has selected the Italics button I on MS Word. As a result, UiPath has created a new activity named Click Trigger which will execute any workflow or activity that is placed in the Event handler container.
This activity activates a particular flow of sequences when a particular element in a webpage or application is manipulated using key presses or by pressing the keyboard. Suppose, we want to create automation where the UiPath Robot will copy everything from the clipboard to a variable and write it to a file every time an email address is pasted inside Gmail's Recipients box.
To perform this activity, a user needs to select On Keypress Element and then point to the area of action or to the element on which a keyboard combination will be used. This will automatically create a sequence of events in the workflow as shown in the image. In this example, whenever a user presses Ctrl + V, the UiPath Robot will execute the activities that are placed inside the Event Handler sequence.
Click Image activity is much similar to Click Element and Keypress Element activity, however in this case the UiPath workflow sequence is triggered when the user clicks on a particular image. This is useful for many webpages, where critical information or resources are hidden behind an image and the user needs to click the image to reveal the information.
Thus, using this activity, a user can create a workflow where the UiPath Robot grabs the text or information that comes to the screen as soon as an image is clicked using the Get Text activity we discussed earlier. To successfully grab a text or information from a webpage application, the user just needs to use a relevant activity inside the Event Handler sequence.
This activity checks for a particular combination of keyboard presses along with mouse clicks according to which it will activate or execute the series of activities that are present inside the Event Handler sequence. Unlike previous activities that were dependent on elements, this works globally without the need for any anchor.
For example, a user can create a Mouse Event that whenever he/she presses Ctrl + Left Mouse Button, the UiPath Robot will take a screenshot and save it to their desired location. The user can also change the type of Mouse Button Click to the Right or Middle as per their requirements under the Properties Panel.
This is similar to Monitor Mouse activity but checks for keyboard presses and combinations instead of mouse clicks. It is not dependent on any element and is available globally in the entire operating system.
The above example, asks the UiPath Robot to run the activities in the Event Handler whenever the Combination of Ctrl + Shift + c is pressed. The combination of keys to be used can be easily changed using the Key dropdown menu.
An important thing to note is that the Monitor Keyboard and Monitor Mouse activity overrides existing windows shortcuts. Therefore, when a user is using Ctrl + c as a hotkey trigger it will replace the functionality of the windows of "Copy" action and instead work for UiPath's purpose.