wakillon Posted August 4, 2010 Author Posted August 4, 2010 I obtain that: --> IE.au3 V2.4-0 Error from function _IEQuit, $_IEStatus_InvalidDataType I am not certain to have the same version that you have (0.4) I have that for the line that you speak about: While 1 If $_Auto Then $_R = _Randomize ( $_LastUkTopChartsListArray[0] ) _GUICtrlStatusBar_SetText ( $_StatusBar, ' Waiting for Next Song...', 0 ) $_YoutubeSearch = _YoutubeSearch ( $_LastUkTopChartsListArray[$_R] & ' official' ) If StringInStr ( $_YoutubeSearch, 'http://www.youtube.com/watch?v' ) <> 0 Then $_IE = _IECreate ( $_YoutubeSearch, 0, 1, 1 ) $_DurationInit = TimerInit ( ) $_DurationDiff=0 My variable is $_Auto and your is $_RandomMode In Scite i have the same IE error message, i don't know why ! It's the same version, i just rename some variables for best comprehension ! Try the script after changing $_IE = _IECreate ( $_YoutubeSearch, 0, 0, 1 ) by $_IE = _IECreate ( $_YoutubeSearch, 0, 1, 1 ) and you'll see the IE windows Opening on your screen and can see if it load, crash or bug ! Courage... AutoIt 3.3.18.0 X86 - SciTE 5.5.7 - WIN 11 24H2 X64 - Other Examples Scripts
pierrotm777 Posted August 4, 2010 Posted August 4, 2010 In Scite i have the same IE error message, i don't know why !It's the same version, i just rename some variables for best comprehension ! Try the script after changing $_IE = _IECreate ( $_YoutubeSearch, 0, 0, 1 ) by $_IE = _IECreate ( $_YoutubeSearch, 0, 1, 1 )and you'll see the IE windows Opening on your screen and can see if it load, crash or bug ! Courage...That load very well and not crash
pierrotm777 Posted August 4, 2010 Posted August 4, 2010 Is it possible to have a version with the clip video
wakillon Posted August 4, 2010 Author Posted August 4, 2010 (edited) That load very well and not crashZut alors ! We don't get any troubleshooting indications ! At the end of the first song, did the IE window close it ? Edited August 4, 2010 by wakillon AutoIt 3.3.18.0 X86 - SciTE 5.5.7 - WIN 11 24H2 X64 - Other Examples Scripts
pierrotm777 Posted August 4, 2010 Posted August 4, 2010 Zut alors ! We don't get any troubleshooting indications ! At the end of the first song, did the IE window close it ?No , it load the next video
wakillon Posted August 4, 2010 Author Posted August 4, 2010 Is it possible to have a version with the clip video yes, I'm working on but give me some time... No , it load the next videoBut you say "I know, but that don't run well for me. it stay always on the same song's title"In manual mode or Random mode ? AutoIt 3.3.18.0 X86 - SciTE 5.5.7 - WIN 11 24H2 X64 - Other Examples Scripts
pierrotm777 Posted August 5, 2010 Posted August 5, 2010 yes, I'm working on but give me some time... But you say "I know, but that don't run well for me. it stay always on the same song's title"In manual mode or Random mode ?In manual mode , if i select a title, this is not it that is loaded
wakillon Posted August 5, 2010 Author Posted August 5, 2010 (edited) In manual mode , if i select a title, this is not it that is loaded Sorry I can not find error, so I made a new one that I tried to simplify ! and I suppress Right Arrow Hotkey too. expandcollapse popup[/size][/font] [font="arial, sans-serif"][size="2"] #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_icon=Radio.ico #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #cs ----------------------------------------------------------------------------------------------------------- AutoIt Version : 3.3.6.1 Author : Wakillon Title : TinyUKChartsStreamPlayer Script Fonction : Listen Last 100 Uk Top Charts singles like a radio in random order and without advertising by getting charts List on charts website and search song's list on youtube. _ ESC for Quit _ WebSite http://www.theofficialcharts.com/singles-chart/ is updated weekly #ce ----------------------------------------------------------------------------------------------------------- #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <GUIConstantsEx.au3> #include <GUIStatusBar.au3> #Include <GuiListView.au3> #include <String.au3> #include <File.au3> #include <Misc.au3> #include <Date.au3> #include <IE.au3> HotKeySet ( "{ESC}", "_Terminate" ) If Not _Singleton ( @ScriptName, 1 ) Then Exit Dim $Sec, $Min, $Hour, $Time, $_SelectButtonWidth = 120, $_X=368, $_PicSize=100, $_Spaces=' ' Dim $_Text= @Crlf & $_Spaces & '_ ESC for Quit' Dim $_DurationDiff, $_DurationMs, $_GetItem, $_RandomMode=1, $_IE, $_PicPathOld Dim $_Key = "HKEY_LOCAL_MACHINE\SOFTWARE\TinyUKChartsStreamPlayer" Global $_LastUkTopChartsListArray[1], $_ImagesUrlArray[1], $_RandomArray[1] Global $_Duration, $_UpDateDate, $_LastChartPageSourceCode, $_Invert=True, $_InvertTimerInit=TimerInit ( ), $_StatusBar Global $_StatusParts[1] = [500], $_TempStatus[1] = [""] Global $__SLIDE_aGUI[1][5] = [["Winhandle", "sSide", "sState", "locked", "OnHover"]] Global $__SLIDE_hDLL = DllOpen ( "user32.dll" ) Opt ( "TrayMenuMode", 1 ) TraySetIcon ( "Shell32.dll", -129 ) TraySetToolTip ( " TinyUKChartsStreamPlayer" & @Crlf & StringStripWS ( $_Text, 7 ) ) TraySetState ( 4 ) AdlibRegister ( "__Slide_CheckHover", 100 ) OnAutoItExitRegister ( "_OnAutoItExit" ) If Not FileExists ( @TempDir & '\Pics' ) Then DirCreate ( @TempDir & '\Pics' ) Do Sleep ( 1000 ) ToolTip ( $_Spaces & 'Waiting for Internet connection', @DesktopWidth/2-100, 0, 'Tiny UK Charts Stream Player', 1, 4 ) Until _IsConnected ( ) ToolTip ( '' ) $_Genre = StringSplit ( 'singles-chart|rock-and-metal-singles-chart|catalogue-singles-chart|dance-singles-chart', '|' ) $_SubKey = _SelectGenre ( ) $_LastChartsUrl = 'http://www.theofficialcharts.com/' & $_SubKey & '/' $_UpdateDate = _GetUpdateDate ( $_LastChartsUrl ) $_RegUpdateDate = RegRead ( $_Key & '\' & $_SubKey, 'UpdateDate' ) If $_UpdateDate <> $_RegUpdateDate Then ToolTip ( $_Spaces & 'Searching Last 100 Uk Top Charts List...' & @Crlf & @Crlf & $_Text, @DesktopWidth/2-100, 0, 'Tiny UK Charts Stream Player', 1, 4 ) RegDelete ( $_Key & '\' & $_SubKey ) $_LastUkTopChartsListArray = _GetLastUkTopChartsListArray ( $_LastChartPageSourceCode ) ToolTip ( '' ) Else For $_J = 1 To 100 $_Value = RegEnumVal ( $_Key & '\' & $_SubKey, $_J ) If @error <> 0 Then ExitLoop If StringInStr ( $_Value, 'UpdateDate' ) = 0 Then $_RegRead = RegRead ( $_Key & '\' & $_SubKey, $_Value ) _ArrayAdd ( $_LastUkTopChartsListArray, $_RegRead ) EndIf Next EndIf $_LastUkTopChartsListArray[0] = UBound ( $_LastUkTopChartsListArray )-1 If _IsArrayEmpty ( $_LastUkTopChartsListArray ) Then Exit MsgBox ( 0, 'Error', 'Sorry Uk Top Charts List Not Found !', 5 ) Dim $_ListViewItem[$_LastUkTopChartsListArray[0]+1] Dim $_GuiTitle='Tiny UK ' & $_SubKey & ' Stream Player ' & $_UpDateDate Opt ( "GuiOnEventMode", 1 ) $_Gui = GUICreate ( $_GuiTitle, 500, 330, @DesktopWidth-507, @DesktopHeight - 360, -1, BitOR ( $WS_EX_LAYERED, $WS_EX_TOOLWINDOW ) ) GUISetBkColor ( 0xFFD900 ) GUISetIcon ( "Shell32.dll", -129 ) GUISetOnEvent ( $GUI_EVENT_CLOSE, "_Terminate" ) $_ListView = GUICtrlCreateListView ( "Top Nb|Title - Artist", 15, 20, 340, 260 ) _GUICtrlListView_SetColumnWidth ( $_ListView, 1, $LVSCW_AUTOSIZE_USEHEADER ) For $_G = 1 To UBound ( $_LastUkTopChartsListArray ) - 1 $_ListViewItem[$_G] = GUICtrlCreateListViewItem ( StringFormat ( "%02i", $_G ) & "|" & $_LastUkTopChartsListArray[$_G], $_ListView ) Next $_RandomButton = GUICtrlCreateButton ( "Disable Random Mode", $_X, 149, $_SelectButtonWidth, 24 ) GUICtrlSetOnEvent ( $_RandomButton, "_RandomMode" ) GUICtrlSetBkColor ( $_RandomButton, 0xFF0000 ) GUICtrlSetColor ( $_RandomButton, 0xFFFF00 ) $_NextButton = GUICtrlCreateButton ( "Next Random Song", $_X, 185, $_SelectButtonWidth, 24 ) GUICtrlSetOnEvent ( $_NextButton, "_NextSong" ) $_SelectButton = GUICtrlCreateButton ( "Listen Selected Song", $_X, 221, $_SelectButtonWidth, 24 ) GUICtrlSetOnEvent ( $_SelectButton, "_SelectSong" ) GUICtrlSetBkColor ( $_SelectButton, 0xFFFF00 ) GUICtrlSetColor ( $_SelectButton, 0xff0000 ) GUICtrlSetState ( $_SelectButton, $GUI_DISABLE ) $_ExitButton = GUICtrlCreateButton ( "Exit", $_X, 257, $_SelectButtonWidth, 24 ) GUICtrlSetOnEvent ( $_ExitButton, "_Terminate" ) $_Pic = GUICtrlCreatePic ( @ProgramFilesDir & "\AutoIt3\Examples\GUI\merlin.gif", $_X+10, 20, $_PicSize, $_PicSize, BitOR ( $SS_Notify, $WS_GROUP, $WS_CLIPSIBLINGS ) ) $_StatusBar = _GUICtrlStatusBar_Create ( $_Gui, $_StatusParts, $_TempStatus, $SBARS_SIZEGRIP ) _GUICtrlStatusBar_SetMinHeight ( $_StatusBar, 40 ) $_Icons = _WinAPI_LoadShell32Icon ( 128 ) _GUICtrlStatusBar_SetIcon ( $_StatusBar, 0, $_Icons ) _Slide_WinSetSlide ( $_Gui, "top" ) _Slide_SlideSetOnHover ( $_Gui ) GUISetState ( @SW_SHOW ) While 1 If $_RandomMode Then $_R = _Randomize ( $_LastUkTopChartsListArray[0] ) $_Text2 = $_LastUkTopChartsListArray[$_R] _GUICtrlStatusBar_SetText ( $_StatusBar, $_Spaces & ' Waiting for Next Song...', 0 ) $_YoutubeSearch = _YoutubeSearch ( $_LastUkTopChartsListArray[$_R] & ' official' ) If StringInStr ( $_YoutubeSearch, 'http://www.youtube.com/watch?v' ) <> 0 Then $_IE = _IECreate ( $_YoutubeSearch, 0, 0, 1 ) $_DurationInit = TimerInit ( ) $_DurationDiff=0 For $_P = 1 To $_ImagesUrlArray[0] $_PicPath = @TempDir & '\Pics\' & $_LastUkTopChartsListArray[$_P] & '.jpg' If Not FileExists ( $_PicPath ) Then InetGet ( $_ImagesUrlArray[$_P], $_PicPath, 0, 1 ) Next $_PicPath = @TempDir & '\Pics\' & $_LastUkTopChartsListArray[$_R] & '.jpg' If FileExists ( $_PicPath ) Then GUICtrlSetState ( $_Pic, $GUI_HIDE ) $_Pic = GUICtrlCreatePic ( $_PicPath, $_X+10, 20, $_PicSize, $_PicSize, BitOR ( $SS_Notify, $WS_GROUP, $WS_CLIPSIBLINGS ) ) DLLCall ( "user32.dll", "int", "InvalidateRect", "hwnd", $_Gui, "int", 0, "int", 0 ) ; refresh the gui EndIf _WinSetOnTopOneTime ( $_GuiTitle ) $_Loop = 1 Else _GUICtrlStatusBar_SetText ( $_StatusBar, $_Spaces & 'Top N°' & $_R & ' - ' & $_LastUkTopChartsListArray[$_R] & @Crlf & 'Music Not Found !', 0 ) _WinSetOnTopOneTime ( $_GuiTitle ) Sleep ( 2000 ) EndIf EndIf $_PicPath = @TempDir & '\Pics\' & $_Text2 & '.jpg' If FileExists ( $_PicPath ) And $_PicPath <> $_PicPathOld Then GUICtrlSetState ( $_Pic, $GUI_HIDE ) $_Pic = GUICtrlCreatePic ( $_PicPath, $_X+10, 20, $_PicSize, $_PicSize, BitOR ( $SS_Notify, $WS_GROUP, $WS_CLIPSIBLINGS ) ) $_PicPathOld = $_PicPath $_PicPath='' EndIf While $_Loop If $_DurationDiff > $_DurationMs Then _IEQuit ( $_IE ) $_Loop =0 _GUICtrlStatusBar_SetText ( $_StatusBar, '', 0 ) ExitLoop EndIf Sleep ( 20 ) If _EachXseconds ( 1.5 ) Then _InvertColorButton ( $_RandomButton ) $_DurationMs = $_Duration * 1000 If $_Duration Then $_DurationDiff = Round ( TimerDiff ( $_DurationInit ) ) _TicksToTime ( $_DurationMs - $_DurationDiff, $Hour, $Min, $Sec ) If $_Text2 Then _GUICtrlStatusBar_SetText ( $_StatusBar, $_Spaces & 'Top N°' & $_R & ' - ' & $_Text2 & ' - ' & StringFormat ( "%02i:%02i", $Min, $Sec ), 0 ) WEnd WEnd Func _SelectSong ( ) If $_Loop Then _IEQuit ( $_IE ) $_GetItem = _GetItem ( ) If $_GetItem Then _GUICtrlStatusBar_SetText ( $_StatusBar, $_Spaces & 'Waiting for Next Song...', 0 ) $_YoutubeSearch = _YoutubeSearch ( $_GetItem & ' official' ) $_IE = _IECreate ( $_YoutubeSearch, 0, 0, 1 ) $_DurationInit = TimerInit ( ) $_DurationDiff=0 $_PicPath = @TempDir & '\Pics\' & $_GetItem & '.jpg' If FileExists ( $_PicPath ) Then GUICtrlSetState ( $_Pic, $GUI_HIDE ) $_Pic = GUICtrlCreatePic ( $_PicPath, $_X+10, 20, $_PicSize, $_PicSize, BitOR ( $SS_Notify, $WS_GROUP, $WS_CLIPSIBLINGS ) ) EndIf $_Text2 = $_GetItem $_Loop =1 EndIf EndFunc ;==> _SelectSong ( ) Func _RandomMode ( ) If $_Loop Then _IEQuit ( $_IE ) $_Loop =0 If $_RandomMode = 1 Then $_RandomMode=0 GUICtrlSetState ( $_SelectButton, $GUI_ENABLE ) GUICtrlSetState ( $_NextButton, $GUI_DISABLE ) GUICtrlSetState ( $_RandomButton, $GUI_HIDE ) $_RandomButton = GUICtrlCreateButton ( "Enable Random Mode", $_X, 149, $_SelectButtonWidth, 24 ) GUICtrlSetBkColor ( $_RandomButton, 0xFF0000 ) GUICtrlSetColor ( $_RandomButton, 0xFFFF00 ) GUICtrlSetOnEvent ( $_RandomButton, "_RandomMode" ) _GUICtrlStatusBar_SetText ( $_StatusBar, '', 0 ) Else $_RandomMode = 1 GUICtrlSetState ( $_SelectButton, $GUI_DISABLE ) GUICtrlSetState ( $_RandomButton, $GUI_HIDE ) GUICtrlSetState ( $_NextButton, $GUI_ENABLE ) $_RandomButton = GUICtrlCreateButton ( "Disable Random Mode", $_X, 149, $_SelectButtonWidth, 24 ) GUICtrlSetBkColor ( $_RandomButton, 0xFF0000 ) GUICtrlSetColor ( $_RandomButton, 0xFFFF00 ) GUICtrlSetOnEvent ( $_RandomButton, "_RandomMode" ) _GUICtrlStatusBar_SetText ( $_StatusBar, '', 0 ) EndIf $_Text2='' EndFunc ;==> _RandomMode ( ) Func _NextSong ( ) _IEQuit ( $_IE ) $_Loop=0 _GUICtrlStatusBar_SetText ( $_StatusBar, '', 0 ) EndFunc ;==> _NextSong ( ) Func _SelectGenre ( ) $_Gui = GUICreate ( "Tiny UK Charts Stream Player, Select Genre...", 250, 130, -1, -1, -1, BitOR ( $WS_EX_TOPMOST, $WS_EX_TOOLWINDOW ) ) GUISetBkColor ( 0xFFD900 ) Dim $_Radio[UBound ( $_Genre )] For $_I = 1 To UBound ( $_Genre ) -1 $_Radio[$_I] = GUICtrlCreateRadio ( _StringProper ( StringReplace ( $_Genre[$_I], '-', ' ' ) ), 10, $_I*20 -10, 160, 20 ) Next GUISetState ( ) $_TimerInit = TimerInit ( ) $_InvertTimerInit = TimerInit ( ) While 1 $msg = GUIGetMsg ( ) Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg <> -11 And $msg <> 0 For $_I = 1 To UBound ( $_Genre ) -1 If $msg = $_Radio[$_I] And BitAND ( GUICtrlRead ( $_Radio[$_I] ), $GUI_CHECKED ) = $GUI_CHECKED Then $_SubKey = $_Genre[$_I] GUIDelete ( $_Gui ) Return $_SubKey EndIf Next EndSelect $_ChoiceTimerDiff = Round ( TimerDiff ( $_TimerInit )/1000 ) If _EachXseconds ( 1 ) Then GUICtrlCreateLabel ( StringFormat ( "%02i", ( 11 - $_ChoiceTimerDiff ) ) & ' Secondes to make your Choice...', 10, ( $_I+1 ) * 20 -10 ) If $_ChoiceTimerDiff > 10 Then Dim $_SubKey = $_Genre[Random ( 1, $_Genre[0], 1 )] GUIDelete ( $_Gui ) Return $_SubKey EndIf Sleep ( 20 ) WEnd EndFunc ;==> _SelectGenre ( ) Func _InvertColorButton ( $_GuiCtrl ) If $_Invert Then GUICtrlSetBkColor ( $_GuiCtrl, 0xFF0000 ) GUICtrlSetColor ( $_GuiCtrl, 0xFFFF00 ) $_Invert=False Else GUICtrlSetBkColor ( $_GuiCtrl, 0xFFFF00 ) GUICtrlSetColor ( $_GuiCtrl, 0xFF0000 ) $_Invert=True EndIf EndFunc ;==> _InvertColorButton ( ) Func _EachXseconds ( $_Interval ) $_TimerDiff = Round ( TimerDiff ( $_InvertTimerInit )/ 1000 ) If $_TimerDiff >= $_Interval Then $_InvertTimerInit = TimerInit ( ) Return 1 Else Return 0 EndIf EndFunc ;==> _EachXseconds ( ) Func _GetItem ( ) $_Select = GUICtrlRead ( GUICtrlRead ( $_ListView ) ) $_Stringlen = Stringlen ( $_Select ) $_Select = StringReplace ( StringRight ( $_Select, $_Stringlen - 3 ), '|', '' ) If $_Select Then Return $_Select EndFunc ;==> _GetItem ( ) Func _GetUpdateDate ( $_LastChartsUrl ) Local $_UpDateDate $_LastChartPageSourceCode = _GetSourceCode ( $_LastChartsUrl ) $_UpDateDate = _StringBetween ( $_LastChartPageSourceCode, '"date"> -', "<" ) If Not @error Then $_UpDateDate = '( Week of ' & StringStripWS ( $_UpDateDate[0], 7 ) & ' )' Return $_UpDateDate EndFunc ;==> _GetUpdateDate ( ) Func _GetLastUkTopChartsListArray ( $_SourceCode ) Local $_NamesArray[1], $_Add $_LastChartsArray = StringSplit ( $_SourceCode, @CRLF ) Local $_ChartsArray[1] For $_I = 1 To UBound ( $_LastChartsArray ) -1 If StringInStr ( $_LastChartsArray[$_I], '</h4>' ) <> 0 Then $_Title = _StringBetween ( $_LastChartsArray[$_I], '<h4>', '</h4>' ) If Not @error Then $_Artist = StringReplace ( $_LastChartsArray[$_I+2], '<br />', '' ) $_Name = _CleanVideoName ( $_Title[0] & ' - ' & $_Artist ) If Not _AlreadyInArray ( $_NamesArray, $_Name ) Then _ArrayAdd ( $_NamesArray, $_Name ) $_Add = $_Add + 1 RegWrite ( $_Key & '\' & $_SubKey, StringFormat ( "%03i", $_Add ), "REG_SZ", $_Name ) If $_I+43 < UBound ( $_LastChartsArray ) -1 Then For $_J = $_I-3 To $_I+3 $_ImagesUrl = _StringBetween ( $_LastChartsArray[$_J], 'coverimage" src="', '"' ) If Not @error Then $_ImagesUrl = $_ImagesUrl[0] If StringLeft ( $_ImagesUrl, 4 ) <> 'http' Then $_ImagesUrl = 'http://www.theofficialcharts.com' & $_ImagesUrl If Not _IsValidUrl ( $_ImagesUrl ) Then $_ImagesUrl='' _ArrayAdd ( $_ImagesUrlArray, $_ImagesUrl ) EndIf Next EndIf EndIf EndIf EndIf Next $_ImagesUrlArray[0] = UBound ( $_ImagesUrlArray ) -1 $_NamesArray[0] = UBound ( $_NamesArray ) -1 RegWrite ( $_Key & '\' & $_SubKey, 'UpdateDate', "REG_SZ", $_UpdateDate ) Return $_NamesArray EndFunc ;==> _GetLastUkTopChartsListArray ( ) Func _YoutubeSearch ( $_Query ) Dim $_WordOfQuery[1] $_QuerySplit = StringSplit ( StringStripWS ( StringRegExpReplace ( StringReplace ( StringReplace ( $_Query, 'è', 'e' ), 'é', 'e' ), "\W", " " ) , 7 ), ' ' ) For $_I = 1 To UBound ( $_QuerySplit ) - 1 If StringLen ( $_QuerySplit[$_I] ) > 1 Then _ArrayAdd ( $_WordOfQuery, StringReplace ( $_QuerySplit[$_I], ',', ' ' ) ) Next $_WordOfQuery[0] = UBound ( $_WordOfQuery ) - 1 $_Query = StringReplace ( $_Query, " ", "+" ) $_Query = StringReplace ( StringReplace ( StringReplace ( StringReplace ( StringReplace ( StringReplace ( StringReplace ( StringReplace _ ( StringReplace ( StringStripWS ( $_Query, 7 ), ',', '%2C' ), '&', '%26' ), '(', '%28' ), ')', '%29' ), "'", '%27' ), 'è', 'e' ), 'é', 'e' ), '«', ' ' ), '»', ' ' ) $_SourceCode = _GetSourceCode ( "http://www.youtube.com/results?search_query=" & $_Query ) $_SourceCodeSplit = StringSplit ( $_SourceCode, @CRLF ) Dim $_Watch[1] For $_I = 1 To UBound ( $_SourceCodeSplit )-1 If StringInStr ( $_SourceCodeSplit[$_I], '/watch?v=' ) <> 0 And StringInStr ( $_SourceCodeSplit[$_I], 'video-long-title' ) <> 0 Then _ArrayAdd ( $_Watch, $_SourceCodeSplit[$_I] ) EndIf Next For $_I = 1 To UBound ( $_Watch )-1 $Titles = _StringBetween ( $_Watch[$_I], 'title="', '" rel=' ) If Not @error Then If Not _OneOfThisStringInStr ( $Titles[0], 'Karaok|Singing|parod' ) Then $_Duration = _StringBetween ( $_SourceCode, 'time">', '<' ) If Not @error Then $_Duration = StringSplit ( $_Duration[0], ':' ) $_Duration[0]=UBound ( $_Duration ) -1 $_Duration = $_Duration[1]*60 + $_Duration[$_Duration[0]] $Link = _StringBetween ( $_Watch[$_I], 'href="', '"' ) If Not @error Then If StringInStr ( $Link[0], 'http://www.youtube.com' ) = 0 Then $_UrlToExtract = "http://www.youtube.com" & $Link[0] Else $_UrlToExtract = $Link[0] EndIf Return $_UrlToExtract EndIf EndIf EndIf EndIf Next Endfunc ;==> _YoutubeSearch ( ) Func _OneOfThisStringInStr ( $_InStr, $_String ) $_StringArray = StringSplit ( $_String, '|' ) If @error Then Return 0 For $_I = 1 To UBound ( $_StringArray ) -1 $_StringInStr = StringInStr ( $_InStr, $_StringArray[$_I] ) If $_StringInStr <> 0 Then Return 1 Next Return 0 EndFunc ;==> _OneOfThisStringInStr ( ) Func _CleanVideoName ( $_Name ) $_Name2 = StringRegExpReplace ( $_Name, '(")|(")|(quot;)|(&)|(amp;)|(<)|(lt;)|(>)|(gt;)|(#39;)', '' ) $_Name2 = StringReplace ( $_Name2, 'ç', 'c' ) $_Name2 = StringReplace ( $_Name2, 'ß', 'ss' ) $_Name2 = StringReplace ( $_Name2, '€', '€' ) $_Name2 = StringRegExpReplace ( $_Name2, '(à )|(â)|(ä)|(À)|(ã)|(á)|(Ã¥)', 'a' ) $_Name2 = StringRegExpReplace ( $_Name2, '(Ú)|(ê)|(é)|(è)|(ë)', 'e' ) $_Name2 = StringRegExpReplace ( $_Name2, '(ï)|(î)|(Ã)', 'i' ) $_Name2 = StringRegExpReplace ( $_Name2, '(ÃŽ)|(ö)|(ó)|(ô)', 'o' ) $_Name2 = StringRegExpReplace ( $_Name2, '(û)|(ü)|(ù)|(ÃŒ)|(ú)', 'u' ) $_Name2 = StringReplace ( $_Name2, 'Ã', 'a' ) $_Name2 = StringReplace ( $_Name2, '\', '' ) $_Name2 = StringRegExpReplace ( $_Name2, "[|!?_*~´’'`³¹¼¯,]", ' ' ) $_Name2 = StringRegExpReplace ( $_Name2, '[âªâ™«»¥¶£¢€¡†Ø§³ÙŠšØ¹±ª#®¤©‰¨¹¬·/;:"]', '' ) Return _StringProper ( StringStripWS ( _CleanHtmlName ( $_Name2 ), 7 ) ) EndFunc ;==> _CleanVideoName ( ) Func _CleanHtmlName ( $_Name ) $_Name2 = StringReplace ( $_Name, '%2C', ',' ) $_Name2 = StringReplace ( $_Name2, '%82', ',' ) $_Name2 = StringReplace ( $_Name2, '%27', "'" ) $_Name2 = StringReplace ( $_Name2, '&039', "'" ) Return $_Name2 EndFunc ;==> _CleanHtmlName ( ) Func _Randomize ( $_Max=100 ) Do $_Random = Random ( 1, $_Max, 1 ) Until Not _AlreadyInArray ( $_RandomArray, $_Random ) _ArrayAdd ( $_RandomArray, $_Random ) $_RandomArray[0] = UBound ( $_RandomArray ) -1 If $_RandomArray[0] >= $_Max Then ReDim $_RandomArray[1] Return $_Random EndFunc ;==> _Randomize ( ) Func _AlreadyInArray ( $_SearchArray, $_Item ) $_Index = _ArraySearch ( $_SearchArray, $_Item ) If @error Then Return False Else If $_Index <> 0 Then Return True Else Return False EndIf EndIf EndFunc ;==> _AlreadyInArray ( ) Func _GetSourceCode ( $_Url ) $_InetRead = InetRead ( $_Url ) If Not @Error Then $_BinaryToString = BinaryToString ( $_InetRead ) If Not @Error Then Return $_BinaryToString EndIf EndFunc ;==> _GetSourceCode ( ) Func _IsArrayEmpty ( $_EmptyArray ) Local $_V = UBound ( $_EmptyArray ) -1, $_P If $_V = 0 Then Return True For $_F = 1 To $_V If $_EmptyArray[$_F] = '' Then $_P = $_P + 1 Next If $_P = $_V Then Return True Else Return False EndIf EndFunc ;==> _IsArrayEmpty ( ) Func _IsConnected ( ) $_SrcFilePath = _TempFile ( @TempDir & "\", '~google_', ".src", 7 ) Local $IsConnected = InetGet ( "http://www.google.com", $_SrcFilePath, 1, 1 ) Local $_Info Do $_Info = InetGetInfo ( $IsConnected ) Sleep ( 50 ) Until $_Info[2] = True InetClose ( $IsConnected ) _Delete ( $_SrcFilePath ) If $_Info[3] <> True Then Return 0 Else Return 1 EndIf EndFunc ;==> _IsConnected ( ) Func _IsValidUrl ( $_IsValidUrl ) $_Size = InetGetSize ( $_IsValidUrl ) If $_Size <> 0 Then Return 1 Endfunc ;==> _IsValidUrl ( ) Func _Delete ( $_FullPath ) $_DeleteInit = TimerInit ( ) While FileExists ( $_FullPath ) If StringInStr ( FileGetAttrib ( $_FullPath ), "D" ) Then DirRemove ( $_FullPath, 1 ) Else FileDelete ( $_FullPath ) EndIf If TimerDiff ( $_DeleteInit ) > 5000 Then Return 0 WEnd Return 1 EndFunc ;==> _Delete ( ) Func _ProcessClose ( $_ProcessName ) While ProcessExists ( $_ProcessName ) ProcessClose ( $_ProcessName ) WEnd EndFunc ;==> _ProcessClose ( ) Func _Terminate ( ) _IEQuit ( $_IE ) Exit EndFunc ;==> _Terminate ( ) Func _OnAutoItExit ( ) Opt ( "TrayIconHide", 0 ) TrayTip ( "TinyUKChartsStreamPlayer", " by wakillon...", 1, 1 ) __Slide_UnloadDLL ( ) Sleep ( 2000 ) TrayTip ( '', '', 1, 1 ) EndFunc ;==> _OnAutoItExit ( ) Func _WinSetOnTopOneTime ( $_WinTitle ) WinWait ( $_WinTitle, "", 2 ) WinSetOnTop ( $_WinTitle, "", 1 ) Sleep ( 250 ) WinSetOnTop ( $_WinTitle, "", 0 ) EndFunc ;==> _WinSetOnTopOneTime ( ) Func _Slide_WinSetSlide ( $hWnd, $sSide, $iMode = 1 ) If Not IsHWnd ( $hWnd ) Then $hWnd = WinGetHandle ( $hWnd ) If @error Then Return SetError ( 1, 0, 0 ) If $iMode > 1 Or $iMode < 0 Then Return SetError ( 1, 0, 0 ) If Not StringRegExp ( $sSide, "(?i)(left|right|top|bottom)" ) Then Return SetError ( 1, 0, 0 ) $iUbound = UBound ( $__SLIDE_aGUI ) Switch $iMode Case 1 ReDim $__SLIDE_aGUI[$iUbound + 1][5] $__SLIDE_aGUI[$iUbound][0] = $hWnd $__SLIDE_aGUI[$iUbound][1] = $sSide $__SLIDE_aGUI[$iUbound][2] = True $__SLIDE_aGUI[$iUbound][3] = False $__SLIDE_aGUI[$iUbound][4] = False _Slide_SlideOut ( $hWnd ) GUISetState ( @SW_SHOWNOACTIVATE, $hWnd ) Case 0 For $i = 1 To UBound ( $__SLIDE_aGUI ) - 1 If $__SLIDE_aGUI[$i][0] = $hWnd Then For $j = $i To UBound($__SLIDE_aGUI) - 2 $__SLIDE_aGUI[$j][0] = $__SLIDE_aGUI[$j + 1][0] $__SLIDE_aGUI[$j][1] = $__SLIDE_aGUI[$j + 1][1] $__SLIDE_aGUI[$j][2] = $__SLIDE_aGUI[$j + 1][2] $__SLIDE_aGUI[$j][3] = $__SLIDE_aGUI[$j + 1][3] $__SLIDE_aGUI[$j][4] = $__SLIDE_aGUI[$j + 1][4] ReDim $__SLIDE_aGUI[UBound ( $__SLIDE_aGUI ) - 1][5] _Slide_SlideIn ( $hWnd ) GUISetState ( @SW_HIDE, $hWnd ) Next EndIf Next EndSwitch EndFunc ;==> _Slide_WinSetSlide ( ) Func _Slide_SlideSetOnHover ( $hWnd, $sMode = True ) If Not IsHWnd ( $hWnd ) Then $hWnd = WinGetHandle ( $hWnd ) If @error Then Return SetError ( 1, 0, 0 ) $iUbound = UBound ( $__SLIDE_aGUI ) Switch $sMode Case True For $i = 1 To UBound ( $__SLIDE_aGUI ) - 1 If $__SLIDE_aGUI[$i][0] = $hWnd Then $__SLIDE_aGUI[$i][4] = True EndIf Next Case False For $i = 1 To UBound ( $__SLIDE_aGUI ) - 1 If $__SLIDE_aGUI[$i][0] = $hWnd Then $__SLIDE_aGUI[$i][4] = False EndIf Next EndSwitch EndFunc ;==> _Slide_SlideSetOnHover ( ) Func _Slide_SlideOut ( $hWnd ) If Not IsHWnd ( $hWnd ) Then $hWnd = WinGetHandle ( $hWnd ) If @error Then Return SetError ( 1, 0, 0 ) For $i = 1 To UBound ( $__SLIDE_aGUI ) - 1 If $__SLIDE_aGUI[$i][0] = $hWnd Then If $__SLIDE_aGUI[$i][2] Then __Slide_WinSlide ( $hWnd, "out", $__SLIDE_aGUI[$i][1] ) $__SLIDE_aGUI[$i][2] = False Return SetError ( 0, 0, 1 ) Else Return SetError ( 3, 0, 0 ) EndIf EndIf Next Return SetError ( 2, 0, 0 ) EndFunc ;==> _Slide_SlideOut ( ) Func _Slide_SlideIn ( $hWnd ) If Not IsHWnd ( $hWnd ) Then $hWnd = WinGetHandle ( $hWnd ) If @error Then Return SetError ( 1, 0, 0 ) For $i = 1 To UBound ( $__SLIDE_aGUI ) - 1 If $__SLIDE_aGUI[$i][0] = $hWnd Then If Not $__SLIDE_aGUI[$i][2] Then __Slide_WinSlide ( $hWnd, "in", $__SLIDE_aGUI[$i][1] ) $__SLIDE_aGUI[$i][2] = True Else Return SetError ( 3, 0, 0 ) EndIf EndIf Next Return SetError ( 2, 0, 0 ) EndFunc ;==> _Slide_SlideIn ( ) Func __Slide_WinSlide ( $hWnd, $sMode, $sSide ) Local $aScreen_Res = WinGetPos ( WinGetHandle ( "Program Manager" ) ) Local $aWPos = WinGetPos ( $hWnd ), $m = 0 - ( $sMode = "in" ) + ( $sMode = "out" ) Local $h = 0 - ( $sSide = "left" ) + ( $sSide = "right" ), $v = 0 - ( $sSide = "top" ) + ( $sSide = "bottom" ) WinMove ( $hWnd, "", $aScreen_Res[0] - ( ( $h = -1 ) * ( $m = -1 ) * ( $aWPos[2] - 10 ) ) _ + ( ( $h = 1 ) * ( ( $h = 1 ) * $aScreen_Res[2] - ( 10 * ( $m = -1 ) ) - ( $m <> -1 ) * $aWPos[2] ) ) _ + ( ( $h = 0 ) * ( ( $h = 0 ) * ( $aScreen_Res[2] / 2 ) - ( $aWPos[2] / 2 ) ) ) _ , $aScreen_Res[1] - ( ( $v = -1 ) * ( $m = -1 ) * ( $aWPos[3] - 10 ) ) _ + ( ( $v = 1 ) * ( ( $v = 1 ) * $aScreen_Res[3] - ( 10 * ( $m = -1 ) ) - ( $m <> -1 ) * $aWPos[3] ) ) _ + ( ( $v = 0 ) * ( ( $v = 0 ) * ( $aScreen_Res[3] / 2 ) - ($aWPos[3] / 2 ) ) ) ) $aWPos = WinGetPos ( $hWnd ) Switch $sSide Case "left", "right" Local $STEP = ( ( ( ( $h = 1 ) And ( $m = 1 ) ) Or ( ( $h = -1 ) And ( $m = -1 ) ) ) - ( ( ( $h = -1 ) And ( $m = 1 ) ) Or ( ( $h = 1 ) And ( $m = -1 ) ) ) ) * 10 Local $FROM = $aWPos[0], $TO = $aWPos[0] + ( ( ( ( $h = 1 ) And ( $m = 1 ) ) Or ( ( $h = -1 ) And ( $m = -1 ) ) ) * ( $aWPos[2] ) ) _ - ( ( ( ( $h = 1 ) And ( $m = -1 ) ) Or ( ( $h = -1 ) And ( $m = 1 ) ) ) * ( $aWPos[2] ) ) - $STEP For $i = $aWPos[0] To $TO Step $STEP WinMove ( $hWnd, "", $i, $aWPos[1] ) Sleep ( 10 ) Next Case "top", "bottom" Local $STEP = ( ( ( ( $v = 1 ) And ( $m = 1 ) ) Or ( ( $v = -1 ) And ( $m = -1 ) ) ) - ( ( ( $v = -1 ) And ( $m = 1 ) ) Or ( ( $v = 1 ) And ( $m = -1 ) ) ) ) * 10 Local $FROM = $aWPos[1], $TO = $aWPos[1] + ( ( ( ( $v = 1 ) And ( $m = 1 ) ) Or ( ( $v = -1 ) And ( $m = -1 ) ) ) * ( $aWPos[3] ) ) _ - ( ( ( ( $v = 1 ) And ( $m = -1 ) ) Or ( ( $v = -1 ) And ( $m = 1 ) ) ) * ( $aWPos[3] ) ) - $STEP If $STEP > 0 Then $TO = $TO -25 For $i = $aWPos[1] To $TO + 25 Step $STEP ; WinMove ( $hWnd, "", $aWPos[0], $i ) Sleep ( 10 ) Next EndSwitch EndFunc ;==> __Slide_WinSlide ( ) Func __Slide_CheckHover ( ) For $i = 1 To UBound ( $__SLIDE_aGUI ) - 1 If $__SLIDE_aGUI[$i][4] Then If Not $__SLIDE_aGUI[$i][3] Then If __Slide_WinIsHovered ( $__SLIDE_aGUI[$i][0] ) Then If Not $__SLIDE_aGUI[$i][2] Then _Slide_SlideIn ( $__SLIDE_aGUI[$i][0] ) Else If $__SLIDE_aGUI[$i][2] Then _Slide_SlideOut ( $__SLIDE_aGUI[$i][0] ) EndIf EndIf EndIf Next EndFunc ;==> __Slide_CheckHover ( ) Func __Slide_UnloadDLL ( ) DllClose ( $__SLIDE_hDLL ) EndFunc ;==> __Slide_UnloadDLL ( ) Func __Slide_WinIsHovered ( $hWnd, $vDLL = "User32.dll" ) Local $aResult, $aWPos = WinGetPos ( $hWnd ) If @error Then Return Local $aMPos = MouseGetPos ( ) If @error Then Return Local $tRect = DllStructCreate ( "int Left;int Top;int Right;int Bottom" ) Local $iLeft = $aWPos[0], $iTop = $aWPos[1], $iWidth = $aWPos[2], $iHeight = $aWPos[3] Local $iX = $aMPos[0], $iY = $aMPos[1] DllStructSetData ( $tRect, "Left", $iLeft ) DllStructSetData ( $tRect, "Top", $iTop ) DllStructSetData ( $tRect, "Right", $iLeft + $iWidth ) DllStructSetData ( $tRect, "Bottom", $iTop + $iHeight ) $aResult = DllCall ( $vDLL, "int", "PtInRect", "ptr", DllStructGetPtr ( $tRect ), "int", $iX, "int", $iY ) If @error Then Return SetError ( @error, 0, False ) Return $aResult[0] <> 0 EndFunc ;==> __Slide_WinIsHovered ( )[/size][/font] [font="arial, sans-serif"][size="2"] I tested it successfully, I hope it work for you... Edited August 10, 2010 by wakillon AutoIt 3.3.18.0 X86 - SciTE 5.5.7 - WIN 11 24H2 X64 - Other Examples Scripts
pierrotm777 Posted August 6, 2010 Posted August 6, 2010 Same issue for me. I am on 3.3.6.0 , not 3.3.6.1 and on xp sp3
pierrotm777 Posted August 6, 2010 Posted August 6, 2010 (edited) Is it possible to have the album art with a better quality please ? Humm !!! I have adapted your script for a frontend (RideRunner): http://www.mp3car.com/vbulletin/rr-plugins/143033-top-100-webradio-riderunner.html#post1403222 Edited August 6, 2010 by pierrotm777
wakillon Posted August 7, 2010 Author Posted August 7, 2010 (edited) Same issue for me.I am on 3.3.6.0 , not 3.3.6.1 and on xp sp3I'have tried on 3 other PC on xp sp3 too, and it works fine...Can you tried with another ?Is it possible to have the album art with a better quality please ? Humm !!!I have adapted your script for a frontend (RideRunner):http://www.mp3car.com/vbulletin/rr-plugi...100-webradio-riderunner.html#post1403222Ok it's seems to be nicer but i don't succeed to make it to work !After RideRunner installed i start it and i get :RideRunnerScreen Loading Error!while Loading WebRadioSelectType.skinWebRadioSelectType.skin not foundAutoIt ErrorLine 12671 (File "WebRadio.exe"):Error: The requested action with this object has failed.So I copy this filesSkin\WebRadio.skinSkin\WebRadio_Down.pngSkin\WebRadio_Off.pngSkin\WebRadio_On.pngSkin\WebRadioSelectType.skinSkin\WebRadioSelectType_Off.pngSkin\WebRadioSelectType_On.pngto @ProgramFilesDir & '\RideRunner\Skins\Carwings_Dynamic_LiteBut new errorAutoIt ErrorLine 12837 (File "WebRadio.exe"):Error: Variable used without being declared.I Retry and get new error !AutoIt ErrorLine 12685 (File "C:\...\WebRadio_0-3\WebRadio.exe"):Error: Array variable has incorrect number of subscripts or subscript dimension range exceeded.So I can't test it ! But it's possible to have the single art with a better quality with the website http://www.chartstats.com/chart.php where thumbnails are better ! But Only one genre is enable... Edited August 10, 2010 by wakillon AutoIt 3.3.18.0 X86 - SciTE 5.5.7 - WIN 11 24H2 X64 - Other Examples Scripts
pierrotm777 Posted August 9, 2010 Posted August 9, 2010 I'have tried on 3 other PC on xp sp3 too, and it works fine... Can you tried with another ? Ok it's seems to be nicer but i don't succeed to make it to work ! After RideRunner installed i start it and i get : RideRunner Screen Loading Error! while Loading WebRadioSelectType.skin WebRadioSelectType.skin not found AutoIt Error Line 12671 (File "WebRadio.exe"): Error: The requested action with this object has failed. So I copy this files Skin\WebRadio.skin Skin\WebRadio_Down.png Skin\WebRadio_Off.png Skin\WebRadio_On.png Skin\WebRadioSelectType.skin Skin\WebRadioSelectType_Off.png Skin\WebRadioSelectType_On.png to @ProgramFilesDir & '\RideRunner\Skins\Carwings_Dynamic_Lite But new error AutoIt Error Line 12837 (File "WebRadio.exe"): Error: Variable used without being declared. I Retry and get new error ! AutoIt Error Line 12685 (File "C:\...\WebRadio_0-3\WebRadio.exe"): Error: Array variable has incorrect number of subscripts or subscript dimension range exceeded. So I can't test it ! But it's possible to have the single art with a better quality with the website http://www.chartstats.com/chart.php where thumbnails are better ! But Only one genre is enable... Before, Riderunner must to run alone .(a skin must to be defined). After , you must to copy all my files under the Carwings Dynamic lite folder
pierrotm777 Posted August 9, 2010 Posted August 9, 2010 Before, Riderunner must to run alone .(a skin must to be defined).After , you must to copy all my files under the Carwings Dynamic lite folderUnder the Carwings Dynamic Lite folder , you must to create a Scripts folder , create a WebRadio folder under the Scripts folder and put the webradio.exe and .ini file into this last folder !The files found under the skin folder must to copied into the Carwings Dynamic Lite folder .Now you must to create a specific button for the web radio in the main screen (menu.skin and menu2.skin), you must to do that into the exectbl.ini file:Unzip the zip file into the Carwings Dynamic Lite folder (save before the original exectbl.ini file).Now you can run Riderunner and see that a webradio button exist ExecTBL.zip
pierrotm777 Posted August 9, 2010 Posted August 9, 2010 (edited) With the 0.6 version , if the rabdom mod is disabled , i can to select into the array a song , but the song played is not stopped and the file selected is not launched. See the jpg! This is the Top N° who are not updated but now the file selected is ok Edited August 9, 2010 by pierrotm777
wakillon Posted August 9, 2010 Author Posted August 9, 2010 (edited) With the 0.6 version , if the rabdom mod is disabled , i can to select into the array a song , but the song played is not stopped and the file selected is not launched.See the jpg!This is the Top N° who are not updated but now the file selected is okHi pierrotm777, what's the weather to Bordeaux ? So, you are right for this bugs and I update the previous download link."Disable random mode" button will be disable until "iecreate", like that we can "iequit" by the random button !Number of hits is now good.I' ll try your webradio instructions tomorrow.Do you find Singles cover are nicer ? Tomorrow I open a new topic with my TinyYoutubeJukebox ( video ) Edited August 9, 2010 by wakillon AutoIt 3.3.18.0 X86 - SciTE 5.5.7 - WIN 11 24H2 X64 - Other Examples Scripts
pierrotm777 Posted August 10, 2010 Posted August 10, 2010 Hi pierrotm777, what's the weather to Bordeaux ? So, you are right for this bugs and I update the previous download link."Disable random mode" button will be disable until "iecreate", like that we can "iequit" by the random button !Number of hits is now good.I' ll try your webradio instructions tomorrow.Do you find Singles cover are nicer ? Tomorrow I open a new topic with my TinyYoutubeJukebox ( video ) Cool idea this TinyYoutubeJukebox !You link is dead !
wakillon Posted August 10, 2010 Author Posted August 10, 2010 (edited) Cool idea this TinyYoutubeJukebox ! You link is dead ! Thanks ! Sorry I tried it yet, and it worked I add a new working link... expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_icon=Radio.ico #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #cs ----------------------------------------------------------------------------------------------------------- AutoIt Version : 3.3.6.1 Author : Wakillon Title : TinyUKChartsStreamPlayer Script Fonction : Listen Last 100 Uk Top Charts singles like a radio in random order and without advertising by getting charts List on charts website and search song's list on youtube. _ ESC for Quit _ WebSite http://www.chartstats.com/chart.php is updated weekly #ce ----------------------------------------------------------------------------------------------------------- #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <GUIConstantsEx.au3> #include <GUIStatusBar.au3> #Include <GuiListView.au3> #include <String.au3> #include <File.au3> #include <Misc.au3> #include <Date.au3> #include <IE.au3> HotKeySet ( "{ESC}", "_Terminate" ) If Not _Singleton ( @ScriptName, 1 ) Then Exit Dim $Sec, $Min, $Hour, $Time, $_ButtonWidth = 120, $_X=368, $_PicSize=120, $_Spaces=' ' Dim $_Text= @Crlf & $_Spaces & '_ ESC for Quit' Dim $_DurationDiff, $_DurationMs, $_GetItem, $_RandomMode=1, $oIE, $_PicPathOld Dim $_Key = "HKEY_LOCAL_MACHINE\SOFTWARE\TinyUKChartsStreamPlayer" Dim $_RegKeySettings = "HKEY_CURRENT_USER\Software\TinyUKChartsStreamPlayer\Settings" Global $_LastUkTopChartsListArray[1], $_ImagesUrlArray[1], $_RandomArray[1], $_DurationArray[1] Global $_Duration, $_UpDateDate, $_LastChartPageSourceCode, $_Invert=True, $_InvertTimerInit=TimerInit ( ), $_StatusBar, $_Loop=0 Global $_StatusParts[1] = [500], $_TempStatus[1] = [""] Global $__SLIDE_aGUI[1][5] = [["Winhandle", "sSide", "sState", "locked", "OnHover"]] Global $__SLIDE_hDLL = DllOpen ( "user32.dll" ) $_RegReadFirstStart = RegRead ( $_RegKeySettings, "FirstStart" ) If $_RegReadFirstStart ='' Then DirRemove ( @TempDir & '\Pics', 1 ) RegDelete ( "HKEY_LOCAL_MACHINE\SOFTWARE\TinyUKChartsStreamPlayer\Singles-Chartstats" ) EndIf Opt ( "TrayMenuMode", 1 ) TraySetIcon ( "Shell32.dll", -129 ) TraySetToolTip ( " TinyUKChartsStreamPlayer" & @Crlf & StringStripWS ( $_Text, 7 ) ) TraySetState ( 4 ) AdlibRegister ( "__Slide_CheckHover", 100 ) OnAutoItExitRegister ( "_OnAutoItExit" ) Do Sleep ( 1000 ) ToolTip ( $_Spaces & 'Waiting for Internet connection', @DesktopWidth/2-100, 0, 'Tiny UK Charts Stream Player', 1, 4 ) Until _IsConnected ( ) ToolTip ( '' ) $_SubKey = 'Singles-Chartstats' $_LastChartsUrl = 'http://www.chartstats.com/chart.php' $_UpdateDate = _GetUpdateDate ( $_LastChartsUrl ) $_RegUpdateDate = RegRead ( $_Key & '\' & $_SubKey, 'UpdateDate' ) If $_UpdateDate <> $_RegUpdateDate Then ToolTip ( $_Spaces & 'Searching Last 100 Uk Top Charts List...' & @Crlf & @Crlf & $_Text, @DesktopWidth/2-100, 0, 'Tiny UK Charts Stream Player', 1, 4 ) RegDelete ( $_Key & '\' & $_SubKey ) $_LastUkTopChartsListArray = _GetLastUkTopChartsListArray ( $_LastChartPageSourceCode ) ToolTip ( '' ) Else For $_J = 1 To 100 $_Value = RegEnumVal ( $_Key & '\' & $_SubKey, $_J ) If @error <> 0 Then ExitLoop If StringInStr ( $_Value, 'UpdateDate' ) = 0 Then $_RegRead = RegRead ( $_Key & '\' & $_SubKey, $_Value ) _ArrayAdd ( $_LastUkTopChartsListArray, $_RegRead ) EndIf Next EndIf If Not FileExists ( @TempDir & '\Pics' ) Then DirCreate ( @TempDir & '\Pics' ) $_LastUkTopChartsListArray[0] = UBound ( $_LastUkTopChartsListArray )-1 If _IsArrayEmpty ( $_LastUkTopChartsListArray ) Then Exit MsgBox ( 0, 'Error', 'Sorry Uk Top Charts List Not Found !', 5 ) _GetPics ( $_ImagesUrlArray ) Dim $_ListViewItem[$_LastUkTopChartsListArray[0]+1] Dim $_GuiTitle='Tiny UK ' & $_SubKey & ' Stream Player ' & $_UpDateDate Opt ( "GuiOnEventMode", 1 ) $_Gui = GUICreate ( $_GuiTitle, 500, 330, @DesktopWidth-507, @DesktopHeight - 360, -1, BitOR ( $WS_EX_LAYERED, $WS_EX_TOOLWINDOW ) ) GUISetBkColor ( 0xFFD900 ) GUISetIcon ( "Shell32.dll", -129 ) GUISetOnEvent ( $GUI_EVENT_CLOSE, "_Terminate" ) $_ListView = GUICtrlCreateListView ( "Top Nb|Title - Artist", 15, 20, 340, 260 ) _GUICtrlListView_SetColumnWidth ( $_ListView, 1, $LVSCW_AUTOSIZE_USEHEADER ) For $_G = 1 To UBound ( $_LastUkTopChartsListArray ) - 1 $_ListViewItem[$_G] = GUICtrlCreateListViewItem ( StringFormat ( "%02i", $_G ) & "|" & $_LastUkTopChartsListArray[$_G], $_ListView ) Next $_RandomButton = GUICtrlCreateButton ( "Disable Random Mode", $_X, 149, $_ButtonWidth, 24 ) GUICtrlSetOnEvent ( $_RandomButton, "_RandomMode" ) GUICtrlSetBkColor ( $_RandomButton, 0xFF0000 ) GUICtrlSetColor ( $_RandomButton, 0xFFFF00 ) GUICtrlSetState ( $_RandomButton, $GUI_DISABLE ) $_NextButton = GUICtrlCreateButton ( "Next Random Song", $_X, 185, $_ButtonWidth, 24 ) GUICtrlSetOnEvent ( $_NextButton, "_NextSong" ) $_SelectButton = GUICtrlCreateButton ( "Listen Selected Song", $_X, 221, $_ButtonWidth, 24 ) GUICtrlSetOnEvent ( $_SelectButton, "_SelectSong" ) GUICtrlSetBkColor ( $_SelectButton, 0xFFFF00 ) GUICtrlSetColor ( $_SelectButton, 0xff0000 ) GUICtrlSetState ( $_SelectButton, $GUI_DISABLE ) $_ExitButton = GUICtrlCreateButton ( "Exit", $_X, 257, $_ButtonWidth, 24 ) GUICtrlSetOnEvent ( $_ExitButton, "_Terminate" ) $_Pic = GUICtrlCreatePic ( @ProgramFilesDir & "\AutoIt3\Examples\GUI\merlin.gif", $_X, 20, $_PicSize, $_PicSize, BitOR ( $SS_Notify, $WS_GROUP, $WS_CLIPSIBLINGS ) ) $_StatusBar = _GUICtrlStatusBar_Create ( $_Gui, $_StatusParts, $_TempStatus, $SBARS_SIZEGRIP ) _GUICtrlStatusBar_SetMinHeight ( $_StatusBar, 40 ) $_Icons = _WinAPI_LoadShell32Icon ( 128 ) _GUICtrlStatusBar_SetIcon ( $_StatusBar, 0, $_Icons ) _Slide_WinSetSlide ( $_Gui, "top" ) _Slide_SlideSetOnHover ( $_Gui ) GUISetState ( @SW_SHOW ) While 1 If $_RandomMode Then $_R = _Randomize ( $_LastUkTopChartsListArray[0] ) $_Text2 = $_LastUkTopChartsListArray[$_R] _GUICtrlStatusBar_SetText ( $_StatusBar, $_Spaces & ' Waiting for Next Song...', 0 ) $_YoutubeSearch = _YoutubeSearch ( $_LastUkTopChartsListArray[$_R] & ' official' ) If StringInStr ( $_YoutubeSearch, 'http://www.youtube.com/watch?v' ) <> 0 Then $_Loop=1 $oIE = _IECreate ( $_YoutubeSearch, 0, 0, 1 ) $_DurationInit = TimerInit ( ) $_DurationDiff=0 GUICtrlSetState ( $_RandomButton, $GUI_ENABLE ) $_PicPath = @TempDir & '\Pics\' & $_LastUkTopChartsListArray[$_R] & '.jpg' GUICtrlSetState ( $_Pic, $GUI_HIDE ) If FileExists ( $_PicPath ) Then $_Pic = GUICtrlCreatePic ( $_PicPath, $_X, 20, $_PicSize, $_PicSize, BitOR ( $SS_Notify, $WS_GROUP, $WS_CLIPSIBLINGS ) ) Else $_Pic = GUICtrlCreatePic ( @ProgramFilesDir & "\AutoIt3\Examples\GUI\merlin.gif", $_X, 20, $_PicSize, $_PicSize, BitOR ( $SS_Notify, $WS_GROUP, $WS_CLIPSIBLINGS ) ) EndIf DLLCall ( "user32.dll", "int", "InvalidateRect", "hwnd", $_Gui, "int", 0, "int", 0 ) _WinSetOnTopOneTime ( $_GuiTitle ) Else _GUICtrlStatusBar_SetText ( $_StatusBar, $_Spaces & 'Top N°' & $_R & ' - ' & $_LastUkTopChartsListArray[$_R] & @Crlf & 'Music Not Found !', 0 ) _WinSetOnTopOneTime ( $_GuiTitle ) Sleep ( 2000 ) EndIf EndIf $_PicPath = @TempDir & '\Pics\' & $_Text2 & '.jpg' If $_PicPath <> $_PicPathOld Then GUICtrlSetState ( $_Pic, $GUI_HIDE ) If FileExists ( $_PicPath ) Then $_Pic = GUICtrlCreatePic ( $_PicPath, $_X, 20, $_PicSize, $_PicSize, BitOR ( $SS_Notify, $WS_GROUP, $WS_CLIPSIBLINGS ) ) $_PicPathOld = $_PicPath $_PicPath='' EndIf If _EachXseconds ( 1.5 ) Then _InvertColorButton ( $_RandomButton ) While $_Loop If $_DurationDiff > $_DurationMs Then _IEQuit ( $oIE ) $_Loop =0 _GUICtrlStatusBar_SetText ( $_StatusBar, '', 0 ) ExitLoop EndIf Sleep ( 20 ) If _EachXseconds ( 1.5 ) Then _InvertColorButton ( $_RandomButton ) $_DurationMs = $_Duration * 1000 If $_Duration Then $_DurationDiff = Round ( TimerDiff ( $_DurationInit ) ) _TicksToTime ( $_DurationMs - $_DurationDiff, $Hour, $Min, $Sec ) If $_Text2 Then _GUICtrlStatusBar_SetText ( $_StatusBar, $_Spaces & 'Top N°' & $_R & ' - ' & $_Text2 & ' - ' & StringFormat ( "%02i:%02i", $Min, $Sec ), 0 ) WEnd WEnd Func _GetPics ( $_PicsArray ) For $_P = 1 To UBound ( $_PicsArray ) -1 $_PicPath = @TempDir & '\Pics\' & $_LastUkTopChartsListArray[$_P] & '.jpg' If Not FileExists ( $_PicPath ) Then InetGet ( $_PicsArray[$_P], $_PicPath, 1, 1 ) If Not FileExists ( $_PicPath ) Then FileCopy ( @ProgramFilesDir & "\AutoIt3\Examples\GUI\merlin.gif", $_PicPath ) EndIf Next EndFunc ;==> _GetPics ( ) Func _SelectSong ( ) If $_Loop Then _IEQuit ( $oIE ) $_GetItem = _GetItem ( ) If $_GetItem Then _GUICtrlStatusBar_SetText ( $_StatusBar, $_Spaces & 'Waiting for Next Song...', 0 ) $_YoutubeSearch = _YoutubeSearch ( $_GetItem & ' official' ) $oIE = _IECreate ( $_YoutubeSearch, 0, 0, 1 ) $_DurationInit = TimerInit ( ) $_DurationDiff=0 $_PicPath = @TempDir & '\Pics\' & $_GetItem & '.jpg' If FileExists ( $_PicPath ) Then GUICtrlSetState ( $_Pic, $GUI_HIDE ) $_Pic = GUICtrlCreatePic ( $_PicPath, $_X, 20, $_PicSize, $_PicSize, BitOR ( $SS_Notify, $WS_GROUP, $WS_CLIPSIBLINGS ) ) EndIf $_Text2 = $_GetItem $_Loop =1 EndIf EndFunc ;==> _SelectSong ( ) Func _RandomMode ( ) If $_Loop Then _IEQuit ( $oIE ) $_Loop =0 _GUICtrlStatusBar_SetText ( $_StatusBar, '', 0 ) GUICtrlSetState ( $_RandomButton, $GUI_HIDE ) If $_RandomMode = 1 Then $_RandomMode=0 GUICtrlSetState ( $_SelectButton, $GUI_ENABLE ) GUICtrlSetState ( $_NextButton, $GUI_DISABLE ) $_RandomButton = GUICtrlCreateButton ( "Enable Random Mode", $_X, 149, $_ButtonWidth, 24 ) Else $_RandomMode = 1 GUICtrlSetState ( $_SelectButton, $GUI_DISABLE ) GUICtrlSetState ( $_NextButton, $GUI_ENABLE ) $_RandomButton = GUICtrlCreateButton ( "Disable Random Mode", $_X, 149, $_ButtonWidth, 24 ) EndIf $_Text2='' GUICtrlSetBkColor ( $_RandomButton, 0xFF0000 ) GUICtrlSetColor ( $_RandomButton, 0xFFFF00 ) GUICtrlSetOnEvent ( $_RandomButton, "_RandomMode" ) EndFunc ;==> _RandomMode ( ) Func _NextSong ( ) _IEQuit ( $oIE ) $_Loop=0 _GUICtrlStatusBar_SetText ( $_StatusBar, '', 0 ) EndFunc ;==> _NextSong ( ) Func _InvertColorButton ( $_GuiCtrl ) If $_Invert Then GUICtrlSetBkColor ( $_GuiCtrl, 0xFF0000 ) GUICtrlSetColor ( $_GuiCtrl, 0xFFFF00 ) $_Invert=False Else GUICtrlSetBkColor ( $_GuiCtrl, 0xFFFF00 ) GUICtrlSetColor ( $_GuiCtrl, 0xFF0000 ) $_Invert=True EndIf EndFunc ;==> _InvertColorButton ( ) Func _EachXseconds ( $_Interval ) $_TimerDiff = Round ( TimerDiff ( $_InvertTimerInit )/ 1000 ) If $_TimerDiff >= $_Interval Then $_InvertTimerInit = TimerInit ( ) Return 1 Else Return 0 EndIf EndFunc ;==> _EachXseconds ( ) Func _GetItem ( ) $_Select = GUICtrlRead ( GUICtrlRead ( $_ListView ) ) If $_Select Then $_SelectSplit = StringSplit ( $_Select, '|' ) If Not @error Then $_R=$_SelectSplit[1] $_Select = $_SelectSplit[2] If $_Select Then Return $_Select EndIf EndIf EndFunc ;==> _GetItem ( ) Func _GetUpdateDate ( $_LastChartsUrl ) Local $_UpDateDate $_LastChartPageSourceCode = _GetSourceCode ( $_LastChartsUrl ) $_UpDateDate = _StringBetween ( $_LastChartPageSourceCode, '<title>Chart Stats - Singles Chart For ', "<" ) If Not @error Then $_UpDateDate = '( Week of ' & StringStripWS ( $_UpDateDate[0], 7 ) & ' )' Return $_UpDateDate EndFunc ;==> _GetUpdateDate ( ) Func _GetLastUkTopChartsListArray ( $_SourceCode ) Local $_NamesArray[1], $_Add $_SourceCodeSplitArray = StringSplit ( $_SourceCode, @CRLF ) For $_I = 1 To UBound ( $_SourceCodeSplitArray ) -1 If StringInStr ( $_SourceCodeSplitArray[$_I], ';padding:none">' ) <> 0 Then $_String = $_SourceCodeSplitArray[$_I] ExitLoop EndIf Next $_StringInstrArrayOfLine = _StringInstrArrayOfLine ( $_String, ';padding:none"' ); $_StringBetweenArrayByStringInstrArray = _StringBetweenArrayByStringInstrArray ( $_String, $_StringInstrArrayOfLine, 'href="', '" width' ) For $_I = 1 To UBound ( $_StringBetweenArrayByStringInstrArray ) -1 $_StringBetween = _StringBetween ( $_StringBetweenArrayByStringInstrArray[$_I], 'img src="', '"' ) If Not @error Then If StringInStr ( $_StringBetweenArrayByStringInstrArray[$_I], 'artistinfo.php?id=' ) = 0 Then _ArrayAdd ( $_ImagesUrlArray, 'http://www.chartstats.com/' & $_StringBetween[0] ) Else _ArrayAdd ( $_ImagesUrlArray, '' ) EndIf EndIf $_StringBetween = _StringBetween ( $_StringBetweenArrayByStringInstrArray[$_I], 'title="', '' ) If Not @error Then If StringInStr ( $_StringBetweenArrayByStringInstrArray[$_I], 'artistinfo.php?id=' ) = 0 Then $_Name = _CleanHtmlName ( _CleanVideoName ( $_StringBetween[0] ) ) _ArrayAdd ( $_NamesArray, $_Name ) $_Add = $_Add + 1 RegWrite ( $_Key & '\' & $_SubKey, StringFormat ( "%03i", $_Add ), "REG_SZ", $_Name ) Else $_StringBetween = _StringBetween ( $_StringBetweenArrayByStringInstrArray[$_I], '">', '</a></td' ) If Not @error Then $_Remove = _StringBetween ( $_StringBetween[0], '</a>', '">' ) $_Name = _CleanHtmlName ( _CleanVideoName ( StringReplace ( $_StringBetween[0], '</a>' & $_Remove[0] & '">', ' - ' ) ) ) _ArrayAdd ( $_NamesArray, $_Name ) $_Add = $_Add + 1 RegWrite ( $_Key & '\' & $_SubKey, StringFormat ( "%03i", $_Add ), "REG_SZ", $_Name ) EndIf EndIf EndIf Next $_ImagesUrlArray[0]=UBound ( $_ImagesUrlArray ) -1 $_NamesArray[0]=UBound ( $_NamesArray ) -1 RegWrite ( $_Key & '\' & $_SubKey, 'UpdateDate', "REG_SZ", $_UpdateDate ) Return $_NamesArray EndFunc ;==> _GetLastUkTopChartsListArray ( ) Func _YoutubeSearch ( $_Query ) Dim $_WordOfQuery[1] $_QuerySplit = StringSplit ( StringStripWS ( StringRegExpReplace ( StringReplace ( StringReplace ( $_Query, 'è', 'e' ), 'é', 'e' ), "\W", " " ) , 7 ), ' ' ) For $_I = 1 To UBound ( $_QuerySplit ) - 1 If StringLen ( $_QuerySplit[$_I] ) > 1 Then _ArrayAdd ( $_WordOfQuery, StringReplace ( $_QuerySplit[$_I], ',', ' ' ) ) Next $_WordOfQuery[0] = UBound ( $_WordOfQuery ) - 1 $_Query = StringReplace ( $_Query, " ", "+" ) $_Query = StringReplace ( StringReplace ( StringReplace ( StringReplace ( StringReplace ( StringReplace ( StringReplace ( StringReplace _ ( StringReplace ( StringStripWS ( $_Query, 7 ), ',', '%2C' ), '&', '%26' ), '(', '%28' ), ')', '%29' ), "'", '%27' ), 'è', 'e' ), 'é', 'e' ), '«', ' ' ), '»', ' ' ) $_SourceCode = _GetSourceCode ( "http://www.youtube.com/results?search_query=" & $_Query ) $_SourceCodeSplit = StringSplit ( $_SourceCode, @CRLF ) Dim $_Watch[1], $_DurationArray[1] For $_I = 1 To UBound ( $_SourceCodeSplit )-1 If StringInStr ( $_SourceCodeSplit[$_I], '/watch?v=' ) <> 0 And StringInStr ( $_SourceCodeSplit[$_I], 'video-long-title' ) <> 0 Then _ArrayAdd ( $_Watch, $_SourceCodeSplit[$_I] ) If StringInStr ( $_SourceCodeSplit[$_I-17], 'video-time">' ) <> 0 Then $_VideoTime = _StringBetween ( $_SourceCodeSplit[$_I-17], 'video-time">', '<' ) If Not @error Then $_DurationSplit = StringSplit ( $_VideoTime[0], ':' ) $_DurationSplit[0]=UBound ( $_DurationSplit ) -1 $_Duration = $_DurationSplit[1]*60 + $_DurationSplit[$_DurationSplit[0]] _ArrayAdd ( $_DurationArray, $_Duration ) Else _ArrayAdd ( $_DurationArray, 240 ) EndIf Else _ArrayAdd ( $_DurationArray, 240 ) EndIf EndIf Next For $_I = 1 To UBound ( $_Watch )-1 $Titles = _StringBetween ( $_Watch[$_I], 'title="', '" rel=' ) If Not @error Then If Not _OneOfThisStringInStr ( $Titles[0], 'Karaok|Singing|parod|Fête' ) Then $Link = _StringBetween ( $_Watch[$_I], 'href="', '"' ) If Not @error Then If StringInStr ( $Link[0], 'http://www.youtube.com' ) = 0 Then $_UrlToExtract = "http://www.youtube.com" & $Link[0] Else $_UrlToExtract = $Link[0] EndIf $_Duration = $_DurationArray[$_I] Return $_UrlToExtract EndIf EndIf EndIf Next Endfunc ;==> _YoutubeSearch ( ) Func _OneOfThisStringInStr ( $_InStr, $_String ) $_StringArray = StringSplit ( $_String, '|' ) If @error Then Return 0 For $_I = 1 To UBound ( $_StringArray ) -1 $_StringInStr = StringInStr ( $_InStr, $_StringArray[$_I] ) If $_StringInStr <> 0 Then Return 1 Next Return 0 EndFunc ;==> _OneOfThisStringInStr ( ) Func _StringBetweenArrayByStringInstrArray ( $_String, $_StringInStrArray, $_Start, $_End ) Dim $_ArrayAdd[1] For $_I = 1 To UBound ( $_StringInStrArray ) -1 $_StringRight = StringRight ( $_String, StringLen ( $_String ) - $_StringInStrArray[$_I] +1 ) Local $_StringBetween = _StringBetween ( $_StringRight, $_Start, $_End ) If Not @error Then _ArrayAdd ( $_ArrayAdd, $_StringBetween[0] ) Next Return $_ArrayAdd EndFunc ;==> _StringBetweenArrayByStringInstrArray ( ) Func _StringInstrArrayOfLine( $_String, $_StringToFind ) Dim $_ArrayAdd[1] For $_I = 1 To StringLen ( $_String ) $_StringInStr = StringInStr ( $_String, $_StringToFind, 0, $_I ) If $_StringInStr = 0 Then $_ArrayAdd[0] = UBound ( $_ArrayAdd ) -1 Return $_ArrayAdd Else _ArrayAdd ( $_ArrayAdd, $_StringInStr ) EndIf Next EndFunc ;==> _StringInstrArrayOfLine( ) Func _CleanVideoName ( $_Name ) $_Name2 = StringRegExpReplace ( $_Name, '(")|(")|(quot;)|(&)|(amp;)|(<)|(lt;)|(>)|(gt;)|(#39;)', '' ) $_Name2 = StringReplace ( $_Name2, 'ç', 'c' ) $_Name2 = StringReplace ( $_Name2, 'ß', 'ss' ) $_Name2 = StringReplace ( $_Name2, '€', '€' ) $_Name2 = StringRegExpReplace ( $_Name2, '(à )|(â)|(ä)|(À)|(ã)|(á)|(Ã¥)', 'a' ) $_Name2 = StringRegExpReplace ( $_Name2, '(Ú)|(ê)|(é)|(è)|(ë)', 'e' ) $_Name2 = StringRegExpReplace ( $_Name2, '(ï)|(î)|(Ã)', 'i' ) $_Name2 = StringRegExpReplace ( $_Name2, '(ÃŽ)|(ö)|(ó)|(ô)', 'o' ) $_Name2 = StringRegExpReplace ( $_Name2, '(û)|(ü)|(ù)|(ÃŒ)|(ú)', 'u' ) $_Name2 = StringReplace ( $_Name2, 'Ã', 'a' ) $_Name2 = StringReplace ( $_Name2, '\', '' ) $_Name2 = StringRegExpReplace ( $_Name2, "[|!?_*~´’'`³¹¼¯,]", ' ' ) $_Name2 = StringRegExpReplace ( $_Name2, '[âªâ™«»¥¶£¢€¡†Ø§³ÙŠšØ¹±ª#®¤©‰¨¹¬·/;:"]', '' ) Return _StringProper ( StringStripWS ( _CleanHtmlName ( $_Name2 ), 7 ) ) EndFunc ;==> _CleanVideoName ( ) Func _CleanHtmlName ( $_Name ) $_Name2 = StringReplace ( $_Name, '%2C', ',' ) $_Name2 = StringReplace ( $_Name2, '%82', ',' ) $_Name2 = StringReplace ( $_Name2, '%27', "'" ) $_Name2 = StringReplace ( $_Name2, '&039', "'" ) Return $_Name2 EndFunc ;==> _CleanHtmlName ( ) Func _Randomize ( $_Max=100 ) Do $_Random = Random ( 1, $_Max, 1 ) Until Not _AlreadyInArray ( $_RandomArray, $_Random ) _ArrayAdd ( $_RandomArray, $_Random ) $_RandomArray[0] = UBound ( $_RandomArray ) -1 If $_RandomArray[0] >= $_Max Then ReDim $_RandomArray[1] Return $_Random EndFunc ;==> _Randomize ( ) Func _AlreadyInArray ( $_SearchArray, $_Item ) $_Index = _ArraySearch ( $_SearchArray, $_Item ) If @error Then Return False Else If $_Index <> 0 Then Return True Else Return False EndIf EndIf EndFunc ;==> _AlreadyInArray ( ) Func _GetSourceCode ( $_Url ) $_InetRead = InetRead ( $_Url ) If Not @Error Then $_BinaryToString = BinaryToString ( $_InetRead ) If Not @Error Then Return $_BinaryToString EndIf EndFunc ;==> _GetSourceCode ( ) Func _IsArrayEmpty ( $_EmptyArray ) Local $_V = UBound ( $_EmptyArray ) -1, $_P If $_V = 0 Then Return True For $_F = 1 To $_V If $_EmptyArray[$_F] = '' Then $_P = $_P + 1 Next If $_P = $_V Then Return True Else Return False EndIf EndFunc ;==> _IsArrayEmpty ( ) Func _IsConnected ( ) $_SrcFilePath = _TempFile ( @TempDir & "\", '~google_', ".src", 7 ) Local $IsConnected = InetGet ( "http://www.google.com", $_SrcFilePath, 1, 1 ) Local $_Info Do $_Info = InetGetInfo ( $IsConnected ) Sleep ( 50 ) Until $_Info[2] = True InetClose ( $IsConnected ) _Delete ( $_SrcFilePath ) If $_Info[3] <> True Then Return 0 Else Return 1 EndIf EndFunc ;==> _IsConnected ( ) Func _IsValidUrl ( $_IsValidUrl ) $_Size = InetGetSize ( $_IsValidUrl ) If $_Size <> 0 Then Return 1 Endfunc ;==> _IsValidUrl ( ) Func _Delete ( $_FullPath ) $_DeleteInit = TimerInit ( ) While FileExists ( $_FullPath ) If StringInStr ( FileGetAttrib ( $_FullPath ), "D" ) Then DirRemove ( $_FullPath, 1 ) Else FileDelete ( $_FullPath ) EndIf If TimerDiff ( $_DeleteInit ) > 5000 Then Return 0 WEnd Return 1 EndFunc ;==> _Delete ( ) Func _WinSetOnTopOneTime ( $_WinTitle ) WinWait ( $_WinTitle, "", 2 ) WinSetOnTop ( $_WinTitle, "", 1 ) Sleep ( 250 ) WinSetOnTop ( $_WinTitle, "", 0 ) WinActivate ( $_WinTitle, "" ) EndFunc ;==> _WinSetOnTopOneTime ( ) Func _Slide_WinSetSlide ( $hWnd, $sSide, $iMode = 1 ) If Not IsHWnd ( $hWnd ) Then $hWnd = WinGetHandle ( $hWnd ) If @error Then Return SetError ( 1, 0, 0 ) If $iMode > 1 Or $iMode < 0 Then Return SetError ( 1, 0, 0 ) If Not StringRegExp ( $sSide, "(?i)(left|right|top|bottom)" ) Then Return SetError ( 1, 0, 0 ) $iUbound = UBound ( $__SLIDE_aGUI ) Switch $iMode Case 1 ReDim $__SLIDE_aGUI[$iUbound + 1][5] $__SLIDE_aGUI[$iUbound][0] = $hWnd $__SLIDE_aGUI[$iUbound][1] = $sSide $__SLIDE_aGUI[$iUbound][2] = True $__SLIDE_aGUI[$iUbound][3] = False $__SLIDE_aGUI[$iUbound][4] = False _Slide_SlideOut ( $hWnd ) GUISetState ( @SW_SHOWNOACTIVATE, $hWnd ) Case 0 For $i = 1 To UBound ( $__SLIDE_aGUI ) - 1 If $__SLIDE_aGUI[$i][0] = $hWnd Then For $j = $i To UBound($__SLIDE_aGUI) - 2 $__SLIDE_aGUI[$j][0] = $__SLIDE_aGUI[$j + 1][0] $__SLIDE_aGUI[$j][1] = $__SLIDE_aGUI[$j + 1][1] $__SLIDE_aGUI[$j][2] = $__SLIDE_aGUI[$j + 1][2] $__SLIDE_aGUI[$j][3] = $__SLIDE_aGUI[$j + 1][3] $__SLIDE_aGUI[$j][4] = $__SLIDE_aGUI[$j + 1][4] ReDim $__SLIDE_aGUI[UBound ( $__SLIDE_aGUI ) - 1][5] _Slide_SlideIn ( $hWnd ) GUISetState ( @SW_HIDE, $hWnd ) Next EndIf Next EndSwitch EndFunc ;==> _Slide_WinSetSlide ( ) Func _Slide_SlideSetOnHover ( $hWnd, $sMode = True ) If Not IsHWnd ( $hWnd ) Then $hWnd = WinGetHandle ( $hWnd ) If @error Then Return SetError ( 1, 0, 0 ) $iUbound = UBound ( $__SLIDE_aGUI ) Switch $sMode Case True For $i = 1 To UBound ( $__SLIDE_aGUI ) - 1 If $__SLIDE_aGUI[$i][0] = $hWnd Then $__SLIDE_aGUI[$i][4] = True EndIf Next Case False For $i = 1 To UBound ( $__SLIDE_aGUI ) - 1 If $__SLIDE_aGUI[$i][0] = $hWnd Then $__SLIDE_aGUI[$i][4] = False EndIf Next EndSwitch EndFunc ;==> _Slide_SlideSetOnHover ( ) Func _Slide_SlideOut ( $hWnd ) If Not IsHWnd ( $hWnd ) Then $hWnd = WinGetHandle ( $hWnd ) If @error Then Return SetError ( 1, 0, 0 ) For $i = 1 To UBound ( $__SLIDE_aGUI ) - 1 If $__SLIDE_aGUI[$i][0] = $hWnd Then If $__SLIDE_aGUI[$i][2] Then __Slide_WinSlide ( $hWnd, "out", $__SLIDE_aGUI[$i][1] ) $__SLIDE_aGUI[$i][2] = False Return SetError ( 0, 0, 1 ) Else Return SetError ( 3, 0, 0 ) EndIf EndIf Next Return SetError ( 2, 0, 0 ) EndFunc ;==> _Slide_SlideOut ( ) Func _Slide_SlideIn ( $hWnd ) If Not IsHWnd ( $hWnd ) Then $hWnd = WinGetHandle ( $hWnd ) If @error Then Return SetError ( 1, 0, 0 ) For $i = 1 To UBound ( $__SLIDE_aGUI ) - 1 If $__SLIDE_aGUI[$i][0] = $hWnd Then If Not $__SLIDE_aGUI[$i][2] Then __Slide_WinSlide ( $hWnd, "in", $__SLIDE_aGUI[$i][1] ) $__SLIDE_aGUI[$i][2] = True Else Return SetError ( 3, 0, 0 ) EndIf EndIf Next Return SetError ( 2, 0, 0 ) EndFunc ;==> _Slide_SlideIn ( ) Func __Slide_WinSlide ( $hWnd, $sMode, $sSide ) Local $aScreen_Res = WinGetPos ( WinGetHandle ( "Program Manager" ) ) Local $aWPos = WinGetPos ( $hWnd ), $m = 0 - ( $sMode = "in" ) + ( $sMode = "out" ) Local $h = 0 - ( $sSide = "left" ) + ( $sSide = "right" ), $v = 0 - ( $sSide = "top" ) + ( $sSide = "bottom" ) WinMove ( $hWnd, "", $aScreen_Res[0] - ( ( $h = -1 ) * ( $m = -1 ) * ( $aWPos[2] - 10 ) ) _ + ( ( $h = 1 ) * ( ( $h = 1 ) * $aScreen_Res[2] - ( 10 * ( $m = -1 ) ) - ( $m <> -1 ) * $aWPos[2] ) ) _ + ( ( $h = 0 ) * ( ( $h = 0 ) * ( $aScreen_Res[2] / 2 ) - ( $aWPos[2] / 2 ) ) ) _ , $aScreen_Res[1] - ( ( $v = -1 ) * ( $m = -1 ) * ( $aWPos[3] - 10 ) ) _ + ( ( $v = 1 ) * ( ( $v = 1 ) * $aScreen_Res[3] - ( 10 * ( $m = -1 ) ) - ( $m <> -1 ) * $aWPos[3] ) ) _ + ( ( $v = 0 ) * ( ( $v = 0 ) * ( $aScreen_Res[3] / 2 ) - ($aWPos[3] / 2 ) ) ) ) $aWPos = WinGetPos ( $hWnd ) Switch $sSide Case "left", "right" Local $STEP = ( ( ( ( $h = 1 ) And ( $m = 1 ) ) Or ( ( $h = -1 ) And ( $m = -1 ) ) ) - ( ( ( $h = -1 ) And ( $m = 1 ) ) Or ( ( $h = 1 ) And ( $m = -1 ) ) ) ) * 10 Local $FROM = $aWPos[0], $TO = $aWPos[0] + ( ( ( ( $h = 1 ) And ( $m = 1 ) ) Or ( ( $h = -1 ) And ( $m = -1 ) ) ) * ( $aWPos[2] ) ) _ - ( ( ( ( $h = 1 ) And ( $m = -1 ) ) Or ( ( $h = -1 ) And ( $m = 1 ) ) ) * ( $aWPos[2] ) ) - $STEP For $i = $aWPos[0] To $TO Step $STEP WinMove ( $hWnd, "", $i, $aWPos[1] ) Sleep ( 10 ) Next Case "top", "bottom" Local $STEP = ( ( ( ( $v = 1 ) And ( $m = 1 ) ) Or ( ( $v = -1 ) And ( $m = -1 ) ) ) - ( ( ( $v = -1 ) And ( $m = 1 ) ) Or ( ( $v = 1 ) And ( $m = -1 ) ) ) ) * 10 Local $FROM = $aWPos[1], $TO = $aWPos[1] + ( ( ( ( $v = 1 ) And ( $m = 1 ) ) Or ( ( $v = -1 ) And ( $m = -1 ) ) ) * ( $aWPos[3] ) ) _ - ( ( ( ( $v = 1 ) And ( $m = -1 ) ) Or ( ( $v = -1 ) And ( $m = 1 ) ) ) * ( $aWPos[3] ) ) - $STEP If $STEP > 0 Then $TO = $TO -25 For $i = $aWPos[1] To $TO + 25 Step $STEP ; WinMove ( $hWnd, "", $aWPos[0], $i ) Sleep ( 10 ) Next EndSwitch EndFunc ;==> __Slide_WinSlide ( ) Func __Slide_CheckHover ( ) For $i = 1 To UBound ( $__SLIDE_aGUI ) - 1 If $__SLIDE_aGUI[$i][4] Then If Not $__SLIDE_aGUI[$i][3] Then If __Slide_WinIsHovered ( $__SLIDE_aGUI[$i][0] ) Then If Not $__SLIDE_aGUI[$i][2] Then _Slide_SlideIn ( $__SLIDE_aGUI[$i][0] ) Else If $__SLIDE_aGUI[$i][2] Then _Slide_SlideOut ( $__SLIDE_aGUI[$i][0] ) EndIf EndIf EndIf Next EndFunc ;==> __Slide_CheckHover ( ) Func __Slide_UnloadDLL ( ) DllClose ( $__SLIDE_hDLL ) EndFunc ;==> __Slide_UnloadDLL ( ) Func __Slide_WinIsHovered ( $hWnd, $vDLL = "User32.dll" ) Local $aResult, $aWPos = WinGetPos ( $hWnd ) If @error Then Return Local $aMPos = MouseGetPos ( ) If @error Then Return Local $tRect = DllStructCreate ( "int Left;int Top;int Right;int Bottom" ) Local $iLeft = $aWPos[0], $iTop = $aWPos[1], $iWidth = $aWPos[2], $iHeight = $aWPos[3] Local $iX = $aMPos[0], $iY = $aMPos[1] DllStructSetData ( $tRect, "Left", $iLeft ) DllStructSetData ( $tRect, "Top", $iTop ) DllStructSetData ( $tRect, "Right", $iLeft + $iWidth ) DllStructSetData ( $tRect, "Bottom", $iTop + $iHeight ) $aResult = DllCall ( $vDLL, "int", "PtInRect", "ptr", DllStructGetPtr ( $tRect ), "int", $iX, "int", $iY ) If @error Then Return SetError ( @error, 0, False ) Return $aResult[0] <> 0 EndFunc ;==> __Slide_WinIsHovered ( ) Func _Terminate ( ) RegWrite ( $_RegKeySettings, "FirstStart", "REG_SZ", 'done' ) _IEQuit ( $oIE ) Exit EndFunc ;==> _Terminate ( ) Func _OnAutoItExit ( ) Opt ( "TrayIconHide", 0 ) Local $_Space="" If @OSVersion = "WIN_XP" Then $_Space=" " TrayTip ( "TinyYoutubeJukebox", $_Space & "by wakillon...", 1, 1 ) Sleep ( 2000 ) TrayTip ( '', '', 1, 1 )EndFunc ;==> _OnAutoItExit ( ) Edited August 21, 2010 by wakillon AutoIt 3.3.18.0 X86 - SciTE 5.5.7 - WIN 11 24H2 X64 - Other Examples Scripts
pierrotm777 Posted August 10, 2010 Posted August 10, 2010 All is ok now ! I just regret the search by song's type who exist in the older version. For RideRunner , i need to create a list file (WebRadio.txt) with that i can to see in the list view. How can i write that please !
wakillon Posted August 10, 2010 Author Posted August 10, 2010 All is ok now ! I just regret the search by song's type who exist in the older version. For RideRunner , i need to create a list file (WebRadio.txt) with that i can to see in the list view. How can i write that please ! Like this ? $_LastUkTopChartsListArray = _GetLastUkTopChartsListArray ( $_LastChartPageSourceCode ) $_TxtFilePath = @TempDir & "\WebRadio.txt" _FileWriteFromArray ( $_TxtFilePath, $_LastUkTopChartsListArray, 1 ) ShellExecute ( $_TxtFilePath ) AutoIt 3.3.18.0 X86 - SciTE 5.5.7 - WIN 11 24H2 X64 - Other Examples Scripts
pierrotm777 Posted August 11, 2010 Posted August 11, 2010 Like this ? $_LastUkTopChartsListArray = _GetLastUkTopChartsListArray ( $_LastChartPageSourceCode ) $_TxtFilePath = @TempDir & "\WebRadio.txt" _FileWriteFromArray ( $_TxtFilePath, $_LastUkTopChartsListArray, 1 ) ShellExecute ( $_TxtFilePath ) Yes, it is exactly that i want , but if i can to have the in the beginning of each line the Number (0 to 100) please? 01 - Song Title - Songer Name 02 - Song2 Title - Songer2 Name 03 - Song3 Title - Songer3 Name Thanks Did you have tested RideRunner and WebRadio ?
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