Hi I have been using this script to ramdomly change the wallpaper of my
windows 2000 clients however When i use this script for clientes running
windows xp it does not work
the special folder is desktop in windows xp right??
is there any other registry value i need to change??
does it make a diference the language?? instead of desktop to use
"escritorio" or something like that??
=============================================0
Option Explicit
Dim CompleteImagesFolderPath
Dim ImageFileTypes
CompleteImagesFolderPath = \\path
ImageFileTypes = "jpg"
Dim WshShell
Set WshShell = Wscript.CreateObject("Wscript.Shell")
Dim ImageFiles
Dim Final
Dim strDesktop
Set ImageFiles = CreateObject("Scripting.Dictionary")
strDesktop = WSHShell.SpecialFolders("Desktop")
call RandomImage(CompleteImagesFolderPath,ImageFileTypes)
Function RandomImage(CompleteImagesFolderPath, ImageFileTypes)
'Declare variables
Dim FileSystemObject
Dim ImageFolder
Dim Files
Dim i
Dim File
Dim FileName
Dim FileExtension
Dim RandomNumber
Set FileSystemObject = CreateObject("Scripting.FileSystemObject")
If Not FileSystemObject.FolderExists(CompleteImagesFolderPath) Then
RandomImage = "Error 0: Cannot find requested folder"
Set FileSystemObject = nothing
Exit Function
End If
Set ImageFolder = FileSystemObject.GetFolder(CompleteImagesFolderPath)
Set Files = ImageFolder.Files
i = 1
For Each File in Files
FileName = File.Name
FileExtension = Right(FileName, Len(FileName) - (InStrRev(FileName, ".")))
If InStr(1,ImageFileTypes,FileExtension,vbTextCompare) > 0 then
ImageFiles.Add i, FileName
i = i + 1
End If
Next
Set ImageFolder = nothing
Set Files = nothing
Set FileSystemObject = nothing
Randomize
If ImageFiles.Count = 0 Then
RandomImage = "Error 1: Folder no existe"
Exit Function
End If
RandomNumber = Int((ImageFiles.Count) * Rnd + 1)
Final = CompleteImagesFolderPath&"\"&ImageFiles.Item(RandomNumber)
WshShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Internet
Explorer\Desktop\General\Wallpaper",Final,"REG_SZ"
WshShell.RegWrite "HKEY_CURRENT_USER\Control
Panel\Desktop\Wallpaper",Final,"REG_SZ"
'CompleteImagesFolderPath&"\"&ImageFiles.Item(RandomNumber)
Set ImageFiles = nothing
WSHShell.AppActivate strDesktop
WSHShell.SendKeys "{F5}"
End Function
============================================================================
===
could you help me please??
the script does change the registry values but does not change the wallpaper
thanks a lot