Mouse Drag
Drags the mouse to a specific point
Common Properties
- Name - The custom name of the node.
- Color - The custom color of the node.
- Delay Before (sec) - Waits in seconds before executing the node.
- Delay After (sec) - Waits in seconds after executing node.
- Continue On Error - Automation will continue regardless of any error. The default value is false.
if ContinueOnError property is true, no error is caught when the project is executed even if Catch node is used.
Input
- Delta X - The amount to drag the mouse horizontally. Default value is 0.
- Delta Y - The amount to drag the mouse vertically. Default value is 0.
Options
- Mouse Button - The mouse button to use for the drag. Default value is Left Button. Available options are:
- Left Button
- Center Button
- Right Button
How It Works
The Mouse Drag node simulates a drag operation by moving the mouse from its current position to a new position while holding down a mouse button. The execution follows these steps:
- Delay Before - Waits for the specified delay before execution (if configured)
- Delta Retrieval - Retrieves the Delta X and Delta Y values from input variables
- Current Position - Gets the current mouse position using robotgo
- Button Press - Presses and holds the specified mouse button down
- Mouse Drag - Drags the mouse to the new position (current X + Delta X, current Y + Delta Y)
- Button Release - Releases the mouse button
- Delay After - Waits for the specified delay after execution (if configured)
The drag is relative to the current mouse position, not absolute screen coordinates.
Requirements
- Robomotion Deskbot - This node only works with Robomotion Deskbot (desktop automation)
- Operating System Support - Compatible with Windows, macOS, and Linux
- Permissions - May require accessibility permissions on macOS and some Linux distributions
- Current Mouse Position - The drag starts from wherever the mouse currently is
Error Handling
| Error Code | Description | Common Cause |
|---|---|---|
Core.Mouse.Drag.ErrOnCreate | Configuration parse error | Invalid node configuration or corrupted flow |
Core.Mouse.Drag.ErrOnMessage | Message parse error | Invalid input message format |
Usage Examples
Example 1: Drag File to Folder
Drag a file icon 200 pixels to the right into a folder:
Delta X: 200
Delta Y: 0
Mouse Button: Left Button
Position the mouse over the file first, then execute this node to drag it horizontally.
Example 2: Resize Window
Drag a window corner to resize it:
Delta X: 150
Delta Y: 100
Mouse Button: Left Button
Position the mouse on the window's corner/edge, then drag to resize.
Example 3: Drag Slider Control
Move a slider control to adjust a value:
Delta X: {{sliderDistance}}
Delta Y: 0
Mouse Button: Left Button
Use a calculated delta value to position sliders precisely.
Example 4: Vertical Drag
Drag an item downward in a list to reorder:
Delta X: 0
Delta Y: 80
Mouse Button: Left Button
Moves the item 80 pixels down while keeping the horizontal position.
Usage Notes
- Relative Movement - Delta values are relative to the current mouse position, not absolute coordinates
- Negative Values - Use negative delta values to drag in the opposite direction (left or up)
- Zero Deltas - Using 0 for both deltas will press and release the button at the current position
- Button Types - Left button is most common, but center and right buttons can be used for specialized applications
- Position First - Always position the mouse at the starting point before using this node
- Smooth Movement - The drag operation moves smoothly from start to end position
Tips
- Position Carefully - Use Mouse Hover or Mouse Click node to position the mouse at the drag start point first
- Test Deltas - Test your delta values to ensure they move the correct distance for your screen resolution
- Add Delays - Use "Delay Before" to ensure the UI is ready for the drag operation
- Variable Deltas - Store delta values in variables to make drag distances configurable
- Combine Actions - Chain multiple drag operations for complex movements
- Error Handling - Enable "Continue On Error" when dragging in dynamic UIs that may change
- Calculate Deltas - Use calculations to determine delta values dynamically based on screen positions
- Slow Drags - For applications sensitive to drag speed, add small delays between multiple small drag operations
Related Nodes
- Mouse Click - For clicking and positioning the mouse before dragging
- Mouse Hover - For positioning the mouse at the drag start point
- Mouse Scroll - For scrolling operations instead of dragging