Time Specific Hotkey

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
Fulminare
Posts: 369
Joined: 26 Jun 2021, 20:15

Time Specific Hotkey

Post by Fulminare » 07 Jul 2021, 09:34

Hello

once i run a AHK script ,

The hotkey which is used to run the script should not be triggered for the next one hour

That is if I press the hotkey now a certain action will be performed ( lets say "write to file" )

But if I press that hotkey again after 5 mins for example , nothing should happen


Please Help

gregster
Posts: 8916
Joined: 30 Sep 2013, 06:48

Re: Time Specific Hotkey

Post by gregster » 07 Jul 2021, 10:15

Based on your previous questions which you posted in 'Ask For Help' (AHK v1), are you aware you are posting in the area for AHK v2 questions?
If yes, please confirm.
If no, and your question is still about AHK v1, we can move your topic.
Last edited by gregster on 07 Jul 2021, 13:41, edited 1 time in total.
Reason: more sense

swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Time Specific Hotkey

Post by swagfag » 07 Jul 2021, 10:47

Code: Select all

#Requires AutoHotkey v2.0-a138-7538f26f

q::
hotkeyFunction(ThisHotkey) {
	writesToFile()

	Hotkey(ThisHotkey, (*) => '') ; make it not do anything
	SetTimer(() => Hotkey(ThisHotkey, hotkeyFunction), -60 * 60 * 1000) ; reenable after 1h
}

writesToFile() {
	; do ur writing
}

Fulminare
Posts: 369
Joined: 26 Jun 2021, 20:15

Re: Time Specific Hotkey

Post by Fulminare » 07 Jul 2021, 21:20

@gregster


I am sorry I do not understand your question , could you please elaborate ?

I am fairly new to this forum

Fulminare
Posts: 369
Joined: 26 Jun 2021, 20:15

Re: Time Specific Hotkey

Post by Fulminare » 07 Jul 2021, 21:20

@swagfag

Thank you

I will try that

gregster
Posts: 8916
Joined: 30 Sep 2013, 06:48

Re: Time Specific Hotkey

Post by gregster » 07 Jul 2021, 21:31

Sure, that's why I am asking. AutoHotkey's stable release is v1 (latest: v1.1.33.09). It's "Ask For Help" forum is this: https://www.autohotkey.com/boards/viewforum.php?f=76 - there you posted your other questions.
Now you posted in the "AutoHotkey v2 Help" subforum - it's specifically about AHK v2. That new version is still an alpha release; it introduces a number of improvements, but also many script-breaking syntax changes, compared to AHK v1. (v2 will get into beta stage soon.)
If you are interested in v2, that's totally fine. But I noticed that many new users often post erroneously in the v2 section, and get code that they can't use with AHK v1.

Since you already got a v2 answer, I would now like to keep this topic here. If your question was actually meant for v1 help, please re-post there.

Fulminare
Posts: 369
Joined: 26 Jun 2021, 20:15

Re: Time Specific Hotkey

Post by Fulminare » 07 Jul 2021, 21:46

@gregster

Thank you for the clarification

I was not aware

I will re-post my question in the AHK V1 forum

Post Reply

Return to “Ask for Help (v2)”