Created
August 6, 2018 23:26
-
-
Save miabrahams/dfb2619f757f8993a44c788fe65b99ec to your computer and use it in GitHub Desktop.
Autohotkey touch keyboard toggle for Windows 10
This file contains hidden or 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
; 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 ) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.