2
votes

I want to turn on 'arrow mode' after clicking alt (like i am turning capital letters mode after clicking caps lock).

I want to press alt once and then use letters all the time as arrows (like the alt is held) and then press alt again to leave 'arrow mode' and use normal letters. I am expecting that i would be able to press then alt+D (simultaneously) and not get arrow but program shortcut.

Right now i am using left letters as arrows:

; Arrows on s,d,f,e
!e::SendInput,{UP}
!s::SendInput,{LEFT}
!f::SendInput,{RIGHT}
!d::SendInput,{DOWN} 

but i am not able to use alt+d (which is my program short cut)

3

3 Answers

2
votes

Here is a much cleaner solution. (Be sure to be using AHK_L)

LAlt::(ArrowMode:=!ArrowMode)

#If ArrowMode
    e::Up
    s::Left
    d::Down
    f::Right
#If
1
votes

You have overridden what alt-d does, so it will no longer do anything else. But the code you wrote is not doing what you describe you want to do. I think what you need is a toggle:

e::SendInput,{UP}
s::SendInput,{LEFT}
f::SendInput,{RIGHT}
d::SendInput,{DOWN}
Alt::
Hotkey, e, Toggle
Hotkey, s, Toggle
Hotkey, f, Toggle
Hotkey, d, Toggle
Return

http://ahkscript.org/docs/commands/Hotkey.htm

0
votes
;define our hotkeys:
Hotkey, e, Up
Hotkey, s, Left
Hotkey, d, Down
Hotkey, f, Right
;set the hotkey labels:
Up:
  SendInput, {Up}
Return
Left:
  SendInput, {Left}
Return
Down:
  SendInput, {Down}
Return
Right:
  SendInput, {Right}
Return
;set the toggle key for these hotkeys:
LAlt::
    Hotkey, e, Toggle
    Hotkey, s, Toggle
    Hotkey, d, Toggle
    Hotkey, f, Toggle
Return