capturing text from a GUI window

E

Earl Eiland

Anyone know how to capture text from GUI output? I need to process
information returned via a GUI window.

Earl
 
P

Peter Hansen

Earl said:
Anyone know how to capture text from GUI output? I need to process
information returned via a GUI window.

It might help (at least in terms of justifying this as an
on-topic post) to describe in what way this is a Python
question. Is it a Python program that produces the output?
Do you want to write this capture program using Python?

Also, as always, providing some detail about the platform
in question is important if you don't want to see answers
of the form "we're not mindreaders". Operating system,
GUI framework, versions of things.

Finally, note that the process is, when possible at all,
generally highly platform-specific, awkward, and usually
relies on third-party packages (at least in Windows) that
may or may not have any Python-specific interfaces
available.

-Peter
 
E

Earl Eiland

Assuming Windows, then these guys have an interesting tool:
http://www.skesoft.com/textcatch.htm
It's not free, but you can try it before you buy it.
You will need COM to control it from Python.

This sounds like just what I need. What is COM, and where do I get it?
(I'm really a Linux guy. I don't ken the mysteries of Window very well.)

earl
 
M

Myles Strous

Earl said:
This sounds like just what I need. What is COM, and where do I get
it?

Also worth checking out:

Simon Brunning's WinGuiAuto - control/query of windows and controls,
including the function getEditText to read the text in an edit control.
See http://www.brunningonline.net/simon/blog/archives/001129.html
You'll probably also need something like Winspector to get class names
etc - see http://www.windows-spy.com/

AutoIt3 - freeware, has a DLL version that is COM-controllable (after
registration using "regsvr32 AutoItX3.dll" from a console window). I
must admit that so far I've only ever used version 2 through COM.
Includes functions such as ControlGetText and WinGetText, and throws in
a separate spy/info program as well. See
http://www.autoitscript.com/autoit3/

COM (component object model) - inter-component communication
technology. See http://www.microsoft.com/com/default.mspx

Makes it easy for programs with COM client functonality to use/control
functions exposed in a COM server program (well, that's the Dispatch
part of it that's applicable to your situation, it's apparently a fair
bit more than that).

Mark Hammond's Python for Windows extensions (thank you Mark Hammond!),
also known as Win32All or PyWin32, adds COM client funcionality to
Python.
(Note: Python+PyWin32 also does COM server stuff, but you don't need to
know about that.)

Use the COM Makepy utility (under the Tools menu) in PythonWin (the IDE
that comes with the Python for Windows extensions) to get a nice
interface module for your chosen COM server component, then just call
the functions in the interface module (or whatever the correct
technical name is for the generated .py file).

Worth reading:
http://www.python.org/windows/win32com/QuickStartClientCom.html

Example Python uses of COM server components:
http://www.boddie.org.uk/python/COM.html
http://www.pyzine.com/Issue007/Section_Articles/article_PythonCOM.html
http://schram.net/articles/python/eudora.html
http://www.daniweb.com/code/snippet208.html
http://tinyurl.com/42rxa

(Using a COM component is very similar in a variety of programming
languages)

In case you don't already have the Python for Windows extensions, or
the ActiveState Python distribution which includes them: see
http://sourceforge.net/projects/pywin32/

Regards, Myles.
 
J

Josef Meile

Hi Earl,
This sounds like just what I need. What is COM, and where do I get it?
(I'm really a Linux guy. I don't ken the mysteries of Window very well.)
You may also try WATSUP - Windows Application Test System Using Python:
http://www.tizmoi.net/watsup/intro.html

Now the website seems to be down, but perhaps there is a mirror
somewhere.

Regards,
Josef
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,222
Messages
2,571,140
Members
47,755
Latest member
Grazynkaa

Latest Threads

Top