2

I can't seem to find how to bind X + Y => Z. Most links online show how to do the opposite. I'm trying to achieve this mapping:

RWin + j :: Left
RWin + l :: Right
RWin + i :: Up
RWin + k :: Down

I tried this syntax RWin&l::Right but it didn't compile.

Any ideas?

Edit: I'd also want it to play nice with the other modifier keys. So that when I press RWin+j and then shift it sends a shift+left (and same with ctrl and alt)

Edit: Thanks to @AleOtero93 here's what I have so far:

; Arrows
>#j::Send,{LEFT}
>#l::Send,{RIGHT}
>#i::Send,{UP}
>#k::Send,{DOWN}

; Shift modifier
>#+j::Send,+{LEFT}
>#+l::Send,+{RIGHT}
>#+i::Send,+{UP}
>#+k::Send,+{DOWN}

; Ctrl modifier
>#^j::Send,^{LEFT}
>#^l::Send,^{RIGHT}
>#^i::Send,^{UP}
>#^k::Send,^{DOWN}

; Ctrl+Shift
>#^+j::Send,^+{LEFT}
>#^+l::Send,^+{RIGHT}
>#^+i::Send,^+{UP}
>#^+k::Send,^+{DOWN}

; Alt modifier
>#!j::Send,!{LEFT}
>#!l::Send,!{RIGHT}
>#!i::Send,!{UP}
>#!k::Send,!{DOWN}

; Alt+Ctrl
>#^!j::Send,^!{LEFT}
>#^!l::Send,^!{RIGHT}
>#^!i::Send,^!{UP}
>#^!k::Send,^!{DOWN}

; Alt+Shift
>#!+j::Send,!+{LEFT}
>#!+l::Send,!+{RIGHT}
>#!+i::Send,!+{UP}
>#!+k::Send,!+{DOWN}

; Alt+Ctrl+Shift
>#!^+j::Send,!^+{LEFT}
>#!^+l::Send,!^+{RIGHT}
>#!^+i::Send,!^+{UP}
>#!^+k::Send,!^+{DOWN}

; Insert/Delete
>#q::Send,{Insert}
>#a::Send,{Delete}

; Ctrl+Insert/Delete
>#^q::Send,^{Insert}
>#^a::Send,^{Delete}

; Shift+Insert/Delete
>#+q::Send,+{Insert}
>#+a::Send,+{Delete}

; Home/End
>#w::Send,{Home}
>#s::Send,{End}

; Ctrl+Home/End
>#^w::Send,^{Home}
>#^s::Send,^{End}

; Shift+Home/End
>#+w::Send,+{Home}
>#+s::Send,+{End}

; Ctrl+Shift+Home/End
>#^+w::Send,^+{Home}
>#^+s::Send,^+{End}

; PageUp/PageDown
>#e::Send,{PgUp}
>#d::Send,{PgDn}

; Ctrl+PageUp/PageDown
>#^e::Send,^{PgUp}
>#^d::Send,^{PgDn}

; Shift+PageUp/PageDown
>#+e::Send,+{PgUp}
>#+d::Send,+{PgDn}

; Escape
>#CapsLock::Send,{Escape}

I had to disable Win+L which can be done via registry (or a map #l::return? not tested) I'd be interested to know if somebody has a better solution without having to remap modifier keys.

studgeek
  • 14,272
  • 6
  • 84
  • 96
vexe
  • 5,433
  • 12
  • 52
  • 81

1 Answers1

3

I managed to work this out:

>#j:: SendInput,{LEFT}
>#l:: SendInput,{RIGHT}
>#i:: SendInput,{UP}
>#k:: SendInput,{DOWN}

>: In modifier keys (suchs as Alt, Shift...) allow only the right one of them. (Use < for the left one)

#: Shortcut of Win in AHK.

And after the hotkey you are wanting to use, no spaces, use immediately :

Also, + is shortcut for shift key.

And in AHK & is only required for not modifier keys (like a & k), for shift, alt, etc. there is no need of &

After that, giving a read to AutoHotkey help, I find out that you also need to override the Win+arrow, so you add this:

>#left:: return
>#right:: return
>#up:: return
>#down:: return

Also, if disabling that Win shortcuts if what you want, make this change to the registry:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer
NoWinKeys REG_DWORD 0x00000001 (1)

But keep this in mind, Win+L and Win+U can not be overriden, according to AHK help. Hope someone solve that.

errorseven
  • 2,672
  • 2
  • 14
  • 20
AleOtero93
  • 473
  • 12
  • 32
  • 1
    Thanks for your reply! The problem is that this is seems to be mapping `Win+L` to `Win+Right` and not `Right` :( - i.e. If I press `Win+L` it would dock the currently active window to the right, as if I `Win+Right` on it. – vexe Sep 29 '15 at 19:02
  • 1
    That's better. But it's still not acting as just Arrows. It's still sending a `Win` key code. For example if I `Win+L` it sends a `Right` (just as expected) 'as well as' a `Win+L` (logs off) - Also, in a text editor, if I `Win+J` (left arrow) and then press `Shift` with it it sends a `J` and not a `Shift+Left` (select one character to the left, which is what I'd expect) – vexe Sep 29 '15 at 19:17
  • to disable the `Win+Right` use `#Right::return` I managed to make it work for all except `Win+L`, if you give a read to AutoHotkey Help, you will find out that `Win+L` and `Win+U` can not be override, editing answer again – AleOtero93 Sep 29 '15 at 19:32
  • 1
    Thanks again. `Win+L` is not a problem, I can disable it alone without losing the extra `Win` functionalities http://www.howtogeek.com/howto/windows-vista/disableenable-lock-workstation-functionality-windows-l/ - However; the problem of the other modifier keys still haven't been addressed. i.e. `Win+J` then `Shift` sends a `J` instead of `Shift+Left` - It seems that we must have a separate set of mappings for each other modifier key? (disabling `RWin+Arrows` didn't help) – vexe Sep 29 '15 at 19:40
  • 1
    Apparently yes, I added `+>#j:: SendInput,+{LEFT}` and now is a `Shift+Left` functionallity. Hope someone with more knowledge than me could help as out. Good question by the way... – AleOtero93 Sep 29 '15 at 19:48
  • I added what I have so far to my question, it's not bad. Appreciate your support, it was very helpful. – vexe Sep 29 '15 at 19:59
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/91028/discussion-between-aleotero93-and-vexe). – AleOtero93 Sep 30 '15 at 19:58