Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Automating Windows Media Player.

Reply
 
Old 10-13-2006   #1 (permalink)
Mugunth


 
 

Automating Windows Media Player.

Hi,
When
$ie = New-Object -ComObject InternetExplorer.Application
Command creates a new InternetExplorer application, (Visible thru task
manager)
Why is
$wmp = new-object -ComObject MediaPlayer.MediaPlayer.1
not creating a new Windows Media Player application?

Am I missing out something?

Regards,
Mugunth


My System SpecsSystem Spec
Old 10-13-2006   #2 (permalink)
Alex K. Angelopoulos [MVP]


 
 

Re: Automating Windows Media Player.

MediaPlayer.MediaPlayer.1 is not self-hosting; it's from an OCX instead of
an EXE, and to get a visible window it needs to be created within a GUI
container.

If you're after a visible, controllable media player, you may need to do
some work to create a container in HTML to make it visible and possible to
manipulate. Personally, I think this is an awful way to have to do it for
scripting.

If you just want to play audio files and don't care about visibility, you
can use the following function that I developed based on suggestions from
Jim Truher in the gadget-piano thread:

#Start-Media.ps1
Param([string]$FilePath = $null)
$player = New-Object -ComObject wmplayer.ocx;
if($FilePath)
{
$media = $player.newmedia($FilePath)
[void]$player.currentplaylist.appenditem($media);
$player.controls.play();
}
return $player;



"Mugunth" <mugunth.kumar@gmail.com> wrote in message
news:1160739236.728620.175620@i42g2000cwa.googlegroups.com...
> Hi,
> When
> $ie = New-Object -ComObject InternetExplorer.Application
> Command creates a new InternetExplorer application, (Visible thru task
> manager)
> Why is
> $wmp = new-object -ComObject MediaPlayer.MediaPlayer.1
> not creating a new Windows Media Player application?
>
> Am I missing out something?
>
> Regards,
> Mugunth
>



My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Windows Media Player 11 in Vista the default player Vista music pictures video
Windows media player stops working when I plug in my MP3 Player Vista General
Windows Media player does not show wma files on my mp3 player Vista music pictures video
Windows Media Player Playlist - load to player without using Sync? Vista music pictures video
KMplayer, the media player that puts Windows Media Player to SHAME! Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46