Jump to content

Recommended Posts

Posted

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
        EndIf
        $CurrentSong = $oWMP.currentMedia.name
        If $CurrentSong <> "" Then
            Return $CurrentSong
        Else
            Return "?"
        EndIf
EndFunc
    
Msgbox(0,WMP(),"")

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 ?

Posted (edited)

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

Syntax:

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
Posted (edited)

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

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
×
×
  • Create New...