ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Post New Requests Here

IDEA: launch application upon focusing a GUI element

(1/2) > >>

gjehle:
ok, this might sound a bit confusing, let me elaborate.
mouser suggested i post it in here (original: https://www.donationcoder.com/forum/index.php?topic=10517.0)

environment:

* windows XP / 2000
* touch-screen display (for windows this is just a simple mouse)
* 2 applications (A and OSK)
A: random application with GUI
OSK: on-screen-keyboard
the idea:

* monitor A's GUI
* launch/unhide OSK as soon as focus is given to an edit control (usually needs keyboard input)
* if edit control looses focus (or OSK has no more GUI-clicking going on, aka timeout) close/hide OSK
candy:

* make this work global for all running apps
* make it only work for a list of applications
* make types of controls that trigger the OSK configurable
* support for arbitrary OSK apps (windows' own, 3rd party)
alternative:
is there any OSK app out there that already does it?
i couldn't find any.

belkira:
Using AHK, I came up with a way to open the osk, but not auto close it. I am no programmer tho so maybe someone can take this code and run with it.....


--- ---#Persistent
SetTimer, WatchCursor, 100
return

WatchCursor:
MouseGetPos, , , id, control

StringLeft, control_edit, control, 4 ;The edits are usually Edit1 Edit2 etc so we only want the first 4 chars
if (control_edit = "Edit")
{
run osk.exe
}
return

belkira:
Ok, after playing around a bit I think I may have it. Give this a try and let me know how it works for you.
Again this is in AHK

--- ---#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
#Persistent
#SingleInstance, Force

SetTimer, WatchControl, 500
return

WatchControl:
ControlGetFocus, a_control, A
StringLeft, activeControl, a_control, 4
; ToolTip, %activeControl%
if (activeControl = "Edit")
ifWinExist, On-Screen Keyboard
return
else
run, osk.exe
if (activeControl <> "Edit")
IfWinExist, On-Screen Keyboard
process, close, osk.exe
else
return
return

gjehle:
nice one!
I'll test it if I get the chance next week

f0dder:
Nice idea - too bad if some application has a custom edit control...

Navigation

[0] Message Index

[#] Next page

Go to full version