1

I'm new to AutoHotKey and am trying to create a script to let me use my Roku's Bluetooth remote with my PC. The issue with the remote is that all the keys are weird. What I would like is so that when I press x and y at the same time, all the necessary keys are remapped to the ones for the remote and vise-versa for the keyboard. Here is what I have right now (doesn't work):

state = keyboard

loop{
    if (GetKeyState("x", "P") && GetKeyState("y", "P")){
        if (state == "keyboard") { 
            state = roku
            Sleep 30

        }
        else if (state == "roku") {
            state = keyboard
            Sleep 30
        }
    }
    if (state == "roku"){
        4::send h
        u::send {up}   
        l::send {left}
        r::send {right}
        d::send {down}
        e::send {esc}
        6::send {backspace}
        c::send r
        8::send f
        s::send {enter}
        3::send c
        a::send {space}
    }
}

Does anyone know why this doesn't work?

quadrplax
  • 25
  • 5

1 Answers1

3
~x & y::(HotkeysState:=!HotkeysState)

#If HotkeysState
    4::SendInput h
    u::SendInput {up}   
    l::SendInput {left}
    r::SendInput {right}
    d::SendInput {down}
    e::SendInput {esc}
    6::SendInput {backspace}
    c::SendInput r
    8::SendInput f
    s::SendInput {enter}
    3::SendInput c
    a::SendInput {space}
#If
Forivin
  • 14,780
  • 27
  • 106
  • 199