Double and Triple ESC key

Share your favorite FastKeys commands
Post Reply
Ruud
Posts: 2
Joined: Jul 7th, ’20, 17:43

Post by Ruud » Jul 7th, ’20, 17:50

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
User avatar
Tom
Posts: 791
Joined: Nov 24th, ’15, 23:39

Post by Tom » 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}
}
Ruud
Posts: 2
Joined: Jul 7th, ’20, 17:43

Post by Ruud » Jul 8th, ’20, 10:55

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
mros
Posts: 4
Joined: Oct 4th, ’22, 12:40

Post by mros » Oct 6th, ’22, 15:59

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}
}
User avatar
Marko
Posts: 1719
Joined: Mar 2nd, ’13, 21:02

Post by Marko » Oct 6th, ’22, 18:28

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
mros
Posts: 4
Joined: Oct 4th, ’22, 12:40

Post by mros » Oct 12th, ’22, 15:54

Thank you very much, Marko, that was exactly what I needed!
Much appreciated!
Post Reply