ask for script to double-press delete key to close the window (alt+f4)

Get help with using AutoHotkey and its commands and hotkeys
congdantoancau
Posts: 32
Joined: 11 Apr 2016, 05:14
Facebook: congdankinhbac
Google: +trarengyenfiong

ask for script to double-press delete key to close the window (alt+f4)

11 Apr 2016, 05:22

Hi everybody!
I want to close the window as Alt+F4 key with double-press the delete key. How can I do it with AHK?
Thanks for your help!
User avatar
HinkerLoden
Posts: 93
Joined: 23 Mar 2016, 07:50
GitHub: HinkerLoden

Re: ask for script to double-press delete key to close the window (alt+f4)

11 Apr 2016, 06:24

If you press now twice DEL in a second the window "Editor" will close. Fit in your TitleName or modify it the way you want.

~DEL UP:: ;~ allow to use the Hotkeys Native Function
Loop, 4
{

If (GetKeyState("Delete" , "P"))
{
IfWinExist, Editor ;Your Program Window Text / Calculator / Firefox / etc.
WinClose ; use the window found above ;or WinKill for the force Variant

}
Sleep, 250
}


Return
User avatar
Flarebrass
Posts: 104
Joined: 20 Nov 2015, 13:13
Location: USA
Contact:

Re: ask for script to double-press delete key to close the window (alt+f4)

11 Apr 2016, 06:37

See Example #3 from SetTimer; that should give you all the code you need along with Hinker's suggestions.
(Note that I can't test my code before posting, so beware of bugs! -Flarebrass Amatzikahni)
congdantoancau
Posts: 32
Joined: 11 Apr 2016, 05:14
Facebook: congdankinhbac
Google: +trarengyenfiong

Re: ask for script to double-press delete key to close the window (alt+f4)

11 Apr 2016, 09:51

@HinkerLoden your script seem does not work.

Anyway, Thank you guys
I just have a solution and it work well.

Code: Select all

;REPLACE HOTKEYS
~end::
if (A_PriorHotkey <> "~end" or A_TimeSincePriorHotkey > 400)
{
    ; Too much time between presses, so this isn't a double-press.
    KeyWait, end
    return
}
send !{f4}
return
I just change the key Delete to End because it more reasonable. :P

Return to “Ask For Help”

Who is online

Users browsing this forum: boiler, Google [Bot], Smile_ and 60 guests