Jump to content

Recommended Posts

Posted (edited)

Great script to hear your radio stations by one click.

Stations keep save and u will show them next time u run Radio Player.

By-the-way, its work on vista :) (im using vista) and work for xp too.

For Vista:

If double click dont work, run it as (x86)

Example URLs:

http://www.mizrahit.co.il/mediaplayer.wax

http://radio.coolsite.co.il/glglz.asx

http://www.cast-tv.biz/play/wvx/22659/383_5457.wvx

update to version v1.3

Posted Image

changs:

for v1.3: using listview, allow double click and right click.

now u can show what u playing!

and set volume!

there is tray options :P

For Vista:

If double click dont work, run it as (x86)

Radio_Player.au3

Radio_Player.au3

Edited by Gillboss
Posted

when I insert link and click "play" windows media player pops up with a bunch of pictures, though there is a link "radio" in windows media player (upper part of the screen), and music starts playin' if I hit "radio" link, but if I click "play" on your script only media player pops up.

should the music start playing by itself if I click "play" on your script? :)

Posted

update version v1.2 =]

now there is Tray options.. :)

#include <GUIConstants.au3>
#include <WMMedia.au3>
#include <File.au3>
#include <Constants.au3>

Opt("TrayMenuMode",1)
$restore = TrayCreateItem("Restore")
TrayCreateItem("")
$exit = TrayCreateItem("Exit")
TraySetState()
Opt("TrayIconHide", 1)
TraySetClick(8) ; Pressing secondary mouse button

$version = "v1.2"

Global $play, $stop, $add, $addGui
WMStartPlayer()

If Not FileExists(@ProgramFilesDir&"\Windows Media Player\wmplayer.exe") Then
    MsgBox(16, "Crictal", "Windows Media Player must be installed")
    Exit
EndIf


    
GUICreate("Radio Player "&$version, 380, 320, (@DesktopWidth-380)/2, (@DesktopHeight-320)/2)
$play = GUICtrlCreateButton("Play", 300, 10, 60, 30)
$stop = GUICtrlCreateButton("Stop", 300, 40, 60, 30)
$delete = GUICtrlCreateButton("Delete", 300, 70, 60, 30)
$deleteall = GUICtrlCreateButton("Delete All", 300, 100, 60, 30)
$list = GUICtrlCreateList("", 10, 10, 250, 130)

$label = GUICtrlCreateLabel("Playing: ", 10, 140, 370, 20)
GUICtrlCreateLabel("Volume:  -", 10, 160, 60, 20)
$slider = GUICtrlCreateSlider(70, 155, 220, 30)
GUICtrlSetData($slider, 80)
GUICtrlCreateLabel("+", 290, 160, 10, 20)

GUICtrlCreateLabel("Title", 10, 200, 50, 20)
$titleR = GUICtrlCreateInput("", 50, 200, 250, 20)

GUICtrlCreateLabel("URL", 10, 240, 50, 20)
$urlR = GUICtrlCreateInput("", 50, 240, 250, 20)

$add = GUICtrlCreateButton("Add", 10, 270, 60, 30)
$clear = GUICtrlCreateButton("Clear", 80, 270, 60, 30)

GUICtrlCreateLabel("By Gil Hanan", 300, 300, 70, 20)
GUISetState()

_Refresh()

Func _Play()
    
    If GUICtrlRead($list) = "" Then
        MsgBox(64, "Information", "Please select station")
    Else
        If FileExists(@MyDocumentsDir&"\Link.m3u") Then
            FileDelete(@MyDocumentsDir&"\Link.m3u")
        EndIf
        

        $sum2 = _GetClearTitle()
        $sum = _GetClearURL()
        WMOpenFile($sum)
        WMPlay($sum)
        GUICtrlSetData($label, "Playing: "&$sum2)
        WinActivate("Radio By G.H")
    EndIf
EndFunc

Func _Stop()
    WMStop()
    GUICtrlSetData($label, "Playing: ")
EndFunc

Func _Add()
    If GUICtrlRead($urlR) = "" And GUICtrlRead($titleR) = "" Then
        MsgBox(64, "Information", "Please insert URL and Title")
    Else
    
        If GUICtrlRead($urlR) = "" Then
            MsgBox(64, "Information", "Please insert URL")
        Else
        If GUICtrlRead($titleR) = "" Then
            MsgBox(64, "Information", "Please insert Title")
        Else

        
    If  StringInStr(GUICtrlRead($urlR), "~") <> 0 Or StringInStr(GUICtrlRead($titleR), "~") Then
        MsgBox(64, "Information", "Sorry you can't using the char ~")
    Else
        If Not FileExists(@MyDocumentsDir&"\Radio.ini") Then
            $file2 = FileOpen(@MyDocumentsDir&"\Radio.ini", 1)
            FileClose($file2)
        EndIf
        
        $answer = _Search()
        
        If $answer = 1 Then
            $count = _FileCountLines(@MyDocumentsDir&"\Radio.ini")

            $file2 = FileOpen(@MyDocumentsDir&"\Radio.ini", 1)
            _FileWriteToLine(@MyDocumentsDir&"\Radio.ini", $count + 1, GUICtrlRead($titleR), 1)
            _FileWriteToLine(@MyDocumentsDir&"\Radio.ini", $count + 2, GUICtrlRead($urlR), 1)
            FileClose($file2)
            _Refresh()
        Else
            MsgBox(64, "Information", "You already insert the URL: "&GUICtrlRead($urlR))
        EndIf
    EndIf
    EndIf
    EndIf
    EndIf
EndFunc

