1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
| Dim Sortie
Dim objExplorer
Dim READYSTATE_COMPLETE
READYSTATE_COMPLETE = 4
'-------------------------------------------------------------------------------
Function MusicAuHasard()
URL1 = "https://www.zeffyrmusic.com/top/1"'"http://URL/Music1.mp3"
URL2 = "https://www.zeffyrmusic.com/top/2"'"http://URL/Music2.mp3"
URL3 = "https://www.zeffyrmusic.com/top/3"'"http://URL/Music3.mp3"
URL4 = "https://www.zeffyrmusic.com/top/4"'"http://URL/Music4.mp3"
URL5 = "https://www.zeffyrmusic.com/top/5"'"http://URL/Music5.mp3"
URL6 = "https://www.zeffyrmusic.com/top/6"'"http://URL/Music6.mp3"
ListMusic = array(URL1,URL2,URL3,URL4,URL5,URL6)
Randomize
For i = 0 To UBound(ListMusic)
j = Int((UBound(ListMusic) - i + 1) * Rnd + i)
tmp = ListMusic(i)
ListMusic(i) = ListMusic(j)
ListMusic(j) = tmp
Next
MusicAuHasard=tmp
End Function
'-------------------------------------------------------------------------------
Dim TirageAlea
TirageAlea = MusicAuHasard()
'MsgBox TirageAlea,64,"Music au Hasard"
Set objExplorer = CreateObject("InternetExplorer.Application")
Sortie = DateAdd("S", 10, Now) 'ajoute de 10 Sc par apport à l'heure systeme
objExplorer.navigate TirageAlea 'pas de parametre supplementaire
Do
If Now >= Sortie Then Exit Do
Loop Until objExplorer.readyState = READYSTATE_COMPLETE
objExplorer.Visible=True
Set objExplorer = NotHing
If varType(objExplorer) = 9 Then
'msgbox "C'est bon"
Else
msgbox "Impossible d'ouvrir la page " & TirageAlea
End If |