maybe this would help.. #NoTrayIcon Dim $cCounter = 0 Dim $FindFile = FileFindFirstFile(@WindowsDir & '\Web\Wallpaper\*.jpg') While 1 FileFindNextFile($FindFile) If @error Then ExitLoop $cCounter = $cCounter + 1 WEnd FileClose($FindFile) $FindFile = FileFindFirstFile(@WindowsDir & '\Web\Wallpaper\*.jpg') $i = 0 while $i < 5 $RandomNum = Random(1, $cCounter, 1) $i = $i + 1 WEnd Dim $curFile For $i = 1 To $RandomNum $curFile = FileFindNextFile($FindFile) If $RandomNum = $i Then RegWrite("HKCU\Control Panel\Desktop", "Wallpaper", "REG_EXPAND_SZ", "%SystemRoot%\Web\Wallpaper\" & $curFile) ExitLoop EndIf Next FileClose($FindFile) Exit it randomly picks up a picture file in a folder then apply it as wallpaper..