Skip to content

Instantly share code, notes, and snippets.

@strayge
Created July 28, 2017 00:20
Show Gist options
  • Save strayge/46cf1e264fd1979537885dd148f0dc17 to your computer and use it in GitHub Desktop.
Save strayge/46cf1e264fd1979537885dd148f0dc17 to your computer and use it in GitHub Desktop.
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
; #NoTrayicon
Menu, Tray, Icon, tray.ico,1
Menu, Tray, NoStandard
Menu, Tray, Add, Toggle Touch, Toggle
Menu, Tray, Add,
Menu, Tray, Standard
Menu, Tray, Default, Toggle Touch
Disabled:=GetCurrentStatus()
; Disabled:=0
Toggle: ; double click tray icon to disable/enable
#t:: ; Hotkey to disable/enable
if (Disabled=0) {
Run DevManView.exe /disable "HID-compliant touch screen" ; path to DevManView and disable device with this name/ID
Disabled:=1
Menu, Tray, Icon , trayd.ico,,1
traytip, Touchscreen, disabled ; little tooltip displayed to visualize the current action
;SetTimer, RemoveToolTip, 2000
return
}
else {
Run DevManView.exe /enable "HID-compliant touch screen" ; path to DevManView and enable device with this name/ID
Disabled:=0
Menu, Tray, Icon , tray.ico,,1
traytip, Touchscreen, enabled ; little tooltip displayed to visualize the current action
;SetTimer, RemoveToolTip, 2000
return
}
;RemoveToolTip:
;SetTimer, RemoveToolTip, Off
;ToolTip
;return
GetCurrentStatus()
{
Run DevManView.exe /stab temp.csv
sleep, 1000
isDisabled:=0
Loop, read, temp.csv
{
stringParts := StrSplit(A_LoopReadLine, A_Tab)
name:=stringParts[1]
if (name = "HID-compliant touch screen")
{
status:=stringParts[10]
if (status = "Yes")
{
isDisabled:=1
}
break
}
}
FileDelete, temp.csv
return isDisabled ; 0 - enabled, 1 - disabled
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment