home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2006 June / PCpro_2006_06.ISO / files / mstools / VideoScreensaver.msi / Binary.SetupVBScript < prev    next >
Encoding:
Text File  |  2006-04-07  |  2.5 KB  |  65 lines

  1. Function LauchSettings()
  2. On error resume next
  3.     Dim shell : Set shell = CreateObject("Shell.Application")
  4.     Dim wsh : Set wsh = CreateObject("WScript.Shell")
  5.     Dim fso : Set fso = CreateObject("Scripting.FileSystemObject")
  6.  
  7.     Dim scrPath : scrPath = "%SystemRoot%\System32\ssvidp.scr"
  8.     Dim dstPath : dstPath = "%SystemRoot%\System32\" & Session.Property("ScreenSaverName") & ".scr"
  9.     scrPath = wsh.ExpandEnvironmentStrings(scrPath)
  10.     dstPath = wsh.ExpandEnvironmentStrings(dstPath)
  11.  
  12.     'need to rename the EXE to localized product name so Windows can show it in the display properties
  13.     fso.MoveFile scrPath, dstPath 
  14.  
  15.     'need to rename the local WMV file as well
  16.     Dim dir : dir = wsh.RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\CommonVideo")
  17.     Dim scrVideoPath : scrVideoPath = dir & "\ssvidp.wmv"
  18.     Dim dstVideoPath : dstVideoPath = dir & "\" & Session.Property("ProductName") & ".wmv"
  19.     fso.MoveFile scrVideoPath , dstVideoPath 
  20.     
  21.     'shell.ShellExecute "rundll32.exe", "desk.cpl, InstallScreenSaver " & scrPath
  22.     shell.ShellExecute "rundll32.exe", "desk.cpl, InstallScreenSaver " & dstPath
  23. End Function
  24.  
  25.  
  26. Function RemoveTwoFiles()
  27. On error resume next
  28.     Dim wsh : Set wsh = CreateObject("WScript.Shell")
  29.     Dim fso : Set fso = CreateObject("Scripting.FileSystemObject")
  30.  
  31.     Dim fileName : fileName = "%SystemRoot%\System32\" & Session.Property("ScreenSaverName") & ".scr"
  32.     fileName = wsh.ExpandEnvironmentStrings(fileName)
  33.  
  34.     fso.DeleteFile fileName
  35.  
  36.     Dim dir : dir = wsh.RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\CommonVideo")
  37.     fileName = dir & "\" & Session.Property("ProductName") & ".wmv"
  38.     fso.DeleteFile fileName 
  39. End Function
  40.  
  41. Function GetDefaultVideoPath
  42.     Dim wsh : Set wsh = CreateObject("WScript.Shell")
  43.     Session.Property("SHAREDVIDEOS") = wsh.RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\CommonVideo")
  44. End Function
  45.  
  46.  
  47. Function IsConnect
  48. On error resume next
  49.     Dim xmlhttp : Set xmlhttp = CreateObject("Msxml2.XMLHTTP.4.0")
  50.     xmlhttp.open "POST", "http://go.microsoft.com/fwlink", false
  51.     xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
  52.     xmlhttp.send
  53.  
  54.     IF Err.Number = 0 then
  55.         Session.Property("IsConnect") = "1"
  56.     ELSE
  57.         Session.Property("IsConnect") = "0"
  58.     END IF
  59. End Function
  60.  
  61. Function ConnectUrl
  62.     Dim shell : Set shell = CreateObject("Shell.Application")
  63.     shell.ShellExecute Session.Property("Genuine web") & "&LegitCheckError=" & Session.Property("LegitCheckResult")
  64. End Function
  65.