Jump to content
Sign in to follow this  

Media Player - Current status

Recommended Posts

I'm trying to get the current status of Media Player. I want to be able to have a playlist going in Media Player, and then whenever I run the script it will give me the currently playing song. Basically I want it to be just like the iTunes current status script (http://www.autoitscript.com/forum/index.php?showtopic=21334&hl=album%20art&st=0), but for Media Player.

I've seen the post on getting MP3 & WMA info from a song (http://www.autoitscript.com/forum/index.php?showtopic=39256&st=0&p=400171&#entry400171), but that method only seems to work if you open the song with your script, not if the song is already going. I've also been looking at: http://www.autoitscript.com/forum/index.php?showtopic=52415. And the MSDN site for the Media Player object: http://msdn2.microsoft.com/en-us/library/bb249349.aspx.

I think I have all the elements I need, I just can't seem to put it all together... Any help is greatly appreciated. Thanks.

Edited by ryantollefson

Share this post

Link to post
Share on other sites


The command you want looks like this


and you can get the playlist name like this


GUICreate ("Embedded Medieplayer control Test", 620, 425, -1, -1,BitOr($WS_OVERLAPPEDWINDOW,$WS_VISIBLE,$WS_CLIPSIBLINGS))
$TagsPageC = GuiCtrlCreateLabel('Visit Tags Page', 5, 405, 100, 15, $SS_CENTER)

Global $GUIActiveX  = GUICtrlCreateObj( $oRP, 10, 10 , 600 , 385 )
Global $oRPEvt = ObjEvent($oRP,"MediaPlayer_")

With $oRP;
   .URL = 'C:\temp\test.wpl'
   Consolewrite(.currentMedia.sourceURL & @CRLF)
$oRP = 0

You can use this example to put code into life


kjactive :)

Edited by kjactive

Share this post

Link to post
Share on other sites

Thanks so far... I think I understand the code you posted, and this should be the object right?

Global $oRP = ObjCreate("WMPlayer.OCX")

But this still won't get the info for a song that is already playing in Media Player (before running the script). This sets the .url in the script & starts that song, and then retrieves the .url from the current song; but I can't figure out how to get this to work if you don't define the .url in your script prior to calling


Share this post

Link to post
Share on other sites

I haven't worked specified with playlists but durring years with WMPlayer.OCX component from wmp.dll a lot but to get the current playing title this is the command...

.getItemInfoByType("Title", "",0)

Syntax: .currentMedia.getItemInfoByType(name, language, index) // ("author", "", 0) ec.

if you don't define the .url in your script prior to calling

I don't get this - you can't get information on a playlist that isn't loaded yet but maybe I don't get your questen right and it's the mediecollect object your looking for: http://msdn2.microsoft.com/en-US/library/bb262724.aspx


The medieplayer component nature is that it's a large collection of objects all activated as one - some components has to be initiated one by one but not this one - there is a lot of options and ways to use this large components. To major general different ways to code objects is: to let events tricker your code or to make component pools that again can be done different - one has to code very personal as there are that many options, personal I offen use pools ( collection of commands ) as these can be a bit more easy to control I think anyway...

Available WMPlayer.OCX Component objects:

Cdrom Object

CdromCollection Object

ClosedCaption Object

Controls Object

DVD Object

Error Object

ErrorItem Object

Media Object

MediaCollection Object

MetadataPicture Object

MetadataText Object

Network Object

Player Object

PlayerApplication Object

Playlist Object

PlaylistArray Object

PlaylistCollection Object

Query Object

Settings Object

StringCollection Object

More information on the objects: http://msdn2.microsoft.com/en-us/library/bb249259.aspx

Hope this helps you to fiddle your playlists....

kjactive :)

Edited by kjactive

Share this post

Link to post
Share on other sites

Thanks for the help so far :) .

I haven't finished looking through everything you posted about yet, but I wanted to reply so it was clear what I'm trying to accomplish.

What I want:

  • Don't start script yet
  • Open Windows Media Player
  • Start playing a song or playlist
  • Now run my AutoIt script
  • Have the script detect what song is currently playing in Windows Media Player
In other words, I want to be able to manually start a song playing (script won't open the song), then when I choose to run the script it will just detect the already playing song from Windows Media Player.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...