tttommeke Posted December 14, 2007 Share Posted December 14, 2007 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 ? Link to comment Share on other sites More sharing options...
kjactive Posted December 15, 2007 Share Posted December 15, 2007 (edited) Hallo tttwith 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_StatusChangeThe StatusChange event syntax has these named arguments: noneWhat a massive component with about 60 subcomponents - well Hope this do some helpkjactive Edited December 15, 2007 by kjactive Au3PP 4.1 - Autoit3 preprocessor, optimize speed, performance to scripts and do executes....[/url]Au3Calibur - Create libraries of commonly used code excerptsWords manipulate UDF, functions that is lent from the rexx language, topics and index file includedCustomDialog UDF to include custom made dialogs like a extended colorpick requester to scripts...[url="ftp://fritidshjemmet.com/Autoit3/SysColor.zip"]SysColor UDF a low level color library to manipulate RGB and Hex values...Shell32 UDF to Automate Windows® operating tasks from native dialog and Wizards browsers... Optimized the CodeWicard with options to generate browser code etc... Link to comment Share on other sites More sharing options...
cyanidemonkey Posted December 17, 2007 Share Posted December 17, 2007 (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 December 17, 2007 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 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now