所以我試圖創建一個腳本,將滾動左側和右側,同時按住鼠標中鍵。但是,無論鼠標中鍵是否按下,滾動左右滾動。它總是執行。我需要幫助來解決這個問題。(AHK)如果GetKeyState語句不工作?
(我在第21行注意到有一點太多的空間,忽略) 代碼:
; Hold the scroll wheel and scroll to scroll horizontally
; Scroll up = left, scroll down = right
#NoEnv
;#InstallMouseHook
#HotkeyInterval 1
#MaxHotkeysPerInterval 1000000 ; Prevents the popup when scrolling too fast
GetKeyState, ScrollState, MButton
if(ScrollState = U)
{
;return
}
else if(ScrollState = D)
{
WheelUp::Send {WheelLeft}
return
WheelDown:: Send {WheelRight}
return
}
return
感謝您的支持。如果你能解釋最後兩行的含義(特別是%和?符號),那會很好。 – 2013-04-28 22:27:01
它使用所謂的三元運算符,這是一個縮短if/then/else。因此,對於Wheelup,如果'state = 1',則發送結果'{WheelLeft}'或發送'{WheelUp}'。爲了清楚起見,我加入了我的答案。 – 2013-04-28 22:31:12