Jump to content
Sign in to follow this  

WMP currentmedia name ?

Recommended Posts

Ok, I'm experimenting with windows media player and I taught to make a simple return with the current song name in it. So after looking in the msdn of microsoft (http://msdn2.microsoft.com/en-us/library/bb249311.aspx) I tried :

Func WMP()
    Global $oWMP = ObjCreate("WMPlayer.OCX")
        if @error then 
            $Status = "Couldn't detect Windows Media Player"
            Return $Status
        $CurrentSong = $oWMP.currentMedia.name
        If $CurrentSong <> "" Then
            Return $CurrentSong
            Return "?"

But now I get the error :

C:\Documents and Settings\tttommeke\Bureaublad\test.au3 (7) : ==> Variable must be of type "Object".: 
$CurrentSong = $oWMP.currentMedia.name
$CurrentSong = $oWMP.currentMedia^ ERROR

Anyone got an idea why it isn't working ?

Share this post

Link to post
Share on other sites

Hallo ttt

with some of the commands you just have to check the player current state with object.playState [= value] to avoid errors...

Constant Value

wmppsUndefined 0

wmppsStopped 1

wmppsPaused 2

wmppsPlaying 3

wmppsScanForward 4

wmppsScanReverse 5

wmppsBuffering 6

wmppsWaiting 7

wmppsMediaEnded 8

wmppsTransitioning 9

wmppsReady 10

wmppsReconnecting 11

wmppsLast 12

There is an event that could be used to get the current ready state, actually I would let the events control most tasks with this component...


Sub object_StatusChange

The StatusChange event syntax has these named arguments: none

What a massive component with about 60 subcomponents - well Hope this do some help

kjactive :)

Edited by kjactive

Share this post

Link to post
Share on other sites

you've decleared your WMP object, but havn't assigned the song (or the windows Media Collection) to the WMP obect.

this page is helpfull: http://www.microsoft.com/technet/scriptcen...one/player.mspx

Edited by cyanidemonkey

My AutoIt Scripts.- AutoHost and Password Enabler for Delta Force 2 Demo.| Caffine for Winamp 2.9x and WRS 2.0 | mp3 directory cleaner | CRAP DJ | A:B:J Radio Automation Software | FFMPEG batch conversion automator

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...