Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,772,106 Members 40,505 Now Online
XDA Developers Android and Mobile Development Forum

[MOD REQUEST] Auto popup keyboard on desktop

Tip us?
 
tj!2k7
Old
(Last edited by tj!2k7; 15th January 2013 at 02:03 AM.)
#31  
tj!2k7's Avatar
Senior Member
Thanks Meter 39
Posts: 217
Join Date: Jan 2007
Quote:
Originally Posted by netham45 View Post
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_ View Post
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
There is always another way, usually a better one.

Samsung ATIV SmartPC Pro 700T
Samsung Galaxy Note3

Motorola Droid Bionic Retired
B&N Nook Color Sold
Motorola Droid Retired
The Following 2 Users Say Thank You to tj!2k7 For This Useful Post: [ Click to Expand ]
 
scottdw
Old
#32  
Junior Member
Thanks Meter 2
Posts: 18
Join Date: 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 User Says Thank You to scottdw For This Useful Post: [ Click to Expand ]
 
tj!2k7
Old
(Last edited by tj!2k7; 15th January 2013 at 12:38 AM.)
#33  
tj!2k7's Avatar
Senior Member
Thanks Meter 39
Posts: 217
Join Date: Jan 2007
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 View Post
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?
There is always another way, usually a better one.

Samsung ATIV SmartPC Pro 700T
Samsung Galaxy Note3

Motorola Droid Bionic Retired
B&N Nook Color Sold
Motorola Droid Retired
The Following 2 Users Say Thank You to tj!2k7 For This Useful Post: [ Click to Expand ]
 
docfreed
Old
#34  
docfreed's Avatar
Senior Member
Thanks Meter 140
Posts: 774
Join Date: Jun 2009
Quote:
Originally Posted by tj!2k7 View Post
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.
 
scottdw
Old
#35  
Junior Member
Thanks Meter 2
Posts: 18
Join Date: 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 View Post

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.
 
tj!2k7
Old
#36  
tj!2k7's Avatar
Senior Member
Thanks Meter 39
Posts: 217
Join Date: Jan 2007
Quote:
Originally Posted by docfreed View Post
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.
There is always another way, usually a better one.

Samsung ATIV SmartPC Pro 700T
Samsung Galaxy Note3

Motorola Droid Bionic Retired
B&N Nook Color Sold
Motorola Droid Retired
 
jonthe838
Old
#37  
jonthe838's Avatar
Senior Member
Thanks Meter 7
Posts: 117
Join Date: Nov 2010
Location: Gothenburg
Quote:
Originally Posted by tj!2k7 View Post
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..
 
docfreed
Old
#38  
docfreed's Avatar
Senior Member
Thanks Meter 140
Posts: 774
Join Date: Jun 2009
Quote:
Originally Posted by jonthe838 View Post
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.
 
tj!2k7
Old
(Last edited by tj!2k7; 16th January 2013 at 03:35 AM.)
#39  
tj!2k7's Avatar
Senior Member
Thanks Meter 39
Posts: 217
Join Date: Jan 2007
Quote:
Originally Posted by jonthe838 View Post
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 View Post
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, 360 views)
There is always another way, usually a better one.

Samsung ATIV SmartPC Pro 700T
Samsung Galaxy Note3

Motorola Droid Bionic Retired
B&N Nook Color Sold
Motorola Droid Retired
 
netham45
Old
(Last edited by netham45; 16th January 2013 at 01:29 AM.)
#40  
Recognized Developer
Thanks Meter 532
Posts: 859
Join Date: Jun 2009
Location: Denver

 
DONATE TO ME
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, 440 views)
File Type: zip autoKeyboard_Arm.zip - [Click for QR Code] (5.3 KB, 84 views)
Don't PM me for help, post on the forums. I won't respond to basic questions.

I wrote and maintain the jailbreak scripts for Windows RT.

Tablet: Microsoft Surface RT 32GB, Type Keyboard
Phone: Samsung Galaxy Note III

Helpful Windows RT Links:
Windows RT Jailbreak Tool
List of ported apps
Disabling Windows Update

The Following 4 Users Say Thank You to netham45 For This Useful Post: [ Click to Expand ]
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes