Mouse Click
Virtual click with the left or right mouse button
Command availability: IBM RPA SaaS and IBM RPA on premises
Script syntax
IBM RPA's proprietary script language has a syntax similar to other programming languages. The script syntax defines the command's syntax in the script file. You can work with this syntax in IBM RPA Studio's Script mode.
mouseClick --clickevent(MouseClickEvent)
Dependencies
If your bot is interacting with an application, make sure the application's window is in focus before using a mouse command. Use one of the following commands to put a window in focus:
Input parameters
The following table displays the list of input parameters available in this command. In the table, you can see the parameter name when working in IBM RPA Studio's Script mode and its Designer mode equivalent label.
Designer mode label | Script mode name | Required | Accepted variable types | Description |
---|---|---|---|---|
Button to click | clickevent |
Required |
MouseClickEvent |
Defines which mouse button, right or left, should be used for the virtual mouse click. |
Example
Set the screen resolution to 1366x768, start Notepad with the Launch and Attach Window command, move the cursor to the center of the Notepad window, and use the Mouse Click command to right-click on Current mouse position.
defVar --name notepadWindow --type Window
// Open Notepad window.
setScreenResolution --displayindex 1 --width 1366 --height 768 --bpp "High"
launchWindow --executablepath "notepad.exe" notepadWindow=value
// Put Notepad window on the foreground.
focusWindow --window ${notepadWindow}
// Mouse right-click.
mouse --mode "Move" --resolution "Absolute" --point "1048,344"
delay --timeout 00:00:02
mouseClick --clickevent "RightClick"
delay