# WMP WIN32OLE in Ruby/IRB problem

**URL:** <https://www.ruby-forum.com/t/wmp-win32ole-in-ruby-irb-problem/71352>\
**Category:** Ruby\
**Created:** [October 7, 2006, 3:56pm UTC](https://www.ruby-forum.com/t/wmp-win32ole-in-ruby-irb-problem/71352 "2006-10-07T15:56:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mike](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike](https://www.ruby-forum.com/u/mike)\
**Post date:** [October 7, 2006, 3:56pm UTC](https://www.ruby-forum.com/t/wmp-win32ole-in-ruby-irb-problem/71352/1 "2006-10-07T15:56:13Z")

</div>

The following code plays the playlist thourgh IRB in FXRI, but playback  
doesn’t start when using IRB from the command line.

oPlayer = WIN32OLE.new(“WMPlayer.ocx.7”)  
oPlayer.Settings.autoStart = 1  
oPlayListCollection = oPlayer.PlayListCollection.GetAll()  
oPlayer.currentPlaylist = oPlayListCollection.item(0) #plays in FXRI,  
nothing happens in IRB

also

oPlayer.Controls.play # doesn’t work in IRB either.

I’m a newbie, so maybe I’m missing something obvious? any thoughts  
appreciated.

---

<div class="post-metadata">

**Author:** ![mike](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike](https://www.ruby-forum.com/u/mike)\
**Post date:** [October 10, 2006, 9:48pm UTC](https://www.ruby-forum.com/t/wmp-win32ole-in-ruby-irb-problem/71352/2 "2006-10-10T21:48:43Z")

</div>

Mike wrote:

> The following code plays the playlist thourgh IRB in FXRI, but playback  
> doesn’t start when using IRB from the command line.
> 
> oPlayer = WIN32OLE.new(“WMPlayer.ocx.7”)  
> oPlayer.Settings.autoStart = 1  
> oPlayListCollection = oPlayer.PlayListCollection.GetAll()  
> oPlayer.currentPlaylist = oPlayListCollection.item(0) #plays in FXRI,  
> nothing happens in IRB
> 
> also
> 
> oPlayer.Controls.play # doesn’t work in IRB either.
> 
> I’m a newbie, so maybe I’m missing something obvious? any thoughts  
> appreciated.

I’m seeing the same problem here. I thought it was something funky that  
IRB is doing, or _not_ doing. Then I cobbled-up a script and ran it…  
still doesn’t play. The only way I could get anything to play was by  
using the .openPlayer() method.

oPlayer.openPlayer(\<my .mp3 file\>)

I added the following line after the one that assigns the  
.currentPlayList property…

puts(“Playing track “#{oPlayer.currentMedia.name}” from the  
“#{oPlayer.currentPlayList.name}” playlist”)

which spits out something like:  
Playing track “Mix 04-05” from the “All Music” playlist
