Jump to content

Close Windows 10 Touch Keyboard


onefish
 Share

Recommended Posts

Background

I am developing a database to run on a couple Windows 10 10.1" touchscreen tablets. The database software isn't designed/optimized for touch so it doesn't play nicely with the Touch Keyboard. eg. The keyboard does not pop up when I select a text input field in the database, nor does it close/minimize when I select a non-text input based item in the database. I can easily get the keyboard to pop up by sending a simple start TabTip.exe event upon field entry. This does not require AutoIT. I can run a cmd command or AutoIt script upon leaving the text field but I cannot seem to get anything to close the keyboard.

Issues

I know I can killtask and this will close the touch keyboard but this is not really an acceptable approach. If the process is terminated then the touch keyboard does not become available for text entry fields elsewhere in the Windows environment. To close the keyboard manually, there is an 'X' in the top right corner but I believe that it is only minimized somehow because the process remains active. I need to replicate this behavior.

Using simulated mouse clicks isn't really a viable alternative as the tablets could be in portrait or landscape orientation, and the keyboard can be undocked and moved around the screen.

I have read that the Windows Touch Keyboard runs with elevated privileges. I was unable to get WinClose to work and this may be why.

Window Info

Running the Au3 Window Info utility indicates:

Title:

Class: IPTip_Main_Window

Position: 0, 343

Size: 1097, 343

Style: 0x94000000

ExStyle: 0x08000088

Handle: 0x000306F6

Question

Can AutoIT close the Windows 10 Touch Keyboard, and if so how?

Thanks heaps (in advance)

--------------------------------------------------------------------EDIT---------------------------------------------------------------------

I've been playing around some more and it appears that if I run "TASKKILL /IM TabTip.exe" in an administrator cmd prompt, it closes the keyboard but does not kill the actual process. It does not work in a standard cmd prompt. That's what I need but it seems to be nearly impossible to automate running cmd as administrator. I could probably get "runas" to work but then it's dependent upon certain users, etc which isn't ideal. So I am thinking that if AutoIT can send the same WM_CLOSE message to the target program and I compile the script into an exe, I should be able to set the exe to always run as administrator under properties/compatibility. Does that sound correct? What AutoIT function/s will send the same WM_CLOSE message?

OK, bad idea. Just thought I'd try to do it with the WinClose function compiled to an exe set to always run as administrator. WinClose didn't work but more importantly Windows prompts user input to allow it to run.

Edited by onefish
Link to comment
Share on other sites

Hi, 2 possible options i would try

WinClose('[CLASS:IPTip_Main_Window]')

Opt("MouseCoordMode", 0)
$aArray=WinGetPos('[CLASS:IPTip_Main_Window]')
;$aArray=WinGetPos('[CLASS:SciTEWindow]')
;$aArray[0] = X position
;$aArray[1] = Y position
;$aArray[2] = Width
;$aArray[3] = Height
MouseClick('left', $aArray[2]-$aArray[2]*0.015, $aArray[3]*0.015)
;MouseMove($aArray[2]-$aArray[2]*0.015, $aArray[3]*0.015)

Since you tried the first one, the second gives you a percentage of the size of the window, so whatever the size is, portrait or not, it should click the X everytime.

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

Careca, thanks for the suggestion. Unfortunately it didn't work. I am thinking that

;$aArray=WinGetPos('[CLASS:SciTEWindow]')

was a mistake? Should the X and Y positions be included in the calculation? The error seems to be non accessible variable. I tried changing to mousemove instead of mouseclick so I could see what's happening and the script simply isn't completing. I don't think it's getting the window position.

Edited by onefish
Link to comment
Share on other sites

yea, can't find the window, try with

Opt("WinTitleMatchMode", 4)

Else adapt the help file example

Local $hWnd = WinGetHandle("Untitled - Notepad", "")
WinClose($hWnd)

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

Local $hWnd = WinGetHandle("[CLASS:IPTip_Main_Window]", "")
WinClose($hWnd)

 

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

Ran the results in a msgbox first and I don't think it's grabbing the handle. Says it's 0x00000000 is it possible that that is correct? The AutoIT Window Info utility picks up the handle as 0x00002022

Edited by onefish
Link to comment
Share on other sites

AutoIt was simply not designed to operate on tablets, despite having windows 10 on it, it will not have all the same API's as a lap or desktop. And the Applications on it will not be standard win32 windows/gui's.

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

8 minutes ago, JohnOne said:

despite having windows 10 on it, it will not have all the same API's as a lap or desktop

Thanks John, I'm pretty sure it is just stock standard Windows 10 though. I upgraded them myself and didn't use any cut down, or tablet specific versions of the OS. The Touch Keyboard is baked into Windows 10 and is on all laptops and desktops using the OS (unless the user has removed it somehow).

Link to comment
Share on other sites

I am liking the idea of sending a mouse click proposed by careca more and more as the requirement for elevated privileges to send the taskkill command is turning out to be problematic. As the AutoIT v3 Window utility is able to recognize the window and provide it's handle I am wondering if its possible to wingethandle by X and Y coordinates? 90 & 570 should ensure it's in the keyboard window mostly all the time. I'm hoping that having the correct handle would enable wingetpos to work better than it does by class. Or am I way off base?

Edited by onefish
Link to comment
Share on other sites

Did you try _WinAPI_GetWindow?

Im thinking if the tool can see it, there has to be a way to do it through script.

i was looking at some stuff and i was thinking you could try to use advanced title format

X \ Y \ W \ H - The position and size of a window

Example: WinWait("[W:360]\[H:76]") Since you know the size of the window, and there is little chance there is another the same exact size..

Edited by careca
Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

I think I may be running out of options here, argh! As the touch keyboard appears to run with elevated privileges, all my attempts to send messages to it to close fail unless I run as administrator, which creates a whole new set of issues. I thought that sending a mouse click to the close control coordinates of the keyboard would bypass all that but I can't get that to work either. I was able to work out that @DesktopWidth - 30 and @DesktopHeight - 316 is the center of the close control on both portrait and landscape modes as long as I don't un-dock the keyboard. But sending a mouseclick to that location moves the mouse cursor and appears to do a left click (small infinity symbol for fraction of a second) but it doesn't close the keyboard. I tried using Opt("MouseCoordMode",1) with ControlClick in that location too and still nothing.

Should I admit defeat? :(

Link to comment
Share on other sites

On 1/24/2016 at 11:14 AM, onefish said:

@DesktopWidth - 30 and @DesktopHeight - 316 is the center of the close control on both portrait and landscape modes as long as I don't un-dock the keyboard.

Can you get a Control ID for the close item?

controlclick('[W:WindowWidth]\[H:WindowHeight]', '', ID)

with

Opt("WinTitleMatchMode", 4)

What happens?

Edited by careca
typo
Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

careca, thanks for persisting. I had to divert my attention to other parts of this project for a while and have just found time to try your suggestion. The window info utility doesn't indicate any control ID for the 'X'/close control on the keyboard. I think I will give up on this nicety, it isn't critical after all. Just preferred behavior.

Link to comment
Share on other sites

As a test, i put up the OSK the windows has, and docked it, and similarly to you, i can't seem to close it.

Capture.PNG

Tried this, it gave me weird results, different from the autoit tool.

Opt("WinTitleMatchMode", 4)
#include <Array.au3>
#include <WinAPIProc.au3>
$aData = _WinAPI_EnumProcessWindows(_WinAPI_GetProcessID('osk.exe'),0)
_ArrayDisplay($aData, '_WinAPI_EnumProcessWindows')

 

Edited by careca
Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...