Send key up while blockinput is on

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
hemsith14_
Posts: 296
Joined: 07 Nov 2020, 08:37

Send key up while blockinput is on

Post by hemsith14_ » 16 Aug 2022, 10:30

Hey

How can I send key up while blockinput is on? AHK will "lost track" of the key state if it's up during a blockinput.

Thanks

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

Re: Send key up while blockinput is on

Post by Rohwedder » 16 Aug 2022, 11:45

Hallo,
this will release of all pressed keys:

Code: Select all

Loop, 0xFF
	IF GetKeyState(Key:=Format("VK{:X}",A_Index))
		SendInput, {%Key% up}

hemsith14_
Posts: 296
Joined: 07 Nov 2020, 08:37

Re: Send key up while blockinput is on

Post by hemsith14_ » 16 Aug 2022, 15:53

Can you help me implement it into the following code? The end goal is to get the "if getkeystate" catch a rbutton up that can occur before it.

Code: Select all

!RButton::
	If (A_Cursor = "SizeNS")
	{
		BlockInput, On
		While (A_Cursor = "SizeNS")
		MouseMove, 3, 0,, R ; RButton can be released here
		Sleep 10
                If !GetKeyState("RButton", "P") ; This wont receive the released signal is it was released before
                Msgbox Release catch
		Click, Down
		BlockInput, Off
		KeyWait, RButton
		Click, Up
	}
Return

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

Re: Send key up while blockinput is on

Post by Rohwedder » 17 Aug 2022, 02:46

Use:

Code: Select all

!RButton Up::
KeyWait, Alt
…
The manual says:
BlockInput, On Disables the user's ability to interact with the computer via keyboard and mouse.
This means that all keys and buttons should have been physically released beforehand. If this was not the case, problems may occur.
Do not block the disturbing inputs of the user but compensate them.
For example, instead of a series of relative MouseMoves, use a series of absolute ones along a given path.

hemsith14_
Posts: 296
Joined: 07 Nov 2020, 08:37

Re: Send key up while blockinput is on

Post by hemsith14_ » 17 Aug 2022, 09:46

It's not solving the problem, I have to use a relative mouse move and a blockinput, I tried all other ways so far.

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

Re: Send key up while blockinput is on

Post by Rohwedder » 17 Aug 2022, 10:24

(You have to ... ? Yes, living a self-determined life is not for everyone.)
Try to see the difference:

Code: Select all

q:: ;series of relative MouseMoves
While GetKeyState(A_ThisHotkey, "P")
	MouseMove, 3, 0,, R
Return
w:: ;series of absolute MouseMoves along a given path
MouseGetPos, X, Y
While GetKeyState(A_ThisHotkey, "P")
	MouseMove, X+=3, Y
Return

hemsith14_
Posts: 296
Joined: 07 Nov 2020, 08:37

Re: Send key up while blockinput is on

Post by hemsith14_ » 17 Aug 2022, 16:31

I don't understand, it's still not preventing RButton from getting stuck

Post Reply

Return to “Ask for Help (v1)”