Possibly OT: Controlling winamp with Python

Dave Brueck dave at pythonapocrypha.com
Fri Feb 4 15:57:46 EST 2005


Brent W. Hughes wrote:
> I'm running Windows XP and I'm using winamp to listen to internet radio 
> stations.  Occasionally, an annoying commercial will come on.  I would like 
> to write a Python program that, when run, will, in essence, push on winamp's 
> mute button.  Then, after say 20 seconds, it will push the mute button again 
> to restore the sound.  Is such a thing possible?

Yes - IIRC WinAmp supports some "global" Windows messages that any app can send 
to make WinAmp do different things. Don't know if there's a "mute" command, but 
at the very leasy you could control the volume. You'd have to read their SDK and 
then use something like ctypes to fire the Windows message - very doable.

If that doesn't do what you want, then you could go the more hacky route and 
grab the WinAmp window and fire a button click in the precise location. 
Something like AutoIt (which is controllable via Python) could work as well.

Another route would be to just mute all audio in the system for 20 seconds - 
that might be the easiest approach of all. Again, ctypes is your friend - figure 
out what APIs you'd need to call and people here can help you come up with the 
Python code to call those APIs.

-Dave



More information about the Python-list mailing list