Reputation: 11
I would like to use ctrl + w + x
as a hotkey, but of course ^wx::
is an invalid hotkey.
here the ressources I've found, I tried them but they didn't worked for me, (though english isn't my native language so I may have misreaded??)
the AutoHotKey documentation for the list of keys https://www.autohotkey.com/docs/KeyList.htm
An AutoHotKey topic named "Press 2 buttons at the same time?" from 2018 https://www.autohotkey.com/boards/viewtopic.php?t=45869
Another Autohotkey topic named "Trying to activate a key press using 2 keys" from 2014 https://autohotkey.com/board/topic/109093-trying-to-activate-a-key-press-using-2-keys-tried-a-bc-error-on-run-help-please-s/
thanks in advance for helping me :)
Upvotes: 1
Views: 3790
Reputation: 2344
Here is one solution based on the first example from the Input command in the Documentation:
delay := 3.0 ;number of seconds to wait for additional input
$^w::
Input, SingleKey, L1T%delay%, {LControl}{RControl}{LAlt}{RAlt}{LShift}{RShift}{LWin}{RWin}{AppsKey}{F1}{F2}{F3}{F4}{F5}{F6}{F7}{F8}{F9}{F10}{F11}{F12}{Left}{Right}{Up}{Down}{Home}{End}{PgUp}{PgDn}{Del}{Ins}{BS}{CapsLock}{NumLock}{PrintScreen}{Pause}
if (SingleKey = "x"){
;;;;;;;
MsgBox Put Hotkey here
Send ctrl + w + x was pressed
;;;;;;;
}
else{
Send {Ctrl Down}{w}{Ctrl Up}
Send %SingleKey%
}
return
Declare a variable to hold the amount of time you want the hotkey to wait for an 'x' input after Ctrl+w is pressed, called delay
delay
number of seconds for the user to press another keyOther Notes:
$
hotkey modifier to prevent an infinite recursive loopIf it doesn't work properly, feel free to let me know and I can try to help you
Upvotes: 2