I am new to VB Scripting. I want the VB script to act according to an event of an application. Eg : The VBScript should wait till a popup message appears in an application.
VBScript and Windows Script Host only support primitive GUI automation, like activating windows (the AppActivate method) and sending keystrokes (the SendKeys methods). So I doubt that your task can be accomplished with pure VBScript.
However, there's a free GUI automation tool called AutoIt that should be able to do what you need.
If all you want is to close a pop-up, this may help you:
Set oShell = CreateObject("WScript.Shell")
Do
bResult = oShell.AppActivate("Title of the dialog box")
If bResult = True Then
oShell.SendKeys "%N" ' Alt+N, you may send {Esc} or {Enter} if you want
Exit Do
End If
WScript.Sleep 500
Loop
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With