0

最近、Logitech Wireless Trackpadの 3 本指ジェスチャーを再バインドして、 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 がトラックパッドのみをジェスチャに使用するように強制できますか? もしそうなら、どのように?

4

1 に答える 1

1

ここには 2 つのオプションがあります。

  1. 特定のウィンドウをホットキーのアクティブ化から除外できます
  2. ホットキーを特定のウィンドウでのみアクティブにし、他のすべてのウィンドウを除外する

#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
}
于 2015-10-09T22:06:25.597 に答える