05/23/2008 30277 views
Has anyone found a way to detect for and close an open messagebox from another program? I am trying to automate the uninstall of a program. At the end of the uninstall the program tells the user that the computer must be rebooted and makes the user click "ok".

The uninstall command is part of a script I wrote. I would like the messagebox to close automaticly so that it can continue on with with rest of the script without any user interaction.

I was thinking this might be possible with VBScirpt.. if anyone could help I would greatly appreciate it.

0 Comments   [ + ] Show comments


Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

All Answers

This is a link for a vbscript for a message box, with no close button, that will stay open for a set amount of time:


Hope it helps!
Answered 05/27/2008 by: FunWithApps
Senior Yellow Belt


i'm facing the same issue with the uninstall of a peice of software i'm trying to automate. the uninstall is completely silently, then at the end it prompts the user to restart--unacceptable.

just off the top of my head a pretty crude way of handling it could be writing an autoit script that uses the winwaitactive fuction, compile it into an exe and run it pre uninstall. however with this method the dialog box would still be briefly visible and therefore intrusive to the user.

something that might work (i'd need to investigate it further as it's an idea that's just popped into my head), would be to write a vbs that after a specified timeout kills the uninstall process. used in conjuction with microsoft sms, which has the ability to suppress program notifications and run program windows hidden, you might just able to deploy an sms package that runs the vbs first, runs the uninstall which completes just before the vbs timeout occurs and kills the process.

of course the latter suggestion depends on you being lucky enough to be using ms sms at your site. i'll play with this in the next couple of days and post my results.

Answered 05/29/2008 by: groulder
Senior Yellow Belt

Here is an example of a Shell Pop-Up I have used in many installs where I needed the function of a self closing Message Box.

Option Explicit
On Error Resume Next
' Create Shell Object
Dim objShell : set objShell = CreateObject("WScript.Shell")
' Create Message box Message
Dim strMessage : strMessage = "Your system will be rebooted in 10 seconds to allow changes take effect"
strMessage = strMessage & VbCrLf & "Do you wish to cancel this reboot?"
' Number of seconds in the delay
Dim intWaitSeconds : intWaitSeconds = 10
' Mesage Box Title
Dim strTitle : strTitle = "System Reboot Alert!"
' Display Message Box PopUp for delay period and capture return value.
Dim Return : Return = objShell.Popup(strMessage, intWaitSeconds, strTitle, vbYesNo+vbQuestion)
' Execute code based on the PopUp Returned value.
If Return = 6 Then
'Place no reboot action code here.
'Place reboot action code here.
End If
' ************end code***************

I hope this serves to help you out.
Answered 05/29/2008 by: Robo Scripter
Orange Senior Belt

Ok, I don't think that the original poster wants a way to produce a timed message box. The subject and content of the post seems to suggest that an install is being kicked off and the install presents the message box. A way to close it safely is what is desired, I beleive.

My guess is that it could be done with VBScript and below is a link to the SendKeys method.


I know that it can be done with WinBatch -- if you have it, check the help file for SendKey.
Answered 05/30/2008 by: MicrosoftBob
Blue Belt

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login