brigcam wrote: ↑23 Apr 2021, 13:40
thank you very much! maybe it's possible to capture also the "switch" button? the one that switches between the "step" and "fast" mode for the wheel, it can be remapped with logitech options
Yes, I was able to use the old
AHKHID scripts from "The Good" to find and use this button on the mouse without the Logitech software running. You will need the
AHKHID Library in your library folder or directly called by the script. It's a complex script but the mouse settings should be the same for everyone so, theoretically, you should only need to add your command to the bottom.
The button's label is simply "4:" and it must be used as a label, not a hotkey. I've added a prefix and now the glable is "Default_4" which should trigger no matter what window is active. If you want to make the button context sensitive, i.e. have a different function for different windows, you can use my old script
Other HID Info to create the labels and associations.
Code: Select all
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
#SingleInstance, Force
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
AHKHID_UseConstants() ;If AHKHID.ahk is in your library use this line as is.
; If you want to call the script from the directory your script is in or a particular directory
; you would use something like this.
;#Include C:\enter your directory path here\AHKHID.ahk
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Create GUI to receive messages
Gui, +LastFound
hGui := WinExist()
;Intercept WM_INPUT messages
WM_INPUT := 0xFF
OnMessage(WM_INPUT, "InputMsg")
;Register Remote Control with RIDEV_INPUTSINK (so that data is received even in the background)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
r := AHKHID_Register(65280, 2, hGui, RIDEV_INPUTSINK) ;Replace 65468 with your device's Usage
;Page number and 137 with you device's Usage number. If your device has more than 1 Usage Page/Usage
;Make a copy of this line for each one.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Prefix loop
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Replace the prefixes with the prefixes you used to make your g-label. These must match exactly.
Loop {
Sleep 1000
If WinActive("ahk_class QWidget") Or WinActive("ahk_class VLC DirectX")
sPrefix := "VLC_"
Else If WinActive("ahk_class Winamp v1.x") Or WinActive("ahk_class Winamp Video")
sPrefix := "Winamp_"
Else If WinActive("ahk_class MediaPlayerClassicW")
sPrefix := "MPC_"
Else sPrefix := "Default_" ;If you're using labels without prefixes delete the word "Default".
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
}
Return
InputMsg(wParam, lParam) {
Local devh, iKey, sLabel
Critical
;Get handle of device
devh := AHKHID_GetInputInfo(lParam, II_DEVHANDLE)
;Check for error
If (devh <> -1) ;Check that it is my HP remote
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
And (AHKHID_GetDevInfo(devh, DI_DEVTYPE, True) = RIM_TYPEHID)
And (AHKHID_GetDevInfo(devh, DI_HID_VENDORID, True) = 1133) ;Replace these three
And (AHKHID_GetDevInfo(devh, DI_HID_PRODUCTID, True) = 50475) ;numbers with your
And (AHKHID_GetDevInfo(devh, DI_HID_VERSIONNUMBER, True) = 9223) { ;devices numbers.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Get data
iKey := AHKHID_GetInputData(lParam, uData)
;Check for error
If (iKey <> -1) {
;Get keycode
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
iKey := NumGet(uData, 1, "UChar") ;If you had to change "+#" to something other
; than 1 it must be changed here too.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Call the appropriate sub if it exists
sLabel := sPrefix iKey
If IsLabel(sLabel)
Gosub, %sLabel%
}
}
}
; From here down replace these with your g-labels and commands. These are "TheGoods" examples.
; Remeber the word "Default_" is valid for a prefix and will be active any time an application
; for one of your other label is not in focus. The first example can be used to open VLC Media Player
; then the "VLC_" labels can control it.
Default_4:
MsgBox, MX Master Mouse
Return