Consecutive Input commands swallowing keys

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
newvice
Posts: 24
Joined: 12 Jun 2021, 09:20

Consecutive Input commands swallowing keys

23 Jul 2021, 16:27

Below is my code.
Interesting part is the last fuction check_modifier_old(modk)
The remaing code are functions to flash a colored square on the screen and to show a gui with an edit field and text in the corner of the screen.

Anyway, here is what I did:
I press LControl, LControl, flash_singnal("blue") is reached. All is good. (Btw same faulty behavior w/o flash signal there)
I then press E R and expect the second Input to fire. It doesnt.
I press T Z. It then fires and the log says "tz" for the output var ... the "er" is gone.

Where is the "E R"?

Edit:
Forgot to mention that the E R keys also do not show up in the key history.

Code: Select all

flash_signal(colorr, dura="short") {

	if (colorr = "green")
		color_set := "00D118"
	else if (colorr = "blue")
		color_set := "3236A8"
	else if (colorr = "red")
		color_set := "FF4B33"
	
	
	if (dura = "short")
		show_for := 100
	
	
	xco :=  A_ScreenWidth //2
	yco :=  A_ScreenHeight //10
	Gui, infowin:+LastFound +AlwaysOnTop +Disabled -SysMenu +Owner -Caption 
	Gui, infowin:Add, Text, w150 h150
	Gui, infowin:Show, x%xco% y%yco% NoActivate, flash
	Gui, infowin:Color, %color_set%
	WinSet, Transparent, 80
	
	if (dura != "infin")
	{
		sleep %show_for%
		Gui, infowin:Destroy
	}
	
}




global info_text := ""



add_info(text)
{
	global info_text
	
	info_text := info_text text "`r`n"
	
}



show_info()
{
	global info_text
	
	winw := 350 
	winh := 150
	

	if (A_ScreenHeight = 2160 and A_ScreenWidth = 3840)
	{
		posx := A_ScreenWidth - (winw + 480)
		posy := 0 + 67
	}
	

	else if (A_ScreenHeight = 900 and A_ScreenWidth = 1600)
	{
		posx := A_ScreenWidth - (winw + 20)
		posy := 0 + 30
	}
	

	else if (A_ScreenHeight = 1080 and A_ScreenWidth = 1920)
	{
		posx := A_ScreenWidth - (winw + 20)
		posy := 0 + 30
	}


	Gui, logwin:+AlwaysOnTop
	Gui, logwin:Add, Edit, w%winw% h%winh% hwndhEdit
	handler := Func("log").Bind(text)
	Gui, logwin:Show, x%posx% y%posy% NoActivate, keys log
	
		
	static WM_GETTEXTLENGTH := 0x0E
		 , EM_SETSEL        := 0xB1
		 , EM_REPLACESEL    := 0xC2
	
	WinWait, ahk_id %hEdit%
	
	SendMessage, WM_GETTEXTLENGTH
	SendMessage, EM_SETSEL, ErrorLevel, ErrorLevel
	SendMessage, EM_REPLACESEL, true, &info_text
	
}


check_modifier_old(modk)
{
	add_info("----- called")
	
	Input, second_mod, B I V L1 T0.2, {LControl}{Esc}
	input_err_mod := errorlevel	
	if (input_err_mod != "EndKey:LControl")
	{
		add_info("----- return")
		return
	}

	flash_signal("blue")
	
	Input, keys_pressed, B I V L2, {Esc}{Enter}
	input_err := errorlevel

	add_info("----- second_mod: " second_mod)
	add_info("----- input_err_mod: " input_err_mod)
	add_info("----- keys_pressed: " keys_pressed)
	add_info("----- input_err: " input_err)
	
	show_info()

}


flash_signal("green")



~LControl::
check_modifier_old("CTRL")
return



$<#Esc::
flash_signal("red")
Reload

$<#q::
flash_signal("red")
exitapp

$<#w::
show_info()
return

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Rohwedder and 259 guests