【问题标题】:AutoHotKey change keys if variable is true如果变量为真,则 AutoHotKey 更改键
【发布时间】:2014-11-28 00:20:19
【问题描述】:

我是 AutoHotKey 的新手,我正在尝试创建一个脚本来让我在我的电脑上使用我的 Roku 的蓝牙遥控器。遥控器的问题是所有按键都很奇怪。我想要的是,当我同时按下 x 和 y 时,所有必要的键都会重新映射到遥控器的键,反之亦然。这是我现在拥有的(不起作用):

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}
    }
}

有谁知道为什么这不起作用?

【问题讨论】:

    标签: bluetooth autohotkey key-bindings remap


    【解决方案1】:
    ~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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-10
      • 1970-01-01
      • 1970-01-01
      • 2019-06-25
      相关资源
      最近更新 更多