通用中键滚动,使用笔记本电脑和键盘上的鼠标指针

通用中键滚动,使用笔记本电脑和键盘上的鼠标指针

我有一台新的 HP ZBook G6。它有两排鼠标按钮,上面一排是键盘中间的鼠标指针,下面一排是触控板。我已完全禁用触控板(和下面一排鼠标按钮);我只使用鼠标指针和上面一排鼠标按钮。因此,我在此的帖子仅指鼠标指针和中上鼠标按钮,在此照片中用红色圈出:

HP ZBook 17 G6 键盘和触摸板

我主要使用中键配合指针滚动窗口:我按住中键(用拇指)并同时移动指针以我想要的方向和速度滚动。这在许多程序中效果很好,但在其他程序中则不行。它适用于 Firefox 和 Chrome 等网络浏览器以及 Word 和 Excel 等许多应用程序,但与其他应用程序完全不兼容,最明显的是 Windows 资源管理器、Windows 配置窗口、Microsoft OneNote 等。

我还有一台联想 ThinkPad T510,它可以在所有这些应用程序中使用指针和中键滚动,因此,据我所知,我列出的这些应用程序都支持鼠标中键滚动。

我已经对此主题进行了大量搜索,但未能找到合适的解决方案。(除其他外,我已从 HP 网站更新到最新驱动程序。)我还尝试了 AutoHotKey 脚本(AutoHotkey 滚动、中键单击和鼠标加速),但它让我的鼠标失去控制,并且脚本太复杂了,我无法调试,所以我没有进一步研究它。

我将非常感激任何关于如何在我的笔记本电脑上的这些应用程序(Windows 资源管理器、Microsoft OneNote 等)上使用中键滚动功能的指导。这只是一个小事件,但我每天都会遇到很多次,所以我想让它发挥作用。

答案1

我对 AutoHotKey 解决方案进行了更多搜索,我找到了 ahp 的脚本在我修复了一个小错误之后,它对我有用:

; Description: Scroll Explorer on middle mouse button drag
; Permalink: https://autohotkey.com/boards/viewtopic.php?t=43715
; Author: aph
; Version: 0.2
$*MButton::
    MouseGetPos, CursorX, CursorY, Window, ClassNN
    WinGetTitle, Title, ahk_id %Window%
    WinGetClass, ahk_class, ahk_id %Window%
    WinGet ahk_exe, ProcessName, ahk_id %Window%
    WinGet ahk_PID, PID, ahk_id %Window%
    WinGetText, VisibleText, ahk_id %Window%
    MouseGetPos, CursorX_ended, CursorY_ended, Window_ended, ClassNN_ended
    WinGetClass, ahk_class_ended, ahk_id %Window_ended%
    WinGet ahk_exe_ended, ProcessName, ahk_id %Window_ended%
    AllowedApp := ahk_exe = "explorer.exe" or ahk_exe = "mmc.exe" or ahk_exe = "systempropertiesadvanced.exe" or ahk_exe = "filezilla.exe" or ahk_exe = "7zFM.exe"
    AllowedText := InStr(VisibleText, "Tree View") or InStr(VisibleText, "FolderView")
    LimitedApp := ahk_exe = "cmd.exe"
    DisabledApp := ahk_class_ended = "Shell_TrayWnd" or ahk_class_ended = "WorkerW"
    if (AllowedText >= 1)
        AllowedText = 1
    If (DisabledApp) {
        SendInput, {MButton Down}
        Return
    }
    Else If (!AllowedApp and !LimitedApp and !AllowedText) {
        SendInput, {MButton Down}
        Return
    }
    Else {
        If (AllowedApp) {
            SendInput, {MButton}
        }
        MiddleScroll := 1
        SetSystemCursor("SIZEALL")
        Sensitivity = 10 ; How far the middle mouse wheel has to be dragged before scrolling is triggered
        MouseGetPos, X1, Y1, , c, 2
        OrigTimer := 50 ; How quickly the file list scrolls
        SetTimer, MBScroll, %OrigTimer%
        MBScroll:
            MouseGetPos, X2, Y2
            Distance := Abs(Y2-Y1)
            If (Distance >= Sensitivity) {
                Rounded := % Round((Distance / 200)**1.25+1)
                DllCall("SystemParametersInfo", UInt, 0x69, UInt, Round(Ln(Rounded)+1), UInt, 0, UInt, 0) ; Vary lines scrolled by distance of drag 
                Percent := (A_ScreenHeight - (Max(Y1, Abs(Y1-A_ScreenHeight)) - Distance)) / A_ScreenHeight * 100
                Timer := Round(OrigTimer - (OrigTimer/2*Percent/100))
                SetTimer, MBScroll, %Timer%
                SendInput, % "{Blind}{Wheel" (Y2 > Y1 ? "Down" : "Up") " " Rounded "}"
            }
        Return
        $*MButton Up::
            DllCall("SystemParametersInfo", UInt, 0x69, UInt, 3, UInt, 0, UInt, 0) ; Set back to 3 lines scrolled
            SetTimer, MBScroll, off
            SetSystemCursor()
            MiddleScroll := 0
            SendInput {MButton Up}
            SetSystemCursor(Cursor="") {
                SystemCursors := "32512IDC_ARROW|32513IDC_IBEAM|32514IDC_WAIT|32515IDC_CROSS|32516IDC_UPARROW|32642IDC_SIZENWSE|32643IDC_SIZENESW|32644IDC_SIZEWE|32645IDC_SIZENS|32646IDC_SIZEALL|32648IDC_NO|32649IDC_HAND|32650IDC_APPSTARTING|32651IDC_HELP"
                If (Cursor = "")
                    Return DllCall("SystemParametersInfo", "UInt", 0x57, "UInt", 0, "UInt", 0, "UInt", 0) 
                If (StrLen(SystemCursors) = 221)
                    Loop, Parse, SystemCursors, |
                        StringReplace, SystemCursors, SystemCursors, %A_LoopField%, % DllCall("LoadCursor", "UInt", 0, "Int", SubStr(A_LoopField, 1, 5)) A_LoopField
                If !(Cursor := SubStr(SystemCursors, InStr(SystemCursors "|", "IDC_" Cursor "|") - 5 - p := (StrLen(SystemCursors) - 221) / 14, 5))
                    MsgBox, 262160, %A_ScriptName% - %A_ThisFunc%(): Error, Invalid cursor name!
                Else
                    Loop, Parse, SystemCursors, |
                        DllCall("SetSystemCursor", "UInt", DllCall("CopyIcon", "UInt", Cursor), "Int", SubStr(A_LoopField, 6, p))
                }
        Return
    }
Return

相关内容