Page 1 of 1

Double and Triple ESC key

Posted: Jul 7th, ’20, 17:50
by Ruud
Hi,

I would like to make a new command.
Double tap on ESC key closes the window (send F4) (I know, already in the program, but I ruined it :-o )
Triple tap send a CTRL W

So I can close a window and close a TAB in Chrome

Is this possible?

cheers,
Ruud

Re: Double and Triple ESC key

Posted: Jul 7th, ’20, 19:42
by Tom
You can still load the example from the Library - search for "Double".

This one would close the window or tab (if in Chrome) on Esc double press:

Code: Select all

WinGetClass Class, A
If (A_ThisHotKey = A_PriorHotkey && A_TimeSincePriorHotkey < 350)
{
	If (Class="Chrome_WidgetWin_1")
  		Send ^{vk57} ;Ctrl w
 	Else
  		Send !{F4}
}

Re: Double and Triple ESC key

Posted: Jul 8th, ’20, 10:55
by Ruud
Hi tom,

Thx for the quick reply and the perfect solution!
And also for the tip to search for the original in the library

I only had to remove the accolade from your script.

Many thanks from a almost 60 years young dutch guy who is stil learning

Cheers
Ruud

Re: Double and Triple ESC key

Posted: Oct 6th, ’22, 15:59
by mros
Hi Tom,
This is my first post. I'd like to create a version of this that would require a "triple Esc" instead of double. How would I do that, please?

Thanks in advance,

Michael
Tom wrote: Jul 7th, ’20, 19:42 You can still load the example from the Library - search for "Double".

This one would close the window or tab (if in Chrome) on Esc double press:

Code: Select all

WinGetClass Class, A
If (A_ThisHotKey = A_PriorHotkey && A_TimeSincePriorHotkey < 350)
{
	If (Class="Chrome_WidgetWin_1")
  		Send ^{vk57} ;Ctrl w
 	Else
  		Send !{F4}
}

Re: Double and Triple ESC key

Posted: Oct 6th, ’22, 18:28
by Marko
Try this:

Code: Select all

WinGetClass Class, A
If (A_ThisHotKey = A_PriorHotkey && A_TimeSincePriorHotkey < 350)
{
	PressCount:=PressCount+1
	if (PressCount=2)
	{
		If (Class="Chrome_WidgetWin_1")
			Send ^{vk57} ;Ctrl w
		Else
			Send !{F4}
	}
}
else
	PressCount:=0
return

Re: Double and Triple ESC key

Posted: Oct 12th, ’22, 15:54
by mros
Thank you very much, Marko, that was exactly what I needed!
Much appreciated!