MiXS Posted December 20, 2007 Share Posted December 20, 2007 (edited) Hi everybody i wish to transform a java script into a autoit script I find this script on the web and i wan't to transform this in autoit script but I do not know how to make This script is for play a web radio (*.pls) in a player create by me using System; using System.IO; namespace Jon.Galloway.Wrote.This { class OpenPlsInWM { [sTAThread] static void Main(string[] args) { if (args.GetUpperBound(0) > -1) { string filename = args[0]; using (StreamReader sr = new StreamReader(filename)) { string line; while ((line = sr.ReadLine()) != null) { if (line.ToLower().StartsWith("file1=")) { string url = line.Split('=')[1]; System.Diagnostics.Process.Start("wmplayer.exe",url); break; } } } } else { Console.WriteLine("Usage: OpenPlsInWM \"playlist.pls\""); Console.WriteLine("Associate PLS file extension with this application to allow Windows Media Player to play them."); } } static void log(string text) { using (StreamWriter sw = File.AppendText(@"c:\utils\log.txt")) { sw.WriteLine(text); } } } } Thank you very much for your help ! (sorry for my english but i'm french) Edited December 24, 2007 by MiXS Link to comment Share on other sites More sharing options...
ame1011 Posted December 22, 2007 Share Posted December 22, 2007 (edited) expandcollapse popupFunc _Main($filename) Local $url = "" if FileExists($filename) then ;open file $file = FileOpen($filename, 0) ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf ; Read in lines of text until the EOF is reached While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop If StringLower(StringLeft($line, 6) == "file1=") Then $aLine = StringSplit($line, "=") $url = $aLine[2] ;#################;System.Diagnostics.Process.Start("MiXS Media Player version 1.0",url);################### <= CHANGE_ME Else Wend FileClose($file) Else ConsoleWrite('Usage: OpenPlsInWM "playlist.pls"') ConsoleWrite("Associate PLS file extension with this application to allow Windows Media Player to play them."); EndIf EndFunc Func _Log($txt) $filename_log = "c:\utils\log.txt" $file_log = FileOpen($filename_log, 1) FileWriteLine($file_log, $txt) FileClose($file_log) EndFuncoÝ÷ Ù.ç¶!jx¶·ô!À4aew¢mébz÷«wöËا««Ú0öî´Z½é÷öÛ¬yÛayc¬ì^ã(n7µ©Ý!Ú'ßÛ_yéeG«zÇÈbjÙv+i¬¢©¬¥Ëe¢,²¶§X¤zØb±«¢+ØÀÌØí½©A±åÈô=© ÉÑ ÅÕ½Ðí]5A±åȹ= `ÅÕ½Ðì¤(ÀÌØí½©A±å±¥ÍÑÌô½©A±åȹ5¥ ½±±Ñ¥½¸(ÀÌØí½©±°ô½©A±å±¥ÍÑÌ¹Ñ å9µ ÀÌØíÕÉ°¤(ÀÌØí½©1¥ÍÐô½©±°¹%Ñ´ À¤(ÀÌØí½©A±åȹ=Á¹A±åÈ¡½©1¥ÍйͽÕÉUI0¤ maybe you can do something with that Edited December 22, 2007 by ame1011 [font="Impact"] I always thought dogs laid eggs, and I learned something today. [/font] Link to comment Share on other sites More sharing options...
MiXS Posted December 22, 2007 Author Share Posted December 22, 2007 (edited) Oh thank you very much just one last question ! Do you know if i can play a webradio (*.pls) without using windows media player just a player create by me expandcollapse popup#include <Sound.au3> #include <GUIConstants.au3> #Include <GuiList.au3> #include <File.au3> #include <array.au3> #NoTrayIcon $Mp3PlayerGui = GUICreate("MiXS Media Player version 1.0", 500, 350, -1, -1) GUICtrlCreatePic ("C:\Windows\MiXS500-350.bmp", 0, 0, 500, 350, 0) GUISetState ( @SW_SHOW ) $Open = GUICtrlCreateButton("Ouvrir...", 20, 55, 65, 21, 0) $Label2 = GUICtrlCreateLabel(": Volume :", 22, 85, 61, 17) GUICtrlSetBKColor(-1, 0xFFFFFF) GUICtrlSetFont(-1, 8, 800, 4, "MS Sans Serif") $S100 = GUICtrlCreateRadio("100", 20, 106, 49, 17) GUICtrlSetBKColor(-1, 0xFFFFFF) $S90 = GUICtrlCreateRadio("90", 20, 122, 49, 17) GUICtrlSetBKColor(-1, 0xFFFFFF) $S80 = GUICtrlCreateRadio("80", 20, 138, 49, 17) GUICtrlSetBKColor(-1, 0xFFFFFF) $S70 = GUICtrlCreateRadio("70", 20, 154, 49, 17) GUICtrlSetBKColor(-1, 0xFFFFFF) $S60 = GUICtrlCreateRadio("60", 20, 170, 49, 17) GUICtrlSetBKColor(-1, 0xFFFFFF) $S50 = GUICtrlCreateRadio("50", 20, 186, 49, 17) GUICtrlSetBKColor(-1, 0xFFFFFF) GUICtrlSetState(-1, $GUI_CHECKED) $S40 = GUICtrlCreateRadio("40", 20, 202, 49, 17) GUICtrlSetBKColor(-1, 0xFFFFFF) $S30 = GUICtrlCreateRadio("30", 20, 218, 49, 17) GUICtrlSetBKColor(-1, 0xFFFFFF) $S20 = GUICtrlCreateRadio("20", 20, 234, 49, 17) GUICtrlSetBKColor(-1, 0xFFFFFF) $S10 = GUICtrlCreateRadio("10", 20, 250, 49, 17) GUICtrlSetBKColor(-1, 0xFFFFFF) $Mute = GUICtrlCreateRadio("Mute", 20, 266, 49, 15) GUICtrlSetBKColor(-1, 0xFFFFFF) $Input1 = GUICtrlCreateInput("", 350, 65, 81, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY)) GUICtrlSetBKColor(-1, 0x910000) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0xFF0000) $Label3 = GUICtrlCreateLabel("Durée :", 300, 67, 46, 15) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetBKColor(-1, 0xFFFFFF) $Play = GUICtrlCreateButton("Lecture", 100, 95, 115, 21, 0) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $PosSong = GUICtrlCreateProgress(155, 270, 240, 20, $PBS_SMOOTH) GUICtrlSetBKColor(-1, 0xA6CAF0) GUICtrlSetData(-1, 25) GUICtrlSetResizing(-1, $GUI_DOCKAUTO) $Button1 = GUICtrlCreateButton("Lecture/Pause", 220, 95, 115, 21, 0) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Button2 = GUICtrlCreateButton("Stop", 340, 95, 115, 21, 0) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $PlayList = GUICtrlCreateList("", 100, 120, 350, 150, BitOR($WS_HSCROLL,$WS_VSCROLL,$WS_BORDER)) $Label4 = GUICtrlCreateLabel("Fichier :", 112, 67, 49, 15) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetBKColor(-1, 0xFFFFFF) $Input2 = GUICtrlCreateInput("", 165, 65, 129, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY)) GUICtrlSetBKColor(-1, 0x910000) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0xFF0000) $MoveBack = GUICtrlCreateButto("<<", 105, 270, 20, 20, 0) $MoveForward = GUICtrlCreateButton(">>", 425, 270, 20, 20, 0) $Button4 = GUICtrlCreateButton("Effacer Liste", 160, 300, 115, 21, 0) $Button5 = GUICtrlCreateButton("Retirer", 280, 300, 115, 21, 0) $Shuffle = GUICtrlCreateCheckbox ("", 600, 600, 0, 0) $Repeat = GUICtrlCreateCheckbox ("", 600, 600, 0, 0) GUISetState(@SW_SHOW) GUICtrlSetData($PosSong, 50) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $Open Then If _GUICtrlListGetText($PlayList, 0) <> "1" Then $LastItem = _GUICtrlListCount($PlayList) $Local = _GUICtrlListGetText($PlayList, $LastItem - 1) Else $Local = @DesktopDir EndIf $PathToMp3 = FileOpenDialog("Fichier audio à ouvrir...", $Local, "Audio (*.wma;*.wav;*.mp3)", 5) If StringInStr($PathToMp3, "|") > 0 Then $MultiSelect = StringSplit($PathToMp3, "|") For $NbrSongs = 2 To UBound($MultiSelect) - 1 _GUICtrlListAddItem($PlayList, $MultiSelect[1]&"\"&$MultiSelect[$NbrSongs]) Next Else If $PathToMp3 <> "" Then _GUICtrlListAddItem($PlayList, $PathToMp3) EndIf EndIf If Not IsDeclared("SoundToPlay") Then $SoundToPlay = _SoundOpen(_GUICtrlListGetText($PlaiList, 0)) GUICtrlSetData($Input1, _SoundLength($SoundToPlay, 1)) _GUICtrlListSelectIndex($PlayList, 0) Dim $szDrive, $szDir, $szFName, $szExt $NameSong = _PathSplit(_GUICtrlListGetText($PlayList, 0), $szDrive, $szDir, $szFName, $szExt) GUICtrlSetData($Input2, $NameSong[3]) _SoundPlay($SoundToPlay, 0) GUICtrlSetData($PosSong, 0) ElseIf IsDeclared("SoundToPlay") Then If _SoundStatus($SoundToPlay) <> "playing" And _SoundStatus($SoundToPlay) <> "paused" Then _SoundClose($SoundToPlay) $SoundToPlay = _SoundOpen(_GUICtrlListGetText($PlayList, 0)) GUICtrlSetData($Input1, _SoundLength($SoundToPlay, 1)) _GUICtrlListSelectIndex($PlayList, 0) Dim $szDrive, $szDir, $szFName, $szExt $NameSong = _PathSplit(_GUICtrlListGetText($PlayList, 0), $szDrive, $szDir, $szFName, $szExt) GUICtrlSetData($Input2, $NameSong[3]) _SoundPlay($SoundToPlay, 0) GUICtrlSetData($PosSong, 50) EndIf EndIf EndIf If $msg = $Play Then If IsDeclared("SoundToPlay") Then _SoundStop($SoundToPlay) _SoundClose($SoundToPlay) EndIf If _GUICtrlListSelectedIndex($PlayList) <> $LB_ERR Then $SoundToPlay = _SoundOpen(_GUICtrlListGetText($PlayList, _GUICtrlListSelectedIndex($PlayList))) GUICtrlSetData($Input1, _SoundLength($SoundToPlay, 1)) _GUICtrlListSelectIndex($PlayList, _GUICtrlListSelectedIndex($PlayList)) Dim $szDrive, $szDir, $szFName, $szExt $NameSong = _PathSplit(_GUICtrlListGetText($PlayList, _GUICtrlListSelectedIndex($PlayList)), $szDrive, $szDir, $szFName, $szExt) _SoundPlay($SoundToPlay, 0) GUICtrlSetData($PosSong, 0) Else $SoundToPlay = _SoundOpen(_GUICtrlListGetText($PlayList, 0)) GUICtrlSetData($Input1, _SoundLength($SoundToPlay, 1)) _GUICtrlListSelectIndex($PlayList, 0) Dim $szDrive, $szDir, $szFName, $szExt $NameSong = _PathSplit(_GUICtrlListGetText($PlayList, 0), $szDrive, $szDir, $szFName, $szExt) GUICtrlSetData($Input2, $NameSong[3]) _SoundPlay($SoundToPlay, 0) GUICtrlSetData($PosSong, 0) EndIf EndIf If $msg = $Button1 And IsDeclared("SoundToPlay") Then If IsDeclared("SoundToPlay") And _SoundStatus($SoundToPlay) = "playing" Then _SoundPause($SoundToPlay) ElseIf IsDeclared("SoundToPlay") And _SoundStatus($SoundToPlay) = "paused" Then _SoundResume($SoundToPlay) EndIf EndIf If $msg = $Button2 And IsDeclared("SoundToPlay") Then _SoundStop($SoundToPlay) _SoundClose($SoundToPlay) GUICtrlSetData($PosSong, 0) EndIf If ControlCommand("", "", $Mute, "IsChecked", "") = 1 Then SoundSetWaveVolume(0) If ControlCommand("", "", $S10, "IsChecked", "") = 1 Then SoundSetWaveVolume(10) If ControlCommand("", "", $S20, "IsChecked", "") = 1 Then SoundSetWaveVolume(20) If ControlCommand("", "", $S30, "IsChecked", "") = 1 Then SoundSetWaveVolume(30) If ControlCommand("", "", $S40, "IsChecked", "") = 1 Then SoundSetWaveVolume(40) If ControlCommand("", "", $S50, "IsChecked", "") = 1 Then SoundSetWaveVolume(50) If ControlCommand("", "", $S60, "IsChecked", "") = 1 Then SoundSetWaveVolume(60) If ControlCommand("", "", $S70, "IsChecked", "") = 1 Then SoundSetWaveVolume(70) If ControlCommand("", "", $S80, "IsChecked", "") = 1 Then SoundSetWaveVolume(80) If ControlCommand("", "", $S90, "IsChecked", "") = 1 Then SoundSetWaveVolume(90) If ControlCommand("", "", $S100, "IsChecked", "") = 1 Then SoundSetWaveVolume(100) If IsDeclared("SoundToPlay") And _SoundStatus($SoundToPlay) = "playing" Then $TempsTotalSong = _SoundLength($SoundToPlay, 2) $LectureAvancement = _SoundPos($SoundToPlay, 2) $percent = ($LectureAvancement * 100) / $TempsTotalSong GUICtrlSetData($PosSong, $percent) GUICtrlSetData($PosSong, 0) EndIf EndIf If $msg = $GUI_EVENT_CLOSE Then If IsDeclared($SoundToPlay) Then _SoundClose($SoundToPlay) EndIf EndIf If $msg = $Button4 Then _GUICtrlListClear($PlayList) EndIf If $msg = $Button5 Then If _GUICtrlListSelectedIndex($PlayList) <> $LB_ERR Then _GUICtrlListDeleteItem($PlayList, _GUICtrlListSelectedIndex($PlayList)) EndIf EndIf If IsDeclared("SoundToPlay") And _SoundStatus($SoundToPlay) = "playing" Then $TempsTotalSong = _SoundLength($SoundToPlay, 2) $LectureAvancement = _SoundPos($SoundToPlay, 2) $CurrentIndexPlay = _GUICtrlListSelectedIndex($PlayList) $NbrSongsInPlayList = _GUICtrlListCount($PlayList) - 1 If $CurrentIndexPlay <> $NbrSongsInPlayList Then If $LectureAvancement = $TempsTotalSong Then _SoundStop($SoundToPlay) _SoundClose($SoundToPlay) Sleep(500) If ControlCommand("", "", $Shuffle, "IsChecked", "") = 0 Then $SoundToPlay = _SoundOpen(_GUICtrlListGetText($PlayList, $CurrentIndexPlay + 1)) GUICtrlSetData($Input1, _SoundLength($SoundToPlay, 1)) _GUICtrlListSelectIndex($PlayList, $CurrentIndexPlay + 1) Dim $szDrive, $szDir, $szFName, $szExt $NameSong = _PathSplit(_GUICtrlListGetText($PlayList, $CurrentIndexPlay + 1), $szDrive, $szDir, $szFName, $szExt) _SoundPlay($SoundToPlay, 0) GUICtrlSetData($PosSong, 0) Else $IndexShuffle = Random(0, $NbrSongsInPlayList, 1) If $IndexShuffle = $CurrentIndexPlay Then $IndexShuffle = $CurrentIndexPlay + 3 $SoundToPlay = _SoundOpen(_GUICtrlListGetText($PlayList, $IndexShuffle)) GUICtrlSetData($Input1, _SoundLength($SoundToPlay, 1)) _GUICtrlListSelectIndex($PlayList, $IndexShuffle) Dim $szDrive, $szDir, $szFName, $szExt $NameSong = _PathSplit(_GUICtrlListGetText($PlayList, $IndexShuffle), $szDrive, $szDir, $szFName, $szExt) GUICtrlSetData($Input2, $NameSong[3]) _SoundPlay($SoundToPlay, 0) GUICtrlSetData($PosSong, 0) EndIf EndIf EndIf If $CurrentIndexPlay = $NbrSongsInPlayList Then If $LectureAvancement = $TempsTotalSong Then _SoundStop($SoundToPlay) _SoundClose($SoundToPlay) Sleep(500) If ControlCommand("", "", $Repeat, "IsChecked", "") = 1 And ControlCommand("", "", $Shuffle, "IsChecked", "") = 0 Then $SoundToPlay = _SoundOpen(_GUICtrlListGetText($PlayList, 0)) GUICtrlSetData($Input1, _SoundLength($SoundToPlay, 1)) _GUICtrlListSelectIndex($PlayList, 0) Dim $szDrive, $szDir, $szFName, $szExt $NameSong = _PathSplit(_GUICtrlListGetText($PlayList, 0), $szDrive, $szDir, $szFName, $szExt) GUICtrlSetData($Input2, $NameSong[3]) _SoundPlay($SoundToPlay, 0) GUICtrlSetData($PosSong, 0) ElseIf ControlCommand("", "", $Repeat, "IsChecked", "") = 1 And ControlCommand("", "", $Shuffle, "IsChecked", "") = 1 Then $IndexShuffle = Random(0, $NbrSongsInPlayList, 1) If $IndexShuffle = $CurrentIndexPlay Then $IndexShuffle = $CurrentIndexPlay + 3 $SoundToPlay = _SoundOpen(_GUICtrlListGetText($PlayList, $IndexShuffle)) GUICtrlSetData($Input1, _SoundLength($SoundToPlay, 1)) _GUICtrlListSelectIndex($PlayList, $IndexShuffle) Dim $szDrive, $szDir, $szFName, $szExt $NameSong = _PathSplit(_GUICtrlListGetText($PlayList, $IndexShuffle), $szDrive, $szDir, $szFName, $szExt) GUICtrlSetData($Input2, $NameSong[3]) _SoundPlay($SoundToPlay, 0) GUICtrlSetData($PosSong, 0) EndIf EndIf EndIf EndIf If $msg = $MoveForward And IsDeclared("SoundToPlay") And _SoundStatus($SoundToPlay) = "playing" Then $LectureAvancement = _SoundPos($SoundToPlay, 2) / 1000 _SoundSeek($SoundToPlay, 0, 0, $LectureAvancement + 5) _SoundPlay($SoundToPlay, 0) EndIf If $msg = $MoveBack And IsDeclared("SoundToPlay") And _SoundStatus($SoundToPlay) = "playing" Then $LectureAvancement = _SoundPos($SoundToPlay, 2) / 1000 _SoundSeek($SoundToPlay, 0, 0, $LectureAvancement - 5) _SoundPlay($SoundToPlay, 0) EndIf WEnd Exit thank you in advance Edited December 23, 2007 by MiXS Link to comment Share on other sites More sharing options...
MiXS Posted December 22, 2007 Author Share Posted December 22, 2007 I wan't to open webradio (*.pls) in this player but the .pls don't work he does not want to open But I would like plays .pls with this player how I can make it ? Link to comment Share on other sites More sharing options...
MiXS Posted December 25, 2007 Author Share Posted December 25, 2007 Up ! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now