当前位置: 动力学知识库 > 问答 > 编程问答 >

bluetooth - AutoHotKey change keys if variable is true

问题描述:

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?

网友答案:
~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
分享给朋友:
您可能感兴趣的文章:
随机阅读: