From: lmsb on
Hi all,
I'm able to control WMP through the shell but I think is not the cleanest
solution.
Can anybody help me on how to make the VBScript to use the WMP
Activex or COM automation?
I've found some reference about Player object and WMPLib but so far I've
been getting compile or run time errors.
the actions I want to do are:
1. Open the file I want to play
2. Start play
3. wait 10 seconds.
4. Pause/Stop play
5. wait 10 seconds.
6. return to step no. 2.

I would appreciate your help very much. Regards.
--
God grants us all at the cost of effort.
From: Reventlov on
Il giorno Wed, 2 Dec 2009 16:29:06 -0800, =?Utf-8?B?bG1zYg==?=
<lmsb(a)discussions.microsoft.com> ha scritto:

>Hi all,
>I'm able to control WMP through the shell but I think is not the cleanest
>solution.
>Can anybody help me on how to make the VBScript to use the WMP
>Activex or COM automation?
>I've found some reference about Player object and WMPLib but so far I've
>been getting compile or run time errors.
>the actions I want to do are:
>1. Open the file I want to play
>2. Start play
>3. wait 10 seconds.
>4. Pause/Stop play
>5. wait 10 seconds.
>6. return to step no. 2.

Start with this

Set Player = createobject("Wmplayer.OCX.7")
Player.url = "C:\BOB.MP3"
wscript.sleep 10000
msgbox "end"

--
Giovanni Cenati (Bergamo, Italy)
Write to "Reventlov" at katamail com
http://digilander.libero.it/Cenati (Esempi e programmi in VbScript)
--
From: lmsb on
To Reventlov,
Thanks very much!
It works great! Now I have the control! Thanks!!!

One question if I may... the key line is:
>Set Player = createobject("Wmplayer.OCX.7")
what is the number 7 for?
--
God grants us all at the cost of effort.


"Reventlov" wrote:

> Il giorno Wed, 2 Dec 2009 16:29:06 -0800, =?Utf-8?B?bG1zYg==?=
> <lmsb(a)discussions.microsoft.com> ha scritto:
>
> >Hi all,
> >I'm able to control WMP through the shell but I think is not the cleanest
> >solution.
> >Can anybody help me on how to make the VBScript to use the WMP
> >Activex or COM automation?
> >I've found some reference about Player object and WMPLib but so far I've
> >been getting compile or run time errors.
> >the actions I want to do are:
> >1. Open the file I want to play
> >2. Start play
> >3. wait 10 seconds.
> >4. Pause/Stop play
> >5. wait 10 seconds.
> >6. return to step no. 2.
>
> Start with this
>
> Set Player = createobject("Wmplayer.OCX.7")
> Player.url = "C:\BOB.MP3"
> wscript.sleep 10000
> msgbox "end"
>
> --
> Giovanni Cenati (Bergamo, Italy)
> Write to "Reventlov" at katamail com
> http://digilander.libero.it/Cenati (Esempi e programmi in VbScript)
> --
> .
>
From: Reventlov on
Il giorno Fri, 4 Dec 2009 09:52:01 -0800, =?Utf-8?B?bG1zYg==?=
<lmsb(a)discussions.microsoft.com> ha scritto:

>To Reventlov,
> Thanks very much!
>It works great! Now I have the control! Thanks!!!
>
>One question if I may... the key line is:
>>Set Player = createobject("Wmplayer.OCX.7")
>what is the number 7 for?

I found the name "wmplayer.ocx.7" in the registry. From a certain version of MediaPlayer
Microsoft provided this new version of the activeX component.

I found some information on how to use this com object in a file called wmpsdk.chm in a cd
shipped together with a book about MediaPlayer.
I borrowed the book from the public library. It did not tell much about programming. Only
about deploying, skins and custom installation of MediaPlayer.
But in the cd there was some other stuff.
Maybe you can find this file in ms site.
Dated 24 june 2000, it's a 1,02 Mb file.

Giovanni.

--
Giovanni Cenati (Bergamo, Italy)
Write to "Reventlov" at katamail com
http://digilander.libero.it/Cenati (Esempi e programmi in VbScript)
--
From: mr_unreliable on
lmsb wrote:
> One question if I may... the key line is:
>> Set Player = createobject("Wmplayer.OCX.7")
> what is the number 7 for?

hi lmsb,

The number "7" in the progid is just a version number.

Most likely, you will find the "generic" progid in
your registry, which is "WMPlayer.OCX". You could
use that in your script. Part of the "generic" entry
is the "CurVer" (current version) key, which on my
system is "WMPlayer.OCX.7", i.e., version 7. And so,
if you use the generic progid or the version-specific
progid, you get the same actx object (at least on my
system.

However, if ms comes out with a newer version, and
especially if the new version has different methods
and properties, then the version number WILL make
a difference.

cheers, jw
____________________________________________________________

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