web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id : Qgsx74NgqAyWXHbA5oYiXI
Power Automate - Power Automate Desktop
Unanswered

Wait for shortcut - Cancel timeout

Like (0) ShareShare
ReportReport
Posted on 4 Jun 2024 11:35:15 by 8

Hi,

I'm trying to have a flow run for hours waiting for a shortcut to activate it.

The problem is that the step times out after a while because I didn't press the shortcut.

Is there any way around it?

 

I tried making it return to the start on error, but it just keeps bouncing between the label and the step which makes it harder to press the key at the right time.

I have the same question (0)
  • eetuRobo Profile Picture
    4,122 Super User 2025 Season 2 on 04 Jun 2024 at 12:12:40
    Re: Wait for shortcut - Cancel timeout

    Do you necessarily need to have the flow running and waiting for you to press shortcut key?
    It would unnecessarily use up computing power from your machine since you would have flow script running on the background.

    Could you maybe change the flow to start from a shortcut you create:

    eetuRobo_0-1717502950784.png

     

    eetuRobo_1-1717503001043.png

     

    eetuRobo_2-1717503004445.png

  • Sigarya Profile Picture
    8 on 09 Jun 2024 at 21:38:16
    Re: Wait for shortcut - Cancel timeout

    I found that it doesn't work every time, sometimes it just doesn't respond to the shortcut. 

    I prefer doing it that way, is there a way to do it? 

  • eetuRobo Profile Picture
    4,122 Super User 2025 Season 2 on 10 Jun 2024 at 05:34:05
    Re: Wait for shortcut - Cancel timeout

    Then can you show how your flow looks? Is there a lot of actions between the Wait for shortcut -action and start of the error block / label where the flow goes to when timeout error happens? If so I suggest you cut down actions in between so that there is less chance its gotten to error and on some other actions when you actually press the shortcut.

    Maybe make it be in a subflow that only has the on block error and wait for short cut key (or atleast nothing before the Wait for shortcut key). And when it times out have the On block error to be set that if error happens go to the beginning of the error block. 

    eetuRobo_2-1717996926468.png

     



    And if you run the flow from the edit mode then make sure your Run delay is at minimum (1)

    eetuRobo_0-1717996811820.png

     

    Other possibility could try making a script like PowerShell script that waits for that shortcut key. I haven't tested if this goes to timeout error at some point if the wait is for hours.
    This script waits for Ctrl + Alt + A to be pressed:

    Add-Type @"
     using System;
     using System.Runtime.InteropServices;
     public class Keyboard
     {
     [DllImport("user32.dll")]
     public static extern short GetAsyncKeyState(int vKey);
     }
    "@
    
    function WaitForKeyPress {
     param (
     [int]$vkCtrl = 0x11,
     [int]$vkAlt = 0x12,
     [int]$vkA = 0x41
     )
     while ($true) {
     Start-Sleep -Milliseconds 100
     $ctrlPressed = [Keyboard]::GetAsyncKeyState($vkCtrl) -lt 0
     $altPressed = [Keyboard]::GetAsyncKeyState($vkAlt) -lt 0
     $aPressed = [Keyboard]::GetAsyncKeyState($vkA) -lt 0
     if ($ctrlPressed -and $altPressed -and $aPressed) {
     Write-Output "Ctrl + Alt + A pressed"
     break
     }
     }
    }
    
    WaitForKeyPress

     

    If you want to change the shortcut keys here is a list of the virtual key codes:
    https://learn.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes

     

    And change the codes there:

    eetuRobo_4-1717997621088.png

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 666 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 382 Moderator

#3
developerAJ Profile Picture

developerAJ 254

Last 30 days Overall leaderboard
Loading complete