Skip to content

Instantly share code, notes, and snippets.

@miabrahams
Created August 6, 2018 23:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save miabrahams/dfb2619f757f8993a44c788fe65b99ec to your computer and use it in GitHub Desktop.
Save miabrahams/dfb2619f757f8993a44c788fe65b99ec to your computer and use it in GitHub Desktop.
Autohotkey touch keyboard toggle for Windows 10
; Autohotkey script to toggle Windows 10 touch keyboard.
ToggleTouchKeyboard()
{
; Translated to AHK from https://stackoverflow.com/a/39385492
Shell_TrayWnd := FindWindowEx( 0, 0, "Shell_TrayWnd")
TrayNotifyWnd := FindWindowEx( Shell_TrayWnd, 0, "TrayNotifyWnd")
TIPBand := FindWindowEx( TrayNotifyWnd, 0, "TIPBand")
if (!TIPBand or ErrorLevel)
{
MsgBox % "Could not get TIPBand. ErrorLevel: " ErrorLevel
}
else
{
PostMessage, 0x201, 1, 65537, , ahk_id %TIPBand%
PostMessage, 0x202, 1, 65537, , ahk_id %TIPBand%
}
}
FindWindowEx( hwnd_parent, hwnd_child, str_class, p_title=0 )
{
if ( p_title = 0 )
type_title = UInt
else
type_title = Str
return, DllCall( "FindWindowEx"
, UInt, hwnd_parent
, UInt, hwnd_child
, Str, str_class
, type_title, p_title )
}
@neonfishingrod
Copy link

When I try to call this from my pen button via the Win10 ink option, clicking a second time when the keyboard is open closes and reopens the keyboard. Calling the function twice fixes this for some reason.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment