home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 221 - Disc 1 / DPCS0706.ISO / In The Mag / Programming Expert / HomeRotator.exe / HomeRotator / rotate.vbs < prev    next >
Encoding:
Text File  |  2006-03-22  |  861 b   |  37 lines

  1. 'create objects
  2. set fso=CreateObject("Scripting.FileSystemObject")
  3. Set WshShell = WScript.CreateObject("WScript.Shell")
  4.  
  5. 'Get the current home page
  6. HomePage=wshShell.regread("HKCU\Software\Microsoft\Internet Explorer\Main\Start Page")
  7.  
  8. 'Get Favorites\HomePages
  9. UserFavs=WshShell.SpecialFolders("Favorites")
  10. UserFavs=UserFavs & "\HomePages"
  11.  
  12. if fso.folderexists(UserFavs) then
  13.      set Fs=fso.GetFolder(UserFavs).Files
  14.  
  15. if Fs.count>0 then
  16. reDim URLS(Fs.count)
  17. i=0
  18. for each f in Fs
  19.  
  20.     set ts=f.OpenAsTextStream(1)
  21.     ts.readline
  22.     temp=ts.Readline
  23.     temp=Split(temp,"=")
  24.     URLS(i)=temp(1)
  25.     ts.close
  26.     if URLS(i)=HomePage then
  27.         found=(i+1) Mod FS.count
  28.     end if
  29.     i=i+1
  30. next
  31.  
  32. 'Set new home page
  33.  NextURL=URLS(found)
  34. wshShell.regWrite "HKCU\Software\Microsoft\Internet Explorer\Main\Start Page" ,NextURL, "REG_SZ"
  35. end if
  36. end if
  37.