2

The problem I have is that I have this Python script to launch a application. After the application is launched (the GUI is shown on screen), I want to make it de-activated. It can be done manually by activating another window, or minimizing this app, or pressing the Show Desktop key for WindowsXP.

So is there any way that I can do this by Python? Core or 3rd party library would be all ok.

Thanks!

Ben Blank
  • 54,908
  • 28
  • 127
  • 156
Yinan
  • 2,516
  • 4
  • 22
  • 23
  • Between your three techniques for de-activating, I'd recommend minimization, as it will have the fewest side-effects. The keyboard command for minimization is Alt-Space (to open the system menu), then N (to select Minimize). – Ben Blank Nov 20 '09 at 01:00

3 Answers3

4

Take a look at SendKeys. It is in the pypi, so you can install it via easy_install.

Isaiah
  • 4,201
  • 4
  • 27
  • 40
  • SendKeys is a very thin wrapper around the W32 SendKeys interface so there is plenty of documentation out there - http://msdn.microsoft.com/en-us/library/system.windows.forms.sendkeys.aspx is a good page if you want to send any special keycodes – Ravi Nov 20 '09 at 01:06
0

You can use pywin32 to send a minimize event.

0

I've used AutoIt (via it's COM interface) a lot of times

Miki Tebeka
  • 13,428
  • 4
  • 37
  • 49