|Automating Windows Media Player|
I found this Windows Media Player example on a website:
You can automate Microsoft Media Player with win32com without
starting the GUI.This example opens and plays some media files:
# this program will play MP3, WMA, MID, WAV files via the WindowsMediaPlayer from win32com.client import Dispatch mp = Dispatch("WMPlayer.OCX") # use an mp3 file you have ... #tune = mp.newMedia("C:/Program Files/Common Files/HP/Memories Disc/2.0/audio/Swing.mp3") # or copy one to the working folder ... #tune = mp.newMedia("Bier1.mp3") # you can also play wma files, this cool sound came with XP ... tune = mp.newMedia("C:/WINDOWS/system32/oobe/images/title.wma") mp.currentPlaylist.appendItem(tune) mp.controls.play() # to stop playing use raw_input("Press Enter to stop playing") mp.controls.stop()
|Last Updated ( Thursday, 02 February 2006 )|
Hint: For syntax highlighting and correct Python intendation place your code between html tags <pre> and </pre>.