Randomly Change Wallpaper at Predefined Interval

Author Message
angryrabbit

  • Total Posts : 36
  • Scores: 2
  • Reward points : 0
  • Joined: 11/23/2010
  • Status: offline
Randomly Change Wallpaper at Predefined Interval Tuesday, November 23, 2010 7:48 AM (permalink)
0
That's weird, the code didn't post when between the code tags and I was unable to edit/reply to/or delete the original thread.
 
Option Explicit
Dim WshShell, oFolder, intNumber, strValue, i, oFile, strFolder
strFolder = "C:\Documents and Settings\e1614\My Documents\My Pictures\Wallpapers\"
Set WshShell = WScript.CreateObject("Wscript.Shell")
Set oFolder = WScript.CreateObject("Scripting.FileSystemObject").GetFolder(strFolder)
Do While True
 Do While True
  Randomize
  intNumber = Int((oFolder.Files.Count) * Rnd)
  i = 0
  For Each oFile In oFolder.Files
   If i = intNumber Then Exit For
   i = i + 1
  Next
  
  If oFile.Name <> strValue Then
   strValue = oFile.Name
   Exit Do
  End If
 Loop
 Set oFile = Nothing
 WshShell.RegWrite "HKCU\Control Panel\Desktop\Wallpaper", strFolder & strValue
 If Left(strValue, 4) = "xkcd" Then
  WshShell.RegWrite "HKCU\Control Panel\Desktop\WallpaperStyle", "0"
 Else
  WshShell.RegWrite "HKCU\Control Panel\Desktop\WallpaperStyle", "2"
 End If
 WshShell.Run "%windir%\System32\RUNDLL32.EXE user32.dll, UpdatePerUserSystemParameters", 1, False
 WScript.Sleep 600000
Loop
Set WshShell = Nothing
Set oFolder = Nothing
 
#1

    Online Bookmarks Sharing: Share/Bookmark

    Jump to:

    Current active users

    There are 0 members and 1 guests.

    Icon Legend and Permission

    • New Messages
    • No New Messages
    • Hot Topic w/ New Messages
    • Hot Topic w/o New Messages
    • Locked w/ New Messages
    • Locked w/o New Messages
    • Read Message
    • Post New Thread
    • Reply to message
    • Post New Poll
    • Submit Vote
    • Post reward post
    • Delete my own posts
    • Delete my own threads
    • Rate post

    2000-2012 ASPPlayground.NET Forum Version 3.9