;**** Created with KiXscripts Editor | http://KiXscripts.com ****
;**** Last Modified on 21/01/2003 at 12:55:46 PM by james.mcdonald.admin ****

; Script to add channels to IE to be used as screen saver
; location of favorites

$objFSO = CreateObject("Scripting.FilesystemObject")
$strFavRegKey = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders"
$strFavorites = ReadValue($strFavRegKey, "Favorites")

; get system dir
$Value = ReadValue( "HKLM\System\CurrentControlset\Control\Windows", "SystemDirectory")
$strSysDir = ExpandEnvironmentVars( $Value )

; set favorites directories values
$strTopDir = "NoticeBoard"
$strSubDir1 = "TLA Safety 1"
$strSubDir2 = "TLA Safety 2"
$strSubDir3 = "TLA Safety 3"

; screensaver exe name
$strSSName = "CHANNE~1.SCR"
$strTopDirPath = $strFavorites + "\" + $strTopDir

; desktop ini file contents

$strSection1 = "[.ShellClassInfo]"
$strCLSID = "CLSID={F3AA0DC0-9CC8-11D0-A599-00C04FD64434}"
$strOption = "ConfirmFileOp=0"
$strSection2 = "[Channel]"
$strCDFURL1 = "CDFURL=http://www.host1.bigcompany.com.au/channels/mtoNotice1.cdf"
;$strCDFURL2 =
;$strCDFURL3 =
$strSSURL1 = "ScreenSaverURL=file://host1svr014/Apps/NoticeBoard/mtoNotice1.htm"
;$strSSURL2 =
;$strSSURL3 =

If $objFSO.FolderExists($strTopDirPath)
? "Folder Exists"
$objFolder = $objFSO.GetFolder($strTopDirPath)
$objFolder.Delete
EndIf

; create directory structure in favs
$strDeskINI = "desktop.ini"

$objFolder = $objFSO.CreateFolder($strTopDirPath)
$objFolder = $objFSO.CreateFolder($strTopDirPath + "\" + $strSubDir1)
$objFile = $objFSO.CreateTextFile($strTopDirPath + "\" + $strSubDir1 + "\" + $strDeskINI, true)
$objFile.WriteLine($strSection1)
$objFile.WriteLine($strCLSID)
$objFile.WriteLine($strOption)
$objFile.WriteLine($strSection2)
$objFile.WriteLine($strCDFURL1)
$objFile.WriteLine($strSSURL1)
$objFile.Attributes = 2
$objFile.Close
$objFolder.Attributes = 5

$objFolder = $objFSO.CreateFolder($strTopDirPath + "\" + $strSubDir2)
$objFile = $objFSO.CreateTextFile($strTopDirPath + "\" + $strSubDir2 + "\" + $strDeskINI, true)
$objFile.WriteLine($strSection1)
$objFile.WriteLine($strCLSID)
$objFile.WriteLine($strOption)
$objFile.WriteLine($strSection2)
$objFile.WriteLine($strCDFURL1)
$objFile.WriteLine($strSSURL1)
$objFile.Attributes = 2
$objFile.Close
$objFolder.Attributes = 5
$objFolder = $objFSO.CreateFolder($strTopDirPath + "\" + $strSubDir3)
$objFile = $objFSO.CreateTextFile($strTopDirPath + "\" + $strSubDir3 + "\" + $strDeskINI, true)
$objFile.WriteLine($strSection1)
$objFile.WriteLine($strCLSID)
$objFile.WriteLine($strOption)
$objFile.WriteLine($strSection2)
$objFile.WriteLine($strCDFURL1)
$objFile.WriteLine($strSSURL1)
$objFile.Attributes = 2
$objFile.Close
$objFolder.Attributes = 5


; write reg values

$strSSavKey = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\IE4 Screen Saver\"
$strDesktop = "HKEY_CURRENT_USER\Control Panel\Desktop\"
$retVal = WriteValue ($strDesktop, "ScreenSaveTimeOut", "600" , "REG_SZ")
$retVal = WriteValue ($strDesktop, "ScreenSaveActive", "1", "REG_SZ")
$retVal = WriteValue ($strDesktop, "SCRNSAVE.EXE", $strSysDir + "\" + $strSSName, "REG_SZ")
$retVal = WriteValue ($strDesktop, "ScreenSaverIsSecure", "1", "REG_SZ")
$retVal = WriteValue ($strDesktop, "Pattern", "(None)", "REG_SZ")
$retVal = WriteValue ($strDesktop, "Wallpaper", "(None)", "REG_SZ")

$retVal = WriteValue ($strSSavKey, "Navigate On Click", 0, "REG_DWORD")
$retVal = WriteValue ($strSSavKey, "Display Time", 60 , "REG_DWORD")
$retVal = WriteValue ($strSSavKey, "Play Sounds", 0, "REG_DWORD")
$retVal = WriteValue ($strSSavKey, "LastURL", "http://localhost/channels/channel1.html", "REG_SZ")




Sleep 10