help with delay

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
carluig
Posts: 25
Joined: 18 May 2020, 09:07

help with delay

Post by carluig » 27 May 2022, 12:22

Hi Community

I've been working around this for days without any luck

Let's say I need two actions to be executed by pressing only one hotkey, but action A must be executed immediately while action B after 30 seconds.
I tried with "Sleep" but it unables the hotkey untill the time expires, and I don't need this. The hotkey must be Active for a second press if necessary.

Any idea?
Thanks in advance

F10::
Send, a
sleep, 30000
Send, b

User avatar
boiler
Posts: 16923
Joined: 21 Dec 2014, 02:44

Re: help with delay

Post by boiler » 27 May 2022, 13:18

Code: Select all

F10::
Send, a
SetTimer, SendB, -30000
return

SendB:
Send, b
return

carluig
Posts: 25
Joined: 18 May 2020, 09:07

Re: help with delay

Post by carluig » 27 May 2022, 13:45

idk if I don't use it properly but, Setting a Timer doesn't solve my problem because the event occurs when I run the script and not when I press the Hotkey.
I need the Hotkey F10:: to function as a trigger for the first event to occur, and the second event to occur once the time elapsed

carluig
Posts: 25
Joined: 18 May 2020, 09:07

Re: help with delay

Post by carluig » 27 May 2022, 13:49

Sorry Boiler
it works fine
thank you very much for your help

Post Reply

Return to “Ask for Help (v1)”