Scripting Windows GUI application with Python (SendKeys)

Paulo Soares psoares at consiste.pt
Mon May 17 12:40:00 EDT 1999


The WIN32 API function to send keys to an application that has the focus
is keybd_event in win9X/NT and SendInput in win98/NT.
You can also have a look at John Robbins' Feb '99 Microsoft Systems
Journal Bugslayer Column where he describes a way to parse the keys as
Visual Basic does.
I have altered this code to provide very simple scripting to a tape
backup procedure.
I can send it if you want it. Is is written in Visual C++ 6.0 but it is
trivial to extract the needed parts and make a python extension.

Best Regards,
Paulo Soares

> -----Original Message-----
> From:	Christian Lemer [SMTP:Christian.Lemer at usrconsult.be]
> Sent:	Monday, May 17, 1999 15:12
> To:	python-list at cwi.nl
> Subject:	Scripting Windows GUI application with Python (SendKeys)
> 
> Dear all,
> 
> Currently we use WinBatch to automate some tests and productions
> application under Windows NT.
> 
> One year ago, we switched from Perl to Pyton as script language under
> unix.
> 
> I wonder if it is possible to drive a Windows GUI application (using
> keybord commands) like it is possible in Winbatch with Python under
> Windows?
> 
> I installed also the windows extensions but couldn't find the correct
> way to send a key to an application.
> 
> Thanks in advance for your help.
> 
> Chris.
> 
> -- 
> Christian LEMER                                    tel +32.10.65.44.11
> UsrConsult S.P.R.L                                 fax +32.10.65.44.10
> rue Margot, 37
> http://www.usrconsult.be
> B-1457 Nil St Vincent             mailto:Christian.Lemer at usrconsult.be




More information about the Python-list mailing list