Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'mrab': 0.05; '-*-': 0.07; 'utf-8': 0.07; 'coding:': 0.09; 'juni': 0.09; 'tune': 0.09; 'windows': 0.15; 'guys,': 0.16; 'guys?': 0.16; 'skip:[ 50': 0.16; 'subject:media': 0.16; 'subject:windows': 0.16; 'win7': 0.16; 'wrote:': 0.18; 'looked': 0.18; 'message-----': 0.19; 'seems': 0.21; 'import': 0.22; 'to:name:python-list@python.org': 0.22; 'driver': 0.24; 'header:Received:8': 0.24; 'looks': 0.24; "i've": 0.25; 'player': 0.26; 'header:In-Reply-To:1': 0.27; 'to:2**1': 0.27; 'received:bigfish.com': 0.30; 'skip:( 20': 0.30; 'url:mailman': 0.30; 'work.': 0.31; 'code': 0.31; 'fighting': 0.31; 'option.': 0.31; 'python2.7': 0.31; 'work:': 0.31; 'skip:m 30': 0.32; 'url:python': 0.33; 'device': 0.34; 'skip:d 20': 0.34; 'but': 0.35; 'controls': 0.36; 'url:listinfo': 0.36; 'doing': 0.36; 'charset:us-ascii': 0.36; 'thanks': 0.36; 'url:org': 0.36; 'wrong': 0.37; 'email addr:python.org': 0.37; 'received:10': 0.37; 'manager': 0.38; 'audio': 0.38; 'to:addr:python-list': 0.38; 'files': 0.38; 'skip:- 10': 0.38; 'track': 0.38; 'subject:': 0.39; 'success.': 0.39; 'to:addr:python.org': 0.39; 'url:mail': 0.40; 're:': 0.63; 'day.': 0.63; 'email name:python-list': 0.65; 'media': 0.66; 'sound': 0.68; 'subject:player': 0.84 X-Forefront-Antispam-Report: CIP:185.34.132.53; KIP:(null); UIP:(null); IPV:NLI; H:mail.demant.com; RD:mail1.demant.com; EFVD:NLI X-SpamScore: 14 X-BigFish: VPS14(zz98dI936eI542I1432Izz1f42h2148h1ee6h1de0h1fdah2073h2146h1202h1e76h2189h1d1ah1d2ah21bch1fc6h208ch1f8fizz1de098h8275dh1de097h186068hz30ih109h2a8h839h944hd25hf0ah1220h1288h12a5h12a9h12bdh137ah13b6h1441h14ddh1504h1537h153bh15d0h162dh1631h1758h18e1h1946h19b5h1b0ah224fh1cb5h1d0ch1d2eh1d3fh1dfeh1dffh1e1dh1fe8h1ff5h2152h2216h22d0h2336h2438h2461h2487h24d7h2516h2545h255eh25f6h2605h262fh268bh26d3h27e2h28a1h1307i) Received-SPF: fail (mail6-co9: domain of sennheisercommunications.com does not designate 185.34.132.53 as permitted sender) client-ip=185.34.132.53; envelope-from=DMusiige@sennheisercommunications.com; helo=mail.demant.com ; l.demant.com ; From: Deogratius Musiige To: MRAB , "python-list@python.org" Subject: RE: Automating windows media player on win7 Thread-Topic: Automating windows media player on win7 Thread-Index: Ac9/Ao92/LcZpfCnSxeQrPxiZS+XUABFxWqAAFxltGA= Date: Fri, 6 Jun 2014 13:39:09 +0000 References: <538F7219.2020705@mrabarnett.plus.com> In-Reply-To: <538F7219.2020705@mrabarnett.plus.com> Accept-Language: da-DK, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.100.3.117] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: sennheisercommunications.com X-FOPE-CONNECTOR: Id%0$Dn%*$RO%0$TLS%0$FQDN%$TlsDn% X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 63 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1402061975 news.xs4all.nl 2978 [2001:888:2000:d::a6]:45966 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:72844 Thanks a lot mate.=20 You just made my day.=20 I have looked around the net but cannot find the controls available.=20 I would like to be able to: - get current playing track - get wmplayer state (playing/paused/stopped) - get the selected sound device Thanks a lot Br Deo -----Original Message----- From: Python-list [mailto:python-list-bounces+demu=3Dsenncom.com@python.org= ] On Behalf Of MRAB Sent: 4. juni 2014 21:23 To: python-list@python.org Subject: Re: Automating windows media player on win7 On 2014-06-03 09:10, Deogratius Musiige wrote: > Hi guys, > > I have been fighting with automating wmplayer but with no success. > > It looks to me that using the .OCX would be the best option. I found=20 > the code below on the net but I cannot get it to work. > > I can see from device manager that a driver is started by I get no=20 > audio out. > > What am I doing wrong guys? > > # this program will play MP3, WMA, MID, WAV files via the=20 > WindowsMediaPlayer from win32com.client import Dispatch > > mp =3D Dispatch("WMPlayer.OCX") > tune =3D mp.newMedia("./plays.wav") > mp.currentPlaylist.appendItem(tune) > mp.controls.play() > raw_input("Press Enter to stop playing") > mp.controls.stop() > I've found that adding PlayItem and sleep seems to work: #! python2.7 # -*- coding: utf-8 -*- from win32com.client import Dispatch from time import sleep mp =3D Dispatch("WMPlayer.OCX") tune =3D mp.NewMedia(r"./plays.wav") mp.CurrentPlaylist.AppendItem(tune) mp.Controls.Play() sleep(1) mp.Controls.PlayItem(tune) raw_input("Press Enter to stop playing") mp.Controls.Stop() -- https://mail.python.org/mailman/listinfo/python-list