Last active
January 10, 2021 20:36
-
-
Save G33kDude/46247bfc2da494b1c692cdc7232dc9e9 to your computer and use it in GitHub Desktop.
Synaptics Touchpad Toggle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; 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