Windows media player automation

Windows media player really bugs me.  I want to be able to start it up with one click and have it play my favorite concentration music play list.  But it insists on making this a 3 or 4 click activity which is really distracting when I am working as I am always switching between different WMP activities.  Videos, podcasts, music and concentration music.

No problem, now that PowerShell has arrived it’s a simple job to automate WMP.

$WMP = new-object -com WMPLAYER.OCX
$Media = $WMP.mediacollection
$Playlist = $media.getbyname($strplaylist)
$a = $Playlist.item(0)
$WMP.openplayer($a.sourceurl)

Just replace $strplaylist with the name of your playlist.  This blog post has all the details.

Now in my case I wanted to be able to type

work [F8]

or

[CTRL][CTRL] work [RETURN]

and through the magic of ActiveWords this would run the script.  But to make this work you need to configure PowerShell to execute scripts (default security is VERY tight) and the details on how to do this are here.

Steve Richards

I'm retired from work as a business and IT strategist. now I'm travelling, hiking, cycling, swimming, reading, gardening, learning, writing this blog and generally enjoying good times with friends and family

Leave a Reply

Your email address will not be published. Required fields are marked *