lenovo53594437 发表于 2023-8-23 15:43:29

给不用不用小红点 的 thinkpad 的 产品经理的建议


现在B站上都知道thinkpad 再小红点上不作为,不思进取的事情,因此我这里分享一个小红点的优化教程
小红点现在改造后,由于和系统的鼠标是同一个设置,加上小红点的移动效果不好,加速度不好控制。 因此,我这里参考国外大神的 autohotkey 的功能,写了一个这样的代码

其主要的意义就是,默认情况小,小红点可以移动特别快,当你再输入表格或者打字的时候,通过按住热键,就可以让小红点移动变慢,具体代码如下,该代码需要autohotkey 环境才能运行


; Autohotkey script "Toggle Mouse sensitivity"
;=================================================================================
SlowMouseSpeed      := 1
NormalMouseSpeed    := true ; State of Mouse pointer speed
UserMouseSpeed      := 0    ; Speed sensed before slow down
MouseThreshold1   := 6
MouseThreshold2   := 10
MouseEnhance      := 1

SPI_GETMOUSESPEED   := 0x70
SPI_SETMOUSESPEED   := 0x71
SPI_SETMOUSE      := 0x04

;=================================================================================
*LAlt::   toggleMouseSpeed()

;=================================================================================
toggleMouseSpeed() {
    global
    ; SET LOW SPEED
    if( NormalMouseSpeed )
    {
      ; SENSE BEFORE
      DllCall("SystemParametersInfo", UInt,SPI_GETMOUSESPEED, UInt,0, UIntP,prevSpeed, UInt,0)

      ; Temporarily reduces the mouse cursor's speed.
      ; Retrieve the current speed so that it can be restored later
      DllCall("SystemParametersInfo", UInt,SPI_GETMOUSESPEED, UInt,0, UIntP,UserMouseSpeed, UInt,0)
      ; Slow down mouse speed
      DllCall("SystemParametersInfo", UInt,SPI_SETMOUSESPEED, UInt,0, UInt,SlowMouseSpeed, UInt,0)

      ; SENSE AFTER
      DllCall("SystemParametersInfo", UInt,SPI_GETMOUSESPEED, UInt,0, UIntP,currentSpeed, UInt,0)
      ToolTip, Mouse slow: %currentSpeed%/20

      ; REMEMBER CURRENT STATE
      NormalMouseSpeed := false
    }
    ; RESTORE SPEED
    else {
      ; SENSE BEFORE
      DllCall("SystemParametersInfo", UInt,SPI_GETMOUSESPEED, UInt,0, UIntP,prevSpeed, UInt,0)

      ; Restore the original speed.
      DllCall("SystemParametersInfo", UInt, SPI_SETMOUSESPEED, UInt,0, UInt,UserMouseSpeed, UInt,0)

      ; Restore the original speed acceleration thresholds and speed
      VarSetCapacity(MySet, 32, 0)
      InsertInteger(MouseThreshold1, MySet, 0)
      InsertInteger(MouseThreshold2, MySet, 4)
      InsertInteger(MouseEnhance   , MySet, 8)
      DllCall("SystemParametersInfo", UInt,SPI_SETMOUSE, UInt,0, Str,MySet, UInt,1)

      ; SENSE AFTER
      DllCall("SystemParametersInfo", UInt,SPI_GETMOUSESPEED, UInt,0, UIntP,currentSpeed, UInt,0)
      ToolTip, Mouse restored: %currentSpeed%/20

      ; REMEMBER CURRENT STATE
      NormalMouseSpeed := true
    }
    SetTimer, RemoveToolTip, 1000
}
;=================================================================================
InsertInteger(pInteger, ByRef pDest, pOffset = 0, pSize = 4) {
    ; Copy each byte in the integer into the structure as raw binary data.
    Loop %pSize%
    DllCall("RtlFillMemory", "UInt",&pDest + pOffset + A_Index-1, "UInt", 1, "UChar", pInteger >> 8*(A_Index-1) & 0xFF)
}
;=================================================================================
RemoveToolTip:
SetTimer, RemoveToolTip, Off
ToolTip
return

;=================================================================================

泡椒味的不二家 发表于 2023-9-29 00:48:40

页: [1]
查看完整版本: 给不用不用小红点 的 thinkpad 的 产品经理的建议