1:)You must have MS Word installed (just installed,not running) for this script to work
2:)Copy the code to notepad
3:)Replace "hope" in line 12 with a unique word from the title of the web page, or found in the running task in taskmanager for the window you wish to keep open.
4:)Replace
http://www.computerhope.com in line 18 with the url you want to keep open.
5:)Save the file to startup folder as
anyname.vbs , be sure to change file type to "all file"
strComputer = "."
Set objShell = CreateObject("Wscript.Shell")
Set objWord = CreateObject("Word.Application")
Do While i < 3
Set colTasks = objWord.Tasks
i = 0
For Each objTask in colTasks
strName = LCase(objTask.Name)
If Instr(strName, "hope") Then
i = 1
End If
Next
If i = 0 Then
objShell.Run "iexplore.exe -k http://www.computerhope.com"
End If
Wscript.Sleep 20000
Loop
Result:
This will loop every 20000 milliseconds (20 seconds) looking for "hope" in open windows/running task. If "hope" is not found
www.computerhope.com will be opened in kiosk mode.
Note:
If you place this on the desktop and double click it to start for testing purposes and you then kill the wscript.exe process, you also need to kill the winword.exe process before starting the script again. Not killing the winword.exe process and restarting the script will result in multiple instances of winword.exe working against each other resulting in high cpu usage.