Skip to content

Instantly share code, notes, and snippets.

@G33kDude

G33kDude/synaptics.ahk

Last active Jan 10, 2021
Embed
What would you like to do?
Synaptics Touchpad Toggle
; Script to turn the Synaptics Touchpad on and off. Useful for laptops with
; Synaptic touchpads that do not have dedicated touchpad on/off buttons. I use
; this code to quickly toggle on and off the touchpad on my Lenovo Thinkpad,
; where I primarily use the TrackPoint.
; API Reference
; https://autohotkey.com/board/topic/65849-controlling-synaptics-touchpad-using-com-api/page-2#entry416712
; Constants
SE_ConnectionAny := 0
SE_DeviceTouchPad := 2
SP_DisableState := 268435825
; Connect to the Synaptics controller
SynAPI := ComObjCreate("SynCtrl.SynAPICtrl")
SynDev := ComObjCreate("SynCtrl.SynDeviceCtrl")
SynAPI.Initialize()
; Select the touchpad device
DeviceHandle := SynAPI.FindDevice(SE_ConnectionAny, SE_DeviceTouchPad, -1)
SynDev.Select(DeviceHandle)
; Invert the disabled state
SynDev.SetLongProperty(SP_DisableState, !SynDev.GetLongProperty(SP_DisableState))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment