
Je reviens avec un petit script, qui va vous permettre de decompresser après une rude journée.
C'est en fait un programme qui affiche des images dans un ordre aléatoire avec une musique de fond.
Voila le script:
Tab pour changer de Musique, Echap pour quitter:
Code : Tout sélectionner
#include <WindowsConstants.au3>
#include <Sound.au3>
#Include <File.au3>
#Include <Array.au3>
#Include <Misc.au3>
#include-once
Opt("OnExitFunc", "Fin")
HotKeySet("{ESC}", "Fin")
HotKeySet("{TAB}", "_PlayZik2")
; Répertoire des images et des MP3.
$RepMedia = @ScriptDir
$RepMedia2 = "E:\iPod_Control\Music\F02\"
Dim $hSound, $Tempo = 4000,$s = 1
$aImg = _FileListToArray($RepMedia, "*.jpg", 1)
$aZik = _FileListToArray($RepMedia, "*.mp3", 1)
$nb_image = $aImg[0]
_PlayZik()
$aImg = _ArrayRandom($aImg,0,$nb_image,100)
;MsgBox(0,"",$a)
$hGUI = GUICreate("", @DesktopWidth, @DesktopHeight, -1, -1, $WS_POPUP, $WS_EX_TOPMOST)
$Pic1 = GUICtrlCreatePic("", 0, 0, @DesktopWidth, @DesktopHeight)
GUISetState()
While 1
$s = $s + 1
If $s = $nb_image Then
$s = 1
$aImg = _ArrayRandom($aImg,0,$nb_image,100)
EndIf
; 4 secondes avant la fin de la musique, on change de musique.
If _SoundPos($hSound, 2) > _SoundLength($hSound, 2) - 400 Then _PlayZik()
If _IsPressed(01) Then
While _IsPressed(01)
Sleep(500)
WEnd
Sleep(1000)
While _IsPressed(01) = 0
Sleep(500)
If _SoundPos($hSound, 2) > _SoundLength($hSound, 2) - 400 Then _PlayZik()
WEnd
EndIf
; Affiche une image prise au hazard dans le tableau $aImg
GUICtrlSetImage($Pic1, $aImg[$s])
Sleep($Tempo)
WEnd
; Joue une musique pris au hazard dans le tableau $aZik
Func _PlayZik()
$hSound =_SoundOpen ($aZik[_Random(1,$aZik[0])])
_SoundSeek ($hSound, 0, 0, 2)
_SoundPlay ($hSound)
EndFunc
Func _PlayZik2()
_SoundClose($hSound)
$hSound =_SoundOpen ($aZik[_Random(1,$aZik[0])])
_SoundSeek ($hSound, 0, 0, 2)
_SoundPlay ($hSound)
EndFunc
; Petite fonction à cause d'un bug de Random (Random(1, 1, 1) => 0 !!!).
Func _Random($ValMin,$ValMax)
$Res = Random($ValMin, $ValMax, 1)
If $Res = 0 Then $Res = 1
Return $Res
EndFunc
Func _ArrayRandom($Array,$start,$end,$nb_de_changement)
Local $s,$Res,$Ret
If int($start) <> $start then return -2
If int($end) <> $end then return -3
If int($nb_de_changement) <> $nb_de_changement then return -4
If IsArray($Array) = 0 then return -1
For $s = 1 to $nb_de_changement
$Res = Random($start, $end, 1)
If $Res = 0 Then $Res = 1
$Ret = Random($start, $end, 1)
If $Ret = 0 Then $Ret = 1
_ArraySwap($Array[$Res],$Array[$Ret])
Next
Return $Array
EndFunc
Func Fin()
_SoundClose($hSound)
Exit 0
EndFunc
http://tim.malossane.free.fr/programme.zip (30 Megas, images volumineuses mais ca vaut le coup

