Skip to content

Click the wheel button (middle-click)

Power Automate Desktop provides many actions that stand in for the operations users perform through input devices such as the keyboard and mouse.

However, there are so many actions available that you may often have trouble finding the one you actually need.

This article explains how to reproduce pressing down the wheel between the left and right mouse buttons, also known as the wheel button, middle button, or middle-click.

The action used in this article is “Send mouse click”.

The action has the following parameters.

Parameter Value
Mouse event to send Which mouse event to send (“Middle click” in this article)
Wait How long to wait before sending the event (in milliseconds)
Move mouse When turned on, the mouse moves to the specified coordinates before the event is sent
X The X coordinate to move to (horizontal)
Y The Y coordinate to move to (vertical)
Relative to Choose whether the coordinates are relative to the top-left corner of the screen, the top-left corner of the active window, or the current mouse position
Mouse movement style Choose how the mouse moves to the target coordinates (instantly or with animation) and at what speed

action

The image shows an example of double-click settings, with “Mouse event to send” set to “Double click” and “Mouse movement style” set to “With animation (normal speed)”. For this article, select “Middle click” and “Instant” as described in the steps below.

As a sample, here’s a flow that specifies coordinates relative to the active window and sends a middle-click.

Copy the following code and paste it into the Power Automate Desktop flow designer to add the action.

MouseAndKeyboard.SendMouseClick.ClickAt ClickType: MouseAndKeyboard.MouseClickType.MiddleClick MillisecondsDelay: 0 X: 100 Y: 200 RelativeTo: MouseAndKeyboard.PositionRelativeTo.ActiveWindow MovementStyle: MouseAndKeyboard.MovementStyle.Instant
ON ERROR REPEAT 3 TIMES WAIT 1
ON ERROR
END

This code also includes a setting that retries the action up to three times, waiting one second between attempts, if an error occurs (the retry setting under “On error”).

  1. In “Search actions”, type “Send mouse click”.

  2. Set the parameters as follows.

    Parameter Value
    Mouse event to send Middle click
    Wait 0
    Move mouse On
    X 100
    Y 200
    Relative to Active window
    Mouse movement style Instant
  3. When you run the flow, a middle-click is sent to the specified coordinates in the active window.

An error occurs if the specified coordinates to click are outside the screen. An error also occurs if the flow runs in non-interactive mode or if the click can’t be sent for some other reason.

We recommend setting up error handling with an “On block error” block.