按钮后按住人民币,然后单击

时间:2018-06-27 06:36:02

标签: autohotkey

我想不通。

我正在尝试完成这样的事情:

  1. 按下GUI按钮
  2. 当我单击鼠标时,按住RMB
  3. 当我再次单击时释放人民币

当前工作:

    Toggle=0
    GUI, Add, Button, w50 h50, Nbutton
    GUI, Show, x50 y50
    return

    ButtonNButton:
    {
        Toggle:=!Toggle
    }

    if GetKeyState("LButton","P")
        if (Toggle == 1)
            MsgBox, Do
            Toggle:=!Toggle
    return

1 个答案:

答案 0 :(得分:0)

这应该可以完成您想要的。

请注意,目前,此示例脚本仅限于在记事本中使用。您应该更新脚本,以定位您希望热键处于活动状态的任何程序/游戏/窗口。

Toggle := 0
GUI, Add, Button, w50 h50, Nbutton
GUI, Show, x50 y50
return

ButtonNButton:
    Toggle:=!Toggle


    ; Update this line to match whatever window you want the hotkey active
    ; in, or delete this line to make the hotkey active everywhere.
    Hotkey, IfWinActive, ahk_class Notepad


    if Toggle
    {
        Hotkey, ~*LButton Up, RBSwitch, On
    }
    else
    {
        if GetKeyState("RButton") ;release RButton when hotkey is disabled
            Send {RButton Up}
        Hotkey, ~*LButton Up, RBSwitch, Off
    }
RETURN


RBSwitch:
    if GetKeyState("RButton")
        Send {RButton Up}
    else
        Send {RButton Down}
RETURN
相关问题