AutoHotkey - Organizing hotkeys so as to use Several hotkeys optimally
Posted
by
Stenemo
on Super User
See other posts from Super User
or by Stenemo
Published on 2014-06-01T11:17:48Z
Indexed on
2014/06/03
9:28 UTC
Read the original article
Hit count: 372
My question is how to structure key combinations in script below most effectively using AutoHotkey.
Having searched for exactly how to do this for hours I figured I should post here so others can at least find this solution if they are trying to do the same: http://www.autohotkey.com/board/topic/90013-solved-wasd-fna-left-fnalta-home-fnctrla-ctrl-left-etc/ and How to combine three keys as a hotkey with Autohotkey?
My Question is how to use this method most effectively, and is not answered in those threads. My idea would be to use this for everything related to up (etc), e.g.:
; Up Combinations: Ctrl Up, SHIFT + Up, SHIFT + Ctrl Up, [Alt/win + Up easily added and organized using this system]
CapsLock & w::
GetKeyState, stateCtrl, LCtrl
GetKeyState, stateShift, LShift
GetKeyState, stateWin, LWin
GetKeyState, stateAlt, LAlt
if stateCtrl = D
if stateShift = D
if stateWin = D
Send ^+#{Up}; Ctrl + SHIFT + Win + Up
else
Send ^+{Up} ; Ctrl + SHIFT + Up
else if stateWin = D
Send ^#{Up} ; Ctrl + Win + Up
else
Send ^{Up} ; Ctrl Up
else if stateShift = D
Send +{Up} ; SHIFT + Up
else if stateWin = D
Send #{Up} ; Win + Up
else if stateAlt = D
Send !{Up} ; Alt + Up
else
Send {Up} ; Up
return
Also, if there is a better way to do this, that would be great. E.g.:
*CapsLock & w:: send {Up}
Does almost exactly the opposite of what I want (sends up even if other modifiers are held down). When I hold e.g. control at the same time, I want it to do control + up. Have I missed such a AutoHotkey command?
If anyone has a better way to do this that would be great.
© Super User or respective owner