This script sends Win + Arrow twice, instead of once...
So I've got my modifier keys remapped in Autohotkey, and I have kind of a weird want for the right control key. I basically want it to function as an alt key, except when an arrow key is pressed in addition to the RAlt key, in which case I want it to send the corresponding WIn+Arrow command. I've got it basically working, but with a really annoying problem: When holding the right Ctrl Key, the first press of an arrow key functions perfectly, resizing or snapping the window according to the OS's basic functionality, but on subsequent presses of the arrow key, the window seems to change as if I held the windows key and pressed that arrow key twice. I've been tweaking this for a couple hours now, but I'm too new at AHK to spot the problem in my code.
Thanks all, reading these forums has helped me a ton in getting my scripts working, so any help you can provide here is much appreciated.
Code: Select all
RCtrl::
SendInput {RAlt Down}
Loop
{
if GetKeyState("Up")
{
SendInput {RAlt Up}
SendInput {RWin Down}{Up Down}{Up Up}
Keywait, Up
continue
}
if GetKeyState("Down")
{
SendInput {RAlt Up}
SendInput {RWin Down}{Down Down}{Down Up}
Keywait, Down
continue
}
if GetKeyState("Left")
{
SendInput {RAlt Up}
SendInput {RWin Down}{Left Down}{Right Up}
Keywait, Left
continue
}
if GetKeyState("Right")
{
SendInput {RAlt Up}
SendInput {RWin Down}{Right Down}{Right Up}
Keywait, Right
continue
}
if GetKeyState("RCtrl", "P") = 0
{
Send {vk07}{RWin Up}{RAlt Up}
break
}
}
return