【问题标题】:Autohotkey Multiple hotkeys at same time (Middle button, Left button, Right button of the mouse pressed at once)Autohotkey 同时多个热键(中键、左键、鼠标右键同时按下)
【发布时间】:2021-06-17 16:29:56
【问题描述】:

我一直在研究一种用鼠标控制音乐/媒体的方法,到目前为止我可以做到所有这些:

中键和右键播放下一首歌曲

Mbutton & RButton::Send {Media_Next}

中左键播放上一曲

Mbutton & LButton::Send {Media_Prev}

中按并向上滚动 增加声音(不会停止在其他地方使用中键)

中键按下并向下滚动 降低声音(不会停止在其他地方使用中键)

#IfWinActive

Mbutton up::

`if a_priorhotkey not in wheelup,wheeldown`

    `send {Mbutton}`
return

#if getkeystate("Mbutton", "p")

Wheelup::Send {Volume_Up}

Wheeldown::Send {Volume_Down}

但现在我需要同时按下 ALL 3 (Lbutton + Mbutton + Rbutton), 发送 {Media_Play_Pause} 而且它不适用于 Lbutton & Mbutton & Rbutton...

有什么想法吗?感谢阅读。

【问题讨论】:

    标签: mouse autohotkey media-player


    【解决方案1】:

    这是一种可能性:

    #if getkeystate("Lbutton", "p") and getkeystate("Rbutton", "p")
    MButton::Send {Media_Play_Pause}
    #if
    

    解释(虽然大部分是直截了当的前言):

    1. 第 1 行:如果按下了 LButtonRButton
    2. 第 2 行:MButton 表示 Send Media Pause/ Play
    3. 第 3 行:结束上下文相关热键

    完整脚本:

    #IfWinActive
    
    Mbutton & RButton::Send {Media_Next}
    Mbutton & LButton::Send {Media_Prev}
    
    Mbutton up::
    if a_priorhotkey not in wheelup,wheeldown
    
        send {Mbutton}
    return
    
    #if getkeystate("Mbutton", "p")
    Wheelup::Send {Volume_Up}
    Wheeldown::Send {Volume_Down}
    
    #if getkeystate("Lbutton", "p") and getkeystate("Rbutton", "p")
    MButton::Send {Media_Play_Pause}
    #if
    

    【讨论】:

    • 嗨!感谢您的帮助,我刚刚在这里进行了测试,我认为这只有在我同时按下按键时才有效,否则由于其他热键,它只会播放下一首或上一首歌曲。
    • 在按下Middle Mouse Button 之前先尝试同时按住Left Mouse ButtonRight Mouse Button。如果我理解正确,您的脚本中目前没有LButton & RButton 热键,因此一旦按住它们,然后按下MButton 应该会激活这个新代码块,而不是之前的任何代码块。无论如何,我都会更新我的答案以包含对我有用的完整脚本。
    猜你喜欢
    • 2013-03-20
    • 1970-01-01
    • 2021-09-29
    • 1970-01-01
    • 1970-01-01
    • 2023-03-20
    • 2010-12-31
    • 2017-11-04
    • 2010-10-18
    相关资源
    最近更新 更多