Skip to content

Instantly share code, notes, and snippets.

@Trylobot
Created December 1, 2021 19:57
Show Gist options
  • Save Trylobot/13f3acb56af0d368428df941d8a931fe to your computer and use it in GitHub Desktop.
Save Trylobot/13f3acb56af0d368428df941d8a931fe to your computer and use it in GitHub Desktop.
Samurai Gunn 2 - keyboard input multiplexer
#SingleInstance Force
; create window to receive input
; multi_sg2_start.ahk
Gui, Add, Picture, w300 h300, .\sg2 guide\sg2_six_diagram_swordfighter_smol.png
Gui, Add, StatusBar
Gui, Show
Return
GuiClose:
ExitApp
; listen for sg2 keyboard input, and forward to all sg2 windows
sg2_on_key( key ) {
WinGet, id, List, Samurai Gunn 2
Loop, %id% {
this_id := id%A_Index%
ControlSend,, %key%, ahk_id %this_id%
}
SB_SetText(key)
}
#IfWinActive multi_sg2_start.ahk
Up:: sg2_on_key("{Up Down}")
Up Up:: sg2_on_key("{Up Up}")
Down:: sg2_on_key("{Down Down}")
Down Up:: sg2_on_key("{Down Up}")
Left:: sg2_on_key("{Left Down}")
Left Up:: sg2_on_key("{Left Up}")
Right:: sg2_on_key("{Right Down}")
Right Up:: sg2_on_key("{Right Up}")
v:: sg2_on_key("{v Down}")
v Up:: sg2_on_key("{v Up}")
c:: sg2_on_key("{c Down}")
c Up:: sg2_on_key("{c Up}")
x:: sg2_on_key("{x Down}")
x Up:: sg2_on_key("{x Up}")
z:: sg2_on_key("{z Down}")
z Up:: sg2_on_key("{z Up}")
b:: sg2_on_key("{b Down}")
b Up:: sg2_on_key("{b Up}")
Esc:: sg2_on_key("{Esc Down}")
Esc Up:: sg2_on_key("{Esc Up}")
LShift:: sg2_on_key("{LShift Down}")
LShift Up:: sg2_on_key("{LShift Up}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment