Since you're on Win32...

One other option is to get ahold of (dare I say it) a commercial Telnet
program (Hummingbird and others have pretty good ones) that provides either
a COM automation interface or an ActiveX control.  Or if they have a C/C++
API you could attempt to expose it through a Python extension.

Then you can use Python to drive the Telnet GUI to do the heavy lifting.
The advantage of this approach over sending keystrokes via Win messages
is that the API or COM interface usually allows you to get at the incoming
data... and usually as ASCII.

Have done this successfully with Hummingbird's TN3270 emulator in the past
for screen scraping programs like the one you describe.  Gotta believe it's
similar with a "normal" Telnet client.  So thought I'd throw it out there as
one other option to consider.

Troy

-----Original Message-----
From: Russell Blank [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 15, 2001 10:54 AM
To: 'Noah'
Cc: [EMAIL PROTECTED]; "Steve"@smtp1.ActiveState.com
Subject: RE: Controlling win32 application


No, I am not crazy (at least I think).  The reason why I want to automate
this process is for rapid development of screen scraping.  I have used
telnetlib, but interpreting escape codes and trying to discover where you
are on the screen is an arduous task.  I want to do the following:

1.  Create a python script to obtain and save information to a CUI program.
2.  Aid in development by having that process (via a switch) launch a telnet
window with the appropriate emulation already built in.
2.  Be able to view my python script as it runs to aid in the development
process (and not just see the raw data dump)

If the answer is pipes, I have not had much experience using them.  Is there
examples that you might be able to direct me too?

Thanks for your help...

-----Original Message-----
From: Noah [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 14, 2001 6:28 PM
To: [EMAIL PROTECTED]
Subject: RE: Controlling win32 application



I have done some Win32 automation.
I'm guessing there is a good reason for these gymnastics
that make it impossible to simply use the Python telnet library. Yes?

To clarify: Do you want a Python script to start a win32 telnet window
then have the Python script send key strokes to the telnet window
and capture the results (python script starts the telnet process)?
Or do you want a separate Python script to send key commands to
any given existing telnet window (Python script and telnet are
independent processes)? The first is easy (pipes). The second is harder.
You can send key messages to a window, but I'm not sure if you can easily
get data back. Your requirements don't say that you need to get the data
back.
If not, then it should be relatively easy, if a little ugly, to send Win
key messages. If you do need to process the results then I could imagine
some hacks with a copy and paste using the clip-board or maybe DDE
-- that is, Screen Scraping. Do you want to go that route?

Let me know if you can provide more information... or if someone
else provides an elegant solution to the problem.

Yours,
Noah

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Russell
Blank
Sent: Wednesday, November 14, 2001 5:09 PM
To: [EMAIL PROTECTED]
Subject: Controlling win32 application


Question:  Has anyone controlled a win32 program with python?

I want to launch a telnet window, have it open, and run a python script and
see those commands sent through the telnet window.  Has anyone had
experience?

Russell A. Blank
Senior Consultant
Atlas Development Corporation
6351 Owensmouth Avenue, #101
Woodland Hills, CA 91367
(818) 340-7080 Phone
(818) 340-7079 Fax



_______________________________________________
ActivePython mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/activepython
_______________________________________________
ActivePython mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/activepython

Reply via email to