/build/static/layout/Breadcrumb_cap_w.png

VBScript to detect an open messagebox and close it

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.

Thanks,

0 Comments   [ + ] Show comments

Answers (5)

Posted by: jct134 2 years ago
Senior Purple Belt
0

just need to find out what the process is that is creating the popup, then script to kill the process...


For example when installing office 2016 (or 2019), while the install is running setup32.exe is running...

OnceĀ  that process stops running (install is complete) a process named OfficeC2Rclient.exe runs with a pop up saying the install has finished...


So my script simply detects that setup32.exe is no longer running, then checks if officeC2Rclient.exe is running and kills it..

Posted by: FunWithApps 16 years ago
Senior Yellow Belt
0
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:

http://www.microsoft.com/technet/scriptcenter/resources/qanda/jul06/hey0727.mspx

Hope it helps!
Posted by: groulder 16 years ago
Senior Yellow Belt
0
shaunc1000,

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.

daniel.
Posted by: Robo Scripter 16 years ago
Orange Senior Belt
0
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.
Else
'Place reboot action code here.
End If
' ************end code***************

I hope this serves to help you out.
Posted by: MicrosoftBob 16 years ago
Blue Belt
0
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.

http://msdn.microsoft.com/en-us/library/8c6yea83(VS.85).aspx

I know that it can be done with WinBatch -- if you have it, check the help file for SendKey.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