2015-10-09 49 views
0

姿態重新綁定最近我一直在試圖重新綁定我羅技無線觸控板的三指手勢在的Windows 10桌面之間進行切換。我使用的代碼是如下:AHK:特定HID鼠標

#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只使用觸控板進行手勢操作?如果是這樣,怎麼樣?

回答

0

您有兩種選擇!

  1. 您可以激活您的熱鍵排除某些窗口
  2. 讓你的快捷鍵只在排除其他所有
  3. 某些Windows活動

您可以通過使用#IfWinActive#IfWinActive IfWinActiveWinGet,很多的選擇上做到這一點功能和命令爲此...

既然你提到的桌面,我很好奇如何檢測如果桌面是活動的,下面是結果:

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