From: mr_unreliable on
lmsb wrote:
> Can anybody help me on how to make the VBScript to use the WMP
> Activex or COM automation?

hi imsb,

This is a bit of an extension of the script already given,
with a couple of extra "bells-and-whistles":

--- <code> ---
' windows media player test script, jw 02Dec09

Dim oWMP : Set oWMP = CreateObject("WMPlayer.OCX.7")

With oWMP ' saves typing
.settings.autoStart = True
.settings.volume = 50 ' 0 - 100
.settings.balance = 0 ' -100 to 100
.settings.enableErrorDialogs = False
.enableContextMenu = False
.URL = "c:\windows\desktop\AlmaMater.mp3"
WScript.Sleep(8000) ' time to load and start playing
.Controls.Pause() ' stop
WScript.Sleep(5000)
.Controls.Play() ' go again
WScript.Sleep(5000)
End With

MsgBox "if WMP is still playing, clicking OK will end it", _
vbInformation, "WMP Demo finished"

' note: With WMP running, and no set = nothing or quit
' statement, then the script will not end until the
' mp3 stops playing, and maybe not even then. If you
' want to be SURE, then look to catch some event fired
' when the music ends. I suggest the "EndOfStream"
' event, but confess that I haven't tried it...
Set oWMP = nothing
WScript.Quit
--- </code> ---

It should be noted that there are TWO WMP controls,
at least on my (win98) system.

An "old" wmp, found in msdxm.ocx with a progid of:

"MediaPlayer.MediaPlayer.1"

And a "new" wmp, found in wmp.dll, with a progid of:

"WMPlayer.OCX.7"

Apparently the "left-over" WMP control is associated with
an older version of wmp, and was not de-installed when the
newer version came out.

cheers, jw
____________________________________________________________

You got questions? WE GOT ANSWERS!!! ..(but, no guarantee
the answers will be applicable to the questions)



From: lmsb on
Thanks very much. Mr. Unreliable!

I will try the code!
--
lmsb (Tijuana, Mexico)
God grants us all at the cost of effort.


"mr_unreliable" wrote:

> lmsb wrote:
> > Can anybody help me on how to make the VBScript to use the WMP
> > Activex or COM automation?
>
> hi imsb,
>
> This is a bit of an extension of the script already given,
> with a couple of extra "bells-and-whistles":
>
> --- <code> ---
> ' windows media player test script, jw 02Dec09
>
> Dim oWMP : Set oWMP = CreateObject("WMPlayer.OCX.7")
>
> With oWMP ' saves typing
> .settings.autoStart = True
> .settings.volume = 50 ' 0 - 100
> .settings.balance = 0 ' -100 to 100
> .settings.enableErrorDialogs = False
> .enableContextMenu = False
> .URL = "c:\windows\desktop\AlmaMater.mp3"
> WScript.Sleep(8000) ' time to load and start playing
> .Controls.Pause() ' stop
> WScript.Sleep(5000)
> .Controls.Play() ' go again
> WScript.Sleep(5000)
> End With
>
> MsgBox "if WMP is still playing, clicking OK will end it", _
> vbInformation, "WMP Demo finished"
>
> ' note: With WMP running, and no set = nothing or quit
> ' statement, then the script will not end until the
> ' mp3 stops playing, and maybe not even then. If you
> ' want to be SURE, then look to catch some event fired
> ' when the music ends. I suggest the "EndOfStream"
> ' event, but confess that I haven't tried it...
> Set oWMP = nothing
> WScript.Quit
> --- </code> ---
>
> It should be noted that there are TWO WMP controls,
> at least on my (win98) system.
>
> An "old" wmp, found in msdxm.ocx with a progid of:
>
> "MediaPlayer.MediaPlayer.1"
>
> And a "new" wmp, found in wmp.dll, with a progid of:
>
> "WMPlayer.OCX.7"
>
> Apparently the "left-over" WMP control is associated with
> an older version of wmp, and was not de-installed when the
> newer version came out.
>
> cheers, jw
> ____________________________________________________________
>
> You got questions? WE GOT ANSWERS!!! ..(but, no guarantee
> the answers will be applicable to the questions)
>
>
>
> .
>
From: Reventlov on
Il giorno Fri, 04 Dec 2009 13:02:45 -0500, mr_unreliable
<kindlyReplyToNewsgroup(a)notmail.com> ha scritto:

>lmsb wrote:
>> Can anybody help me on how to make the VBScript to use the WMP
>> Activex or COM automation?

>It should be noted that there are TWO WMP controls,
>Apparently the "left-over" WMP control is associated with
>an older version of wmp, and was not de-installed when the
>newer version came out.

You are right.
wmpsdk.chm says the old control is still shipped with the new version of the ocx:

What's New
Three major changes have been made in the Windows Media Player control since the last
version.

The control has a new CLSID. It is 6BF52A52-394A-11D3-B153-00C04F79FAA6. The old control
is still shipped with this version to ensure that previous Web pages function correctly.
But if you want to take advantage of the new functionality of the control for this
version, you must change your CLSID.

The control has been split into subcontrols, including Controls, Settings, and Network.
Methods, properties, and events that are attached to the main control are documented under
the Player object. See the Control Reference for more information. Methods and properties
of the subcontrols are accessed through the player. For example, to use the bandWidth
property of the Network object, you must type:
player.Network.bandWidth

The following methods and properties are no longer supported in this version of the
Windows Media Player control:
AboutBox [....................]


--
Giovanni Cenati (Bergamo, Italy)
Write to "Reventlov" at katamail com
http://digilander.libero.it/Cenati (Esempi e programmi in VbScript)
--