home *** CD-ROM | disk | FTP | other *** search
- button=Msgbox("You are about to setup Home Page Rotator - click OK to continue or Cancel to abort",1)
- if button = 1 then
- Setup
- Msgbox "setup complete"
- else
- msgbox "Setup cancelled - run setup again to install or refresh an installation"
- end if
-
- Sub Setup
- 'create folders and copy files
-
- 'create standard objects
- Set WshShell = WScript.CreateObject("WScript.Shell")
- set fso=CreateObject("Scripting.FileSystemObject")
-
- 'Get folder names
- Set WshSysEnv = WshShell.Environment("PROCESS")
- ProgFolder=WshSysEnv("ProgramFiles")
- ProgFolder =ProgFolder & "\HomePageRotator"
-
- Set WshSysEnv = WshShell.Environment("PROCESS")
- Sys32=WshSysEnv("SystemRoot") & "\System32"
-
- currentdir= WshShell.currentdirectory
-
- 'Create project folder
- if not(fso.folderexists(ProgFolder)) then
- fso.createfolder(ProgFolder)
- end if
-
- 'Copy project files
- fso.copyfile currentdir & "\HR.htm",ProgFolder & "\",true
- fso.copyfile currentdir & "\rotate.vbs",Sys32 & "\",true
-
- 'Setup registry for right click in IE
- ProgURL="file://" & ProgFolder & "\HR.htm"
- MenuItem="Add page to home page rotation"
- WshShell.RegWrite _
- "HKCU\Software\Microsoft\Internet Explorer\MenuExt\" _
- & Menuitem & "\",_
- ProgURL, "REG_SZ"
-
- 'Set the schedule
-
- 'Get the user name and pass word
- Set Net = CreateObject("WScript.Network")
- User = Net.UserName
- pass=InputBox( "Enter your password", "Password")
-
-
- 'Delete existing task if any
- cmdline ="schtasks /delete /tn ""Home Page Rotate"" /f"
- set sched=wshShell.exec(cmdline)
- do while sched.status=0
- wscript.sleep 100
- loop
-
-
- ' Create the new task
- cmdline="schtasks /create /tn ""Home Page Rotate"""
- cmdline=cmdline & " /tr rotate.vbs "
- cmdline=cmdline & " /sc minute /mo 20 /ru " & chr(34) & User & chr(34) & " /rp " & chr(34) & pass & chr(34)
-
- set sched=wshShell.exec(cmdline)
-
- ' Handle messages from schtasks
- wscript.sleep 100
- input1 = sched.Stderr.ReadAll
- input2 = sched.StdOut.ReadAll
-
- 'Show the results
- if input2<>"" then
- msgbox input2
- end if
- if input1<>"" Then
- msgbox input1
- end if
-
- end sub
-
-
-
-
-
-
-
-
-
-
-