調整 Windows 10 捲軸以預設跳到點擊的位置

調整 Windows 10 捲軸以預設跳到點擊的位置

在 Windows 10(可能還有所有其他 Windows 版本)中,按一下其手把上方或下方的捲軸可向上或向下捲動一頁。但相反,我想跳到點擊的位置。已經有一個功能了,這是透過使用Shift+Click或(在某些應用程式中)右鍵單擊並從上下文選單中選擇“滾動到此處”來觸發的。但我希望該功能成為預設行為。

如何使“滾動到此處”成為捲軸中左鍵單擊的預設操作?

理想情況下,應該有一個註冊表設定或類似的東西。但我也願意接受像 AutoHotKey 腳本這樣的駭客攻擊,該腳本可以檢測滾動條上的左鍵單擊並Shift為這些單擊注入 a 。

答案1

試試這個 AutoHotkey 腳本:

~LButton Up::
    ; Get the current position of the mouse cursor:
    MouseGetPos, MouseX, MouseY, A ; A means the active window
    ; Get the position and size of the active window:   
    WinGetPos, WinX, WinY, WinWidth, WinHeight, A
    If (MouseX > (WinWidth - 20) and MouseX < WinWidth and MouseY > 200) ; right edge 
        SendInput, +{Click} ; + is the symbol for Shift
return

https://www.autohotkey.com/docs/commands/MouseGetPos.htm https://www.autohotkey.com/docs/commands/WinGetPos.htm https://www.autohotkey.com/docs/Hotkeys.htm#Symbols

答案2

這是一個改編這個答案修復了一些錯誤並設定了一個過濾器,使腳本僅在預先定義的應用程式中啟動。

仍有改進的空間。例如,您無法再拖曳滾動手柄。

自動熱鍵腳本

#NoEnv
#Warn All

#If MouseIsOverScrollbar("firefox|chrome|notepad|hh")
LButton::
    ; "+" is the modifier for shift
    SendInput, +{Click}
return
#If

MouseIsOverScrollbar(Exe_Regex) {
    if (A_Cursor != "Arrow")
        return False

    MouseGetPos, _X, _Y, WindowUnderMouse

    WinGet, Exe, ProcessName, ahk_id %WindowUnderMouse%
    if (not Exe ~= "^(" . Exe_Regex . ")\.exe")
        return False

    WinActivate, ahk_id %WindowUnderMouse%
    MouseGetPos, MouseX, MouseY
    WinGetPos, _X, _Y, WinWidth, _H, ahk_id %WindowUnderMouse%
    ScrollbarWidth = 25
    HeaderWidth = 40
    return MouseX > WinWidth - ScrollbarWidth
       and MouseY > HeaderWidth
}

對於 AutoHotKey 2,您可能需要切換到CoordMode, Mouse, ClientWinGetClientPos

對於調試,我發現SoundPlay *-1每當插入 Shift+Click 時都會很有幫助。

相關內容