Skip to content

Instantly share code, notes, and snippets.

@G33kDude
Last active January 10, 2021 20:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save G33kDude/46247bfc2da494b1c692cdc7232dc9e9 to your computer and use it in GitHub Desktop.
Save G33kDude/46247bfc2da494b1c692cdc7232dc9e9 to your computer and use it in GitHub Desktop.
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