Skip to content

Block user input while a flow is running

Have you ever accidentally touched the mouse or keyboard while a flow was running and caused an action to go wrong?

Depending on how the actions are built, some flows aren’t affected by mouse or keyboard input. Still, there are plenty of situations where you want to be as accurate as possible, such as when working with passwords that can’t easily be changed, or when handling sensitive information where even a small mistake can have a big impact.

This article explains how to block user input while a flow is running.

The action used here is called “Block input.”

The action has the following parameter.

Parameter Value
Block it Choose whether to block or unblock mouse and keyboard input

action

If you add this action with “Block it” turned on anywhere in your flow, the flow stops accepting user input from that action until the flow ends.

If you add another instance of the action with “Block it” turned off later in the flow, you can block user input for only part of the flow.

Add the sample flow by copying and pasting

Section titled “Add the sample flow by copying and pasting”

As a sample, I created a flow that blocks user input for 5 seconds and displays a dialog during that time.

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

MouseAndKeyboard.BlockInput BlockIt: True
Display.ShowMessageDialog.ShowMessageWithTimeout Title: $'''Please wait 5 seconds''' Message: $'''Input is blocked for 5 seconds.''' Icon: Display.Icon.Information Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: True Timeout: 5 ButtonPressed=> ButtonPressed
MouseAndKeyboard.BlockInput BlockIt: False
  1. In “Search actions,” type “Block input.”

  2. Set the parameter as follows.

    Parameter Value
    Block it On
  3. When you run the flow, user input isn’t accepted from the start of the block until it’s released. If you don’t add an action to unblock input, input isn’t accepted until the flow ends or is forcibly stopped.

According to the specification of the BlockInput function, which blocks keyboard and mouse input in Windows, pressing Ctrl + Alt + Del while input is blocked unblocks it. The system also unblocks input if the thread that blocked it ends without unblocking it. Input blocked by the “Block input” action can presumably be unblocked the same way.

If you can’t do anything because input is blocked, first press Ctrl + Alt + Del to get input working again, and then stop the flow in Power Automate Desktop.

Note that even if you’ve set a hotkey to stop flows, it may not work while input is blocked.