Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

[MOD REQUEST] Auto popup keyboard on desktop

OP VTEChump

14th January 2013, 03:23 PM   |  #31  
tj!2k7's Avatar
Senior Member
Thanks Meter: 43
 
220 posts
Join Date:Joined: Jan 2007
More
Quote:
Originally Posted by netham45

Killing the keyboard without a force flag (/f on taskkill) will cause it to minimize properly without closing.

Can't seem to be able to do that. When I run taskkill /im tabtip.exe
I receive: ERROR: The process "TabTip.exe" with PID 5300 could not be terminated. Reason: Access is denied.

Seems to require admin permissions, but appears to work pretty well. Need to figure out a good way to implement this, thanks.

Quote:
Originally Posted by _SpAiK_

Hey, this is a good solution! I love it although there is one thing that may be improved. I've noticed that the keyboard will also keep popping in when you are reading a text document. It would be perfect if it wouldn't pop until you reset the focus in that window after closed the first time.

This code won't let the keyboard pop up again until the window title has changed (switched to another app, browsed to another page, etc.)

AutoIt
Code:
Global $title,$currentapp

While 1
	If RegRead('HKLM\SYSTEM\CurrentControlSet\Services\kbdclass\Enum', 'Count') = 1 Then
		AdlibRegister('checkwindow')
		$cursor = MouseGetCursor()
		$title = WinGetTitle('','')
		Sleep(1000)
		If $cursor = MouseGetCursor() And $cursor = 5 And $currentapp <> $title Then
			$keyboard = ShellExecute('"C:\Program Files\Common Files\microsoft shared\ink\TabTip.exe"')
			$currentapp = WinGetTitle('','')
		EndIf
	$title = WinGetTitle('','')
	EndIf
WEnd

Func checkwindow()
	$title = WinGetTitle('','')
EndFunc
Last edited by tj!2k7; 15th January 2013 at 03:03 AM.
The Following 3 Users Say Thank You to tj!2k7 For This Useful Post: [ View ]
14th January 2013, 09:59 PM   |  #32  
Junior Member
Thanks Meter: 5
 
18 posts
Join Date:Joined: Jul 2007
I had your script converted to AutoHotKey because that is what I was more use to. The only issue I had was while in Metro the keyboard would popup and stay up so I found how to have the script not run while in Metro. I am not sure if it is the right way but works for me Here is my script with the bold line as being the only line I added:

Code:
#NoEnv
TabTip := A_ProgramFiles . "\Common Files\microsoft shared\ink\TabTip.exe"
While True {
   RegRead, KBCount, HKLM, SYSTEM\CurrentControlSet\Services\kbdclass\Enum , Count
   If (KBCount = 1) {
      Cursor := A_Cursor
      Sleep, 750
      If (Cursor = "IBeam") And (A_Cursor = "IBeam")
IfWinNotActive, ahk_class Windows.UI.Core.CoreWindow
         Run, "%TabTip%"   ; or try the next line instead
         ; DllCall("Shell32.dll\ShellExecute", "Ptr", 0, "Ptr", 0, "Str", TabTip, "Ptr", 0, "Ptr", 0, "Int", 1)
   } Else {
      Sleep, 750
   }
}
I was also trying to figure out how to make the keyboard minimize when you click out of the field and ran into the same must run as Admin problem that you did. I found this but again is for AHK:
http://www.autohotkey.com/board/topi...in-params-lib/

So I downloaded the RunAsAdmin.ahk file and put it in C:\Program Files\AutoHotkey\lib\ and added the line in bold:
Code:
#NoEnv
RunAsAdmin()
TabTip := A_ProgramFiles . "\Common Files\microsoft shared\ink\TabTip.exe"
While True {
   RegRead, KBCount, HKLM, SYSTEM\CurrentControlSet\Services\kbdclass\Enum , Count
   If (KBCount = 1) {
      Cursor := A_Cursor
      Sleep, 750
      If (Cursor = "IBeam") And (A_Cursor = "IBeam")
IfWinNotActive, ahk_class Windows.UI.Core.CoreWindow
         Run, "%TabTip%"   ; or try the next line instead
         ; DllCall("Shell32.dll\ShellExecute", "Ptr", 0, "Ptr", 0, "Str", TabTip, "Ptr", 0, "Ptr", 0, "Int", 1)
   } Else {
      Sleep, 750
   }
}
Now where to put the Taskkill....I don't know
Testing it out with the RunAsAdmin does run the taskkill right but I could only get it to run the taskkill EVERY time you clicked out of the textbox which is ALL the time so it just keeps popping up a black dos box every 750ms...lol. I know why but now to figure out how to impliment it correctly.
Hopefully we can help each other out and get what Microsoft should have had in there in the first place working.
The Following 2 Users Say Thank You to scottdw For This Useful Post: [ View ]
14th January 2013, 10:43 PM   |  #33  
tj!2k7's Avatar
Senior Member
Thanks Meter: 43
 
220 posts
Join Date:Joined: Jan 2007
More
Try this code for auto popup and autohide...I know it's not perfect and the code might be a bit sloppy (I'm no programmer); overall it seems to be working fairly well.

Depending on your UAC level, it will prompt for permission; this is necessary because admin permission is required in order to kill the TabTip process to hide the keyboard.

Try this and let me know what you think. Hit "Thanks" if you find it useful.

AutoIt
Code:
#RequireAdmin

Global $title,$currentapp, $visible

While 1
	If RegRead('HKLM\SYSTEM\CurrentControlSet\Services\kbdclass\Enum', 'Count') = 1 Then
		AdlibRegister('checkwindow')
		$cursor = MouseGetCursor()
		$title = WinGetTitle('','')
		Sleep(250)
		If $cursor = MouseGetCursor() And $cursor = 5 And $currentapp <> $title And $visible = 0 Then
			$keyboard = ShellExecute('"C:\Program Files\Common Files\microsoft shared\ink\TabTip.exe"')
			$currentapp = WinGetTitle('','')
			$visible =1
		ElseIf $cursor <> 5  And $currentapp <> $title And $visible = 1 Then
			Run(@ComSpec & " /c " & 'taskkill /im tabtip.exe', "", @SW_HIDE) 
			$visible = 0
		EndIf
		$title = WinGetTitle('','')
	EndIf
	AdlibUnRegister('checkwindow')
WEnd

Func checkwindow()
	$title = WinGetTitle('','')
EndFunc


---------- Post added at 04:43 PM ---------- Previous post was at 04:33 PM ----------

Quote:
Originally Posted by scottdw

Hopefully we can help each other out and get what Microsoft should have had in there in the first place working.

You'll need some logic to try to figure out when to minimize the keyboard... which is what I'm attempting to do with the $title and $visible variables in my last post.

I haven't had any issues in Metro with my AutoIt script.. any apps in particular?
Last edited by tj!2k7; 15th January 2013 at 01:38 AM.
The Following 3 Users Say Thank You to tj!2k7 For This Useful Post: [ View ]
15th January 2013, 12:27 AM   |  #34  
docfreed's Avatar
Senior Member
Thanks Meter: 141
 
778 posts
Join Date:Joined: Jun 2009
Quote:
Originally Posted by tj!2k7

Try this code for auto popup and autohide...I know it's not perfect and the code might be a bit sloppy (I'm no programmer); overall it seems to be working fairly well.

Depending on your UAC level, it will prompt for permission; this is necessary because admin permission is required in order to kill the TabTip process to hide the keyboard.

Try this and let me know what you think. Hit "Thanks" if you find it useful.

Code:
#RequireAdmin

Global $title,$currentapp, $visible

While 1
	If RegRead('HKLM\SYSTEM\CurrentControlSet\Services\kbdclass\Enum', 'Count') = 1 Then
		AdlibRegister('checkwindow')
		$cursor = MouseGetCursor()
		$title = WinGetTitle('','')
		Sleep(250)
		If $cursor = MouseGetCursor() And $cursor = 5 And $currentapp <> $title And $visible = 0 Then
			$keyboard = ShellExecute('"C:\Program Files\Common Files\microsoft shared\ink\TabTip.exe"')
			$currentapp = WinGetTitle('','')
			$visible =1
		ElseIf $cursor <> 5  And $currentapp <> $title And $visible = 1 Then
			Run(@ComSpec & " /c " & 'taskkill /im tabtip.exe', "", @SW_HIDE) 
			$visible = 0
		EndIf
		$title = WinGetTitle('','')
	EndIf
	AdlibUnRegister('checkwindow')
WEnd

Func checkwindow()
	$title = WinGetTitle('','')
EndFunc


---------- Post added at 04:43 PM ---------- Previous post was at 04:33 PM ----------

You'll need some logic to try to figure out when to minimize the keyboard... which is what I'm attempting to do with the $title and $visible variables in my last post.

I haven't had any issues in Metro with my AutoIt script.. any apps in particular?

Is this script an AutoIt script or an AutoHotKey script - reason I ask is I also browse over on tabletpcreview - some folks are also working on this and have come up with a similar script at: http://forum.tabletpcreview.com/sams...ktop-mode.html
I am not skilled enough to interpret this but maybe some one more experienced could get something useful.
15th January 2013, 01:08 AM   |  #35  
Junior Member
Thanks Meter: 5
 
18 posts
Join Date:Joined: Jul 2007
This one is Autoit. The one over at TabletReview I posted after I had a different one from tj!2k7 here converted to AHK. tj!2k7 is the mastermind I just added a little to it

---------- Post added at 07:08 PM ---------- Previous post was at 06:49 PM ----------

Quote:
Originally Posted by tj!2k7


I haven't had any issues in Metro with my AutoIt script.. any apps in particular?

If i were to go into IE in Metro and click a text field, the keyboard would popup and often stay up with no way to minimize it. I didnt need it in Metro anyway since Metro seems to handle the keyboard the way we are trying to in "Desktop" mode

I will see what i can do with the code you posted....thanks for posting it.
The Following User Says Thank You to scottdw For This Useful Post: [ View ]
15th January 2013, 01:37 AM   |  #36  
tj!2k7's Avatar
Senior Member
Thanks Meter: 43
 
220 posts
Join Date:Joined: Jan 2007
More
Quote:
Originally Posted by docfreed

Is this script an AutoIt script or an AutoHotKey script - reason I ask is I also browse over on tabletpcreview - some folks are also working on this and have come up with a similar script at: http://forum.tabletpcreview.com/sams...ktop-mode.html
I am not skilled enough to interpret this but maybe some one more experienced could get something useful.

My scripts are AutoIt, sorry; I will specify this more clearlyin the future.
15th January 2013, 06:40 PM   |  #37  
jonthe838's Avatar
Senior Member
Flag Gothenburg
Thanks Meter: 7
 
117 posts
Join Date:Joined: Nov 2010
More
Quote:
Originally Posted by tj!2k7

Try this code for auto popup and autohide...I know it's not perfect and the code might be a bit sloppy (I'm no programmer); overall it seems to be working fairly well.

Depending on your UAC level, it will prompt for permission; this is necessary because admin permission is required in order to kill the TabTip process to hide the keyboard.

Try this and let me know what you think. Hit "Thanks" if you find it useful.

AutoIt

Code:
#RequireAdmin

Global $title,$currentapp, $visible

While 1
	If RegRead('HKLM\SYSTEM\CurrentControlSet\Services\kbdclass\Enum', 'Count') = 1 Then
		AdlibRegister('checkwindow')
		$cursor = MouseGetCursor()
		$title = WinGetTitle('','')
		Sleep(250)
		If $cursor = MouseGetCursor() And $cursor = 5 And $currentapp <> $title And $visible = 0 Then
			$keyboard = ShellExecute('"C:\Program Files\Common Files\microsoft shared\ink\TabTip.exe"')
			$currentapp = WinGetTitle('','')
			$visible =1
		ElseIf $cursor <> 5  And $currentapp <> $title And $visible = 1 Then
			Run(@ComSpec & " /c " & 'taskkill /im tabtip.exe', "", @SW_HIDE) 
			$visible = 0
		EndIf
		$title = WinGetTitle('','')
	EndIf
	AdlibUnRegister('checkwindow')
WEnd

Func checkwindow()
	$title = WinGetTitle('','')
EndFunc


---------- Post added at 04:43 PM ---------- Previous post was at 04:33 PM ----------

You'll need some logic to try to figure out when to minimize the keyboard... which is what I'm attempting to do with the $title and $visible variables in my last post.

I haven't had any issues in Metro with my AutoIt script.. any apps in particular?

Thanks for the script but I really can't get it to work.I've done everything you guys have said but it still won't work..
15th January 2013, 09:22 PM   |  #38  
docfreed's Avatar
Senior Member
Thanks Meter: 141
 
778 posts
Join Date:Joined: Jun 2009
Quote:
Originally Posted by jonthe838

Thanks for the script but I really can't get it to work.I've done everything you guys have said but it still won't work..

There's a backslash missing in the line reading "Common Files\Microsoft shared\ink" - should be between Microsoft and shared so it reads "Common Files\Microsoft\shared\ink though this may not be the issue - I had a problem also with this script.

Separately, I wonder if Nircmd.exe might be used for this activity - I have had great success making neat short cuts that Microsoft left out - e.g., Sleep. I just do not know how to configure tabtip.exe for automatic ops.
16th January 2013, 01:48 AM   |  #39  
tj!2k7's Avatar
Senior Member
Thanks Meter: 43
 
220 posts
Join Date:Joined: Jan 2007
More
Quote:
Originally Posted by jonthe838

thanks for the info but it still wont work for me. I'm running w8 on my acer w700. I run the avript and everything but nothing happens except a bunch of tasks that eat away on my memory

Quote:
Originally Posted by jonthe838

Thanks for the script but I really can't get it to work.I've done everything you guys have said but it still won't work..

Sorry to hear you're having trouble. I'm not familiar with the w700; are you using it with an external keyboard or keyboard dock? If so, that would explain why the script doesn't do anything.

Download the attached AutoIt script, remove the .txt extension, run it, and let me know if it works or what happens. What are the tasks you refer to in that first post?
Attached Files
File Type: txt keyboard.au3.txt - [Click for QR Code] (809 Bytes, 381 views)
Last edited by tj!2k7; 16th January 2013 at 04:35 AM.
The Following User Says Thank You to tj!2k7 For This Useful Post: [ View ]
16th January 2013, 02:25 AM   |  #40  
Recognized Developer
Flag Denver
Thanks Meter: 542
 
868 posts
Join Date:Joined: Jun 2009
Donate to Me
More
Here's what I came up with.


Bit sloppy, I wrote it like a week ago at 2 AM.

The main issue is that I can't tell when a textbox is activated in Internet Explorer with this method (Or Chrome or FF, for that matter), due to the way the sandboxing works.
Code:
#include <iostream>
#include <Windows.h>
HWND RemoteGetFocus();
int main()
{
	BOOL isKeyboardUp = false;
	system("taskkill /im \"TabTip.exe\" 1>nul 2>nul");
	HWND hwnd;
	HWND lastHwnd = 0;
	while (true)
	{
		Sleep(250);
		hwnd = RemoteGetFocus();
		if (hwnd == lastHwnd)
			continue;
		lastHwnd = hwnd;
		TCHAR className[MAX_PATH];
		GetClassName(hwnd, className, sizeof(className));
		printf("Got hwnd: %p classname: %s\n",hwnd,className);
		if (hwnd && 
			((strcmp(className,"Edit") == 0) || //Most system classnames
			(strcmp(className,"_WwG") == 0) || //Word
			(strcmp(className,"Scintilla") == 0))&&  //Notepad++
			!isKeyboardUp)
		{
			system("\"C:\\Program Files\\Common Files\\Microsoft Shared\\ink\\TabTip.exe\"");
			isKeyboardUp=true;
		}
		else if (isKeyboardUp)
		{
			system("taskkill /im \"TabTip.exe\" 1>nul 2>nul");
			isKeyboardUp=false;
		}
	}
	system("pause");
	return 0;
}

HWND RemoteGetFocus()
{
    HWND hwnd = GetForegroundWindow();
    DWORD remoteThreadId = GetWindowThreadProcessId(hwnd, NULL);
    DWORD currentThreadId = GetCurrentThreadId();
    AttachThreadInput(remoteThreadId, currentThreadId, TRUE);
    HWND focused = GetFocus();
    AttachThreadInput(remoteThreadId, currentThreadId, FALSE);
    return focused;
}
Note: C++, not AutoIt.

Run as admin to use it.
Attached Files
File Type: zip autoKeyboard_x86.zip - [Click for QR Code] (5.6 KB, 487 views)
File Type: zip autoKeyboard_Arm.zip - [Click for QR Code] (5.3 KB, 97 views)
Last edited by netham45; 16th January 2013 at 02:29 AM.

The Following 4 Users Say Thank You to netham45 For This Useful Post: [ View ]
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes