Play PLS stream files in Windows Media Player (no need to install Winamp)

Winamp is a really very nice clean software. No Arguments there. But, I don’t want to install it on my business laptop. I want to here all shoutcast streams and other radio stations in my Windows Media Player. So I made a little script myself (and I blogged it HERE).

Follow the steps to play PLS file in Windows Media Player:

1. Copy and Paste the following script into Notepad and save it as "PlayPLS.VBS". NOTE: While saving the script from Notepad, You NEED to type the vbscriptname.vbs in QUTOES. e.g., "PlayPLS.vbs". Otherwise it will save as PlayPLS.vbs.txt

‘*****************************************************************************
‘*****************************************************************************
‘*********                       PlayPLS.vbs                        **********
‘********* Parameters: PLS file name                                **********
‘*********                                                          **********
‘********* This script plays .PLS files in Windows Media Player     **********
‘*********                                                          **********
‘********* Usage: PlayPLS.vbs Sample.PLS                            **********
‘*********                                                          **********
‘********* Written By: Anand Venkatachalapathy                      **********
‘*****************************************************************************
‘*****************************************************************************

Set WshShell = WScript.CreateObject("WScript.Shell")
Set oArg = WScript.Arguments
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")

If oArg.Count = 0 Then
    WshShell.Popup "Invalid Arguments…Please provide the PLS file name.", _
7, "Play PLS in WMP",0
    WScript.Quit
End If

sPLSFileName = oArg(0)
Set f = fso.OpenTextFile(sPLSFileName, ForReading)

Do While NOT f.AtEndOfStream
    sText =  f.ReadLine
    If InStr(UCase(sText),"FILE") > 0 Then
        sURLText =  Split(sText,"=")
        sURL = """" & sURLText(1) & """"
        sCmd = "WMPlayer " & sURL
        WshShell.Run sCmd
        Exit Do
    End If
Loop

f.close
Set fso = Nothing
Set oArg = Nothing
Set WshShell = Nothing

2. Copy and Paste the following text into Notepad and save it as PlayPLS.cmd. NOTE: Use the "double quotes" when saving the name in Notepad.

C:\PathOfTheFolder\PlayPLS.vbs %1

3. Open your favorite radio station (mine is http://www.shoutcast.com), right click on PLS file link (or PLAY button) and save it on your desktop.

4. Open the file properties of PLS file (by right clicking on the PLS on the desktop and select properties), Click "Change" button next to the "Opens With:" text. Select the PlayPLS.cmd file by browsing to the corresponding folder and select the cmd file.

5. You are done. Go to your favorite radio web site again and click on "Play" Link. See it open in Windows Media Player.

Advertisements

12 responses to “Play PLS stream files in Windows Media Player (no need to install Winamp)

  1. Wow! thanks so much – I’m trying not to bog down my Vista with software – I too favor shoutcast – copied your scripts tonight and they worked great!!

  2. Good Morning… I copied your script into notepad and tried the following with the double quotes -"PlayPls.cmd" "PlayPls.bat", "PlayPls.vbs" and saved (deleted)to the desktop each time and none worked… I am so new to this and I am running Vista Home Premium… I doing something wrong…http://candyrandyradio.com/ <<< that is the site I am trying to listen to…

  3. Thank you very much sir, I was looking for a way to listen to my Internet radio at the office but since I can’t install anything on the system… You kind of save my life :).For the others, these two little scripts are working fine if you replace the “.cmd” for a “.bat” like ArmandPV said.Well, thanks to both of you!

  4. Thanks for this. Like you say, winamp is nice and all… but on this latest install, I just didnt feel like managing all the additional software. If we ever meet, I will buy you a beer.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s