Shoutbox

Text extraction from a Window? - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: Text extraction from a Window? (/showthread.php?tid=87574)

Text extraction from a Window? by Zero on 12-03-2008 at 05:43 PM

Hi folks,

I'm writing a shell jscript for WSH and want to know if it's possible to extract the text in child controls from other Windows applications that are running. Some examples would be obtaining the text from a button in a dialog box, reading the text values from the nodes in a treeview or combobox, etc.

Enumerating existing processes is the first step, which i've done, now i want to dig down into those processes...

Ideas?

  -Zero


RE: Text extraction from a Window? by matty on 12-03-2008 at 06:23 PM

Not with WSH, however using the FindWindow and FindWindowEX API functions you can find child windows and read the text using GetWindowText etc.


RE: Text extraction from a Window? by Zero on 12-03-2008 at 07:43 PM

Can you give me a little more info on that API? I've never heard of it before and I'm not sure where to even begin reading about it.


RE: Text extraction from a Window? by Matti on 12-04-2008 at 12:52 PM

It's all on MSDN!

You need to use Interop.Call and Interop.Allocate to work with these Win32 API functions, which might be scary at first sight. Have a look at some more complex scripts and see how those use the Win32 API.
RE: Text extraction from a Window? by ShawnZ on 12-04-2008 at 01:11 PM

what are you doing it for? there's probably a better way :p


RE: Text extraction from a Window? by Zero on 12-04-2008 at 05:02 PM

thnx for the good advice Matti - could you point me at some example scripts that use Interop?


RE: Text extraction from a Window? by Zero on 12-04-2008 at 05:12 PM

Is Interop part of the MPL infrastructure or is it something that can be used in JScript's in general?


RE: Text extraction from a Window? by matty on 12-04-2008 at 05:46 PM

quote:
Originally posted by Zero
Is Interop part of the MPL infrastructure or is it something that can be used in JScript's in general?
The Win32 API can be used in a lot of programming languages however JScript and VBScript do not have access to it. Interop calling in Plus! Scripting is provided by Messenger Plus! Scripting Engine without it you couldn't do it unless you created an ActiveX Object.

Cheers.
RE: Text extraction from a Window? by Zero on 12-04-2008 at 08:46 PM

That's awesome info, Matty! Thanks for your excellent input.