Is there any way to detect whether a hotkey to take effect

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
yisqiu
Posts: 2
Joined: 03 Dec 2021, 01:03

Is there any way to detect whether a hotkey to take effect

Post by yisqiu » 03 Dec 2021, 01:06

Is there any way to regularly check whether the hotkey of the current script is effective, if not effective to reload the hooks

Rohwedder
Posts: 7634
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Is there any way to detect whether a hotkey to take effect

Post by Rohwedder » 03 Dec 2021, 04:42

Hallo,
you could check the effectiveness with a higher priority send (SendLevel) that calls the Hotkey.
But it is easier to enable with the hotkey command. It doesn't matter if the Hotkey was disabled, after that it is active.
https://www.autohotkey.com/docs/commands/Hotkey.htm

yisqiu
Posts: 2
Joined: 03 Dec 2021, 01:03

Re: Is there any way to detect whether a hotkey to take effect

Post by yisqiu » 03 Dec 2021, 07:13

Rohwedder wrote:
03 Dec 2021, 04:42
Hallo,
you could check the effectiveness with a higher priority send (SendLevel) that calls the Hotkey.
But it is easier to enable with the hotkey command. It doesn't matter if the Hotkey was disabled, after that it is active.
https://www.autohotkey.com/docs/commands/Hotkey.htm
Thank you very much for your reply,my code is as follows,The right mouse button press hook always failure

Code: Select all

~Rbutton::
KeyWait, rbutton, T0.5
If ErrorLevel
{
KeyWait, Rbutton, U
click
return
}
Return
[Mod edit: [code][/code] tags added.]

Rohwedder
Posts: 7634
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Is there any way to detect whether a hotkey to take effect

Post by Rohwedder » 03 Dec 2021, 09:23

I often use short beeps to be able to hear the script status.

Code: Select all

~Rbutton::
SoundBeep, 4000, 20
KeyWait, rbutton, T0.5
If ErrorLevel
{
	KeyWait, Rbutton, U
	SoundBeep, 2000, 20
	click
	return
}
SoundBeep, 1000, 20
Return
This script sounds right!

Post Reply

Return to “Ask for Help (v1)”