AHK:特定HID鼠标的手势重新绑定

时间:2015-10-09 19:20:29

标签: autohotkey gestures trackpad

最近,我一直试图重新绑定我的 Logitech无线触控板的三指手势,以在 Windows 10 中的桌面之间切换。我使用的代码如下:

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
XButton1::SendInput {LCtrl down}{LWin down}{Right}{LCtrl up}{LWin up}
XButton2::SendInput {LCtrl down}{LWin down}{Left}{LCtrl up}{LWin up}
#F::Send {LWin down}{Tab}{LWin up}

然而,当我按下鼠标上的按钮时,我用于Browser_forward和Browser_Back,鼠标也会在桌面之间切换。您是否可以强制AutoHotKey仅使用触控板进行手势?如果是这样,怎么样?

1 个答案:

答案 0 :(得分:0)

你有两个选择!

  1. 您可以排除某些窗口激活热键
  2. 仅在某些窗口中激活您的热键,不包括所有其他窗口
  3. 您可以使用#IfWinActive #If WinActive IfWinActive WinGet执行此操作,有关此功能和命令的大量选项...

    由于您提到了桌面,我很好奇如何检测桌面是否处于活动状态,以下是结果:

    #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
    ; #Warn  ; Enable warnings to assist with detecting common errors.
    SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
    SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
    $XButton1::
        If (IsDeskTopActive())
            SendInput {LCtrl down}{LWin down}{Right}{LCtrl up}{LWin up}
        Else 
            SendInput {XButton1}
    Return
    
    $XButton2::
    If (IsDeskTopActive()) 
         SendInput {LCtrl down}{LWin down}{Left}{LCtrl up}{LWin up}
    Else 
        SendInput {XButton2}
    return
    
    #F::Send {LWin down}{Tab}{LWin up}
    
    IsDesktopActive() { ; Modified.. orignal by HotKeyIt
        MouseGetPos,,,win
        WinGetClass, class, ahk_id %win%
        If class in Progman,WorkerW
            Return True
        Return False
    }