Question

In the past I've used the following vbscript to keep a window active. It also re-opens the window if it gets closed. How could I change this so that the window will always remain open and in the background, but other windows can be active. This is a kiosk setup. Users will click on links and a popup window will open. The popup windows will can be closed. The shortcut link in the script launches the webpage in Chrome kiosk mode. The solution is sort of like an active desktop background. I'm using this on a Windows 7 Thin PC computer which does not have an active desktop capability.

Option Explicit
'On Error Resume Next

Dim objShell

Set objShell = CreateObject("WScript.Shell")

Do 
If (objShell.AppActivate("Kiosk") = False) Then
objShell.Run "c:\scripts\kioskhomepage"
WScript.Sleep 5000
Else
WScript.Sleep 3000
End If
Loop
Was it helpful?

Solution

Upfront I'm not familiar with Chrome or Chrome kiosk mode... However, if its the only instance you can try to look for it using WMI and then modify your Run command with additional arguments...

For more information on Run, see http://msdn.microsoft.com/en-us/library/d5fk67ky%28v=vs.84%29.aspx

Dim objShell, objWMIService, colItems

Set objShell = CreateObject("WScript.Shell")
Set objWMIService = GetObject("winmgmts:\\.\root\CIMV2")

Do
      'Change Chrome.exe to whatever the executable is called
    Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Process WHERE Name ='Chrome.exe'")
    If colItems.Count = 0 Then
        objShell.Run "c:\scripts\kioskhomepage", 8, False
        WScript.Sleep 5000
    Else
        WScript.Sleep 3000
    End If
Loop
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top