I am trying to check the state of an installation and loop a pop-up until the install check shows finished.
It currently runs without error but it only pops up once and then I can see in task manager that wscript is still running but I do not get any other pop-ups.
I have tried moving my "do" statement up in the script but then it errors.
I do not know how to make it loop the whole thing and launch the HTA window over again until it detects Office 2007.
I suspect it is just looping the "sleep"???
Here is what I have.
-----------------------------------------------------------
Set wshShell = WScript.CreateObject("WScript.Shell")
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colSoftware = objWMIService.ExecQuery ("Select * from Win32_Product")
For Each objSoftware in colSoftware
If objSoftware.Caption = "Microsoft Office Enterprise 2007" Then
OfficeInstalled = True
End If
Next
If OfficeInstalled <> True Then
Set objShell = CreateObject("Wscript.Shell")
objShell.Run "warn.hta"
Do until OfficeInstalled = True
WScript.Sleep 60
Loop
End If
-----------------------------------------------------------
HTA Code:
<html>
<HTA:APPLICATION
SysMenu="no"
>
<script language = "VBScript">
Sub Window_OnLoad
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * From Win32_DesktopMonitor")
For Each objItem in colItems
intHorizontal = objItem.ScreenWidth
intVertical = objItem.ScreenHeight
Next
intLeft = (intHorizontal - 400) / 2
intTop = (intVertical - 250) / 2
window.resizeTo 400,250
window.moveTo intLeft, intTop
idTimer = window.setTimeout("PausedSection", 8000, "VBScript")
End Sub
Sub PausedSection
window.close
End Sub
</script>
<head>
<title>Office 2007</title>
</head>
<body><center>
<p>Please wait while Office 2007 is installed.<br>
<p>Your computer may reboot.</p>
</center></body>
</html>
-----------------------------------------------------------
It currently runs without error but it only pops up once and then I can see in task manager that wscript is still running but I do not get any other pop-ups.
I have tried moving my "do" statement up in the script but then it errors.
I do not know how to make it loop the whole thing and launch the HTA window over again until it detects Office 2007.
I suspect it is just looping the "sleep"???
Here is what I have.
-----------------------------------------------------------
Set wshShell = WScript.CreateObject("WScript.Shell")
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colSoftware = objWMIService.ExecQuery ("Select * from Win32_Product")
For Each objSoftware in colSoftware
If objSoftware.Caption = "Microsoft Office Enterprise 2007" Then
OfficeInstalled = True
End If
Next
If OfficeInstalled <> True Then
Set objShell = CreateObject("Wscript.Shell")
objShell.Run "warn.hta"
Do until OfficeInstalled = True
WScript.Sleep 60
Loop
End If
-----------------------------------------------------------
HTA Code:
<html>
<HTA:APPLICATION
SysMenu="no"
>
<script language = "VBScript">
Sub Window_OnLoad
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * From Win32_DesktopMonitor")
For Each objItem in colItems
intHorizontal = objItem.ScreenWidth
intVertical = objItem.ScreenHeight
Next
intLeft = (intHorizontal - 400) / 2
intTop = (intVertical - 250) / 2
window.resizeTo 400,250
window.moveTo intLeft, intTop
idTimer = window.setTimeout("PausedSection", 8000, "VBScript")
End Sub
Sub PausedSection
window.close
End Sub
</script>
<head>
<title>Office 2007</title>
</head>
<body><center>
<p>Please wait while Office 2007 is installed.<br>
<p>Your computer may reboot.</p>
</center></body>
</html>
-----------------------------------------------------------