Func _Search()
    $lines = _FileCountLines(@MyDocumentsDir&"\Radio.ini")
    For $i=2 To $lines Step 2
        If FileReadLine(@MyDocumentsDir&"\Radio.ini", $i) = GUICtrlRead($urlR) Then
            Return(0)
        EndIf
    Next
    Return(1)
EndFunc

Func _Refresh()
    GUICtrlSetData($list, "")
    If FileExists(@MyDocumentsDir&"\Radio.ini") Then
        $stations = _FileCountLines(@MyDocumentsDir&"\Radio.ini")
        
        For $i=1 To $stations Step 2
            $title = FileReadLine(@MyDocumentsDir&"\Radio.ini", $i)
            $url = FileReadLine(@MyDocumentsDir&"\Radio.ini", $i+1)
            GUICtrlSetData($list, $title&" ~ "&$url)
        Next
    EndIf
EndFunc

Func _Delete()
    If GUICtrlRead($list) = "" Then
        MsgBox(64, "Information", "Please select station")
    Else

        $lines = _FileCountLines(@MyDocumentsDir&"\Radio.ini")
        
        $file = FileOpen(@MyDocumentsDir&"\Radio.ini", 1)
        $sum = _GetClearURL()
        
        
        
        For $i=2 to $lines Step 2
        If FileReadLine(@MyDocumentsDir&"\Radio.ini", $i) = $sum Then
                _FileWriteToLine(@MyDocumentsDir&"\Radio.ini", $i-1, "", 1)
                _FileWriteToLine(@MyDocumentsDir&"\Radio.ini", $i-1, "", 1) 
        EndIf
        Next
        FileClose($file)
        _Refresh()
    EndIf
EndFunc

Func _DeleteAll()
    $mbox = MsgBox(3, "Quetion", "You sure u want delete all list?")
    If $mbox = 6 Then
        FileDelete(@MyDocumentsDir&"\Radio.ini")
        FileOpen(@MyDocumentsDir&"\Radio.ini", 1)
        FileClose(@MyDocumentsDir&"\Radio.ini")
        GUICtrlSetData($list, "")
    Else
    EndIf
EndFunc

Func _GetClearURL()
    $sum = GUICtrlRead($list)
    $result = StringInStr($sum, "~")
    $len = StringLen($sum)
    $sum = StringRight($sum, ($len-$result-1))
    Return($sum)
EndFunc

Func _GetClearTitle()
    $sum = GUICtrlRead($list)
    $result = StringInStr($sum, "~")
    $len = StringLen($sum)
    $sum = StringLeft($sum, ($result-1))
    Return($sum)
EndFunc

While 1 
    WmSetVolume(GUICtrlRead($slider))

    $mMsg = GUIGetMsg()
    $tMsg = TrayGetMsg()
        
    Select
        Case $mMsg = $GUI_EVENT_CLOSE
            GUISetState(@SW_HIDE)
            Opt("TrayIconHide", 0)
        Case $mMsg = $play
            _Play()
        Case $mMsg = $stop
            _Stop()         
        Case $mMsg = $delete
            _Delete()   
        Case $mMsg = $deleteall
            _DeleteAll()    
        Case $mMsg = $add
            _Add()      
        Case $mMsg = $clear
            GUICtrlSetData($titleR, "") 
            GUICtrlSetData($urlR, "")   
        Case $tMsg = $restore
            GUISetState(@SW_RESTORE)
            GUISetState(@SW_SHOW)
            Opt("TrayIconHide", 1)
        Case $tMsg = $exit
            WMClosePlayer()
            Exit
    EndSelect
WEnd
Posted (edited)

can u give me the radios don't play adress?

i will try fix it.

buy this is work:

asx, wvx, wax and maybe more.

about the tray, i updated.

Edited by Gillboss
Posted (edited)

hehehe enjot soon there version 1.3 =]

with viewLIST :P

you will can sort double click and you use delete at keybord :)

Edited by Gillboss
Posted

Updated to v1.3 :P

now im using viewList with option double click and right click.

v1.4 will include edit, copy and more ideaas that i will think. :)

Enjoy!

  • 1 year later...
Posted (edited)

I love this script! Tnank you!

It would be nice to add node or tabs structure dor different music styles.

I've included for offline mode in MSIE:

#include <isMSIEoffline.au3>
 If BitAND($val, $INTERNET_CONNECTION_OFFLINE) Then
    MsgBox(0...
    Exit
 EndIf

and

If WinExists(@ScriptName) Then Exit
 AutoItWinSetTitle(@ScriptName)

; shortcuts:
 ; Ctrl+Shift+p Play/Stop toggle:
 HotKeySet("^+p", "_Stop")
 ; Ctrl+Shift+r minimize/show:
 HotKeySet("^+r", "_Restor")

 Func _Stop()
 if WMGetState() == "Playing" then
        WMStop()
        GUICtrlSetData($label, "Playing: ")
     else
        _Play()
     Endif
 EndFunc

 Func _Restor()
 local $sState = _WinAPI_IsWindowVisible(WinGetHandle($sTitle))
 if $sState == 1 then
    WinSetState ($sTitle , "",@SW_HIDE)
    Opt("TrayIconHide", 0)
 else
    WinSetState ($sTitle , "",@SW_SHOW)
    WinActivate ($sTitle)
    Opt("TrayIconHide", 1)
 Endif
 EndFunc

$Music = ObjCreate("WMPlayer.OCX")
 if isObj($Music) == 0 then
       MsgBox(0, "AutoIt", "There is no Windows Media Player in OS")
       Exit
    EndIf

What averybody thinks about sharing private Radio.ini files here or in other topic?

Edited by Leagnus

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...