Hi,

I have written a VBScript that uses Send Keys to automate an application. The application dials out to download files and this process of dialing out is initiated within the application. The issue I am having is that the modem occationally fails to dail out and as a result of this there is a message box which pops up resulting in the rest of send keys keystrokes going crazy.
Is there a solution in VB which will check the activation of this message box once the send keys initiate the modem dialup and keep looping till around 5 min which will be the max time the modem will take to dialout.

I need to add error handling so that only on the apperance of this message box which will indicate the failure of the modem to dailout will the Enter sendkey will be sent and the whole routine restarted..

Const iNormalFocus = 1
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run "FINAL.EXE",iNormalFocus
Wscript.Sleep 10000
objShell.SendKeys ""
objShell.SendKeys "{TAB}"
objShell.SendKeys ""
objShell.SendKeys "~"
Wscript.Sleep 1000
objShell.SendKeys "%"+"R"
objShell.SendKeys "D"
Wscript.Sleep 1000
objShell.SendKeys "%"+"F"
objShell.SendKeys "R"
Wscript.Sleep 1000
objShell.SendKeys "%"+"F"
objShell.SendKeys "S" #This is were the modem connection is initiated
Wscript.Sleep 350000
objShell.SendKeys "%"+"F"
objShell.SendKeys "X"
Wscript.Sleep 1000
objShell.SendKeys "%"+"F"
objShell.SendKeys "X"
objShell.SendKeys "%"+"R"
objShell.SendKeys "R"
Wscript.Sleep 1000
objShell.SendKeys "%"+"F"
objShell.SendKeys "E"
objShell.SendKeys "~"
Wscript.Sleep 100
objShell.SendKeys "%"+"A"
objShell.SendKeys "%"+"F"
objShell.SendKeys "E"
Wscript.Sleep 100
objShell.SendKeys "{DEL}"
objShell.SendKeys "l"
objShell.SendKeys "{TAB}"
objShell.SendKeys "{TAB}"
objShell.SendKeys "{TAB}"
objShell.SendKeys "{TAB}"
objShell.SendKeys "{TAB}"
objShell.SendKeys "{TAB}"
objShell.SendKeys "~"
Wscript.Sleep 1000
objShell.SendKeys "~"
Wscript.Sleep 1000
objShell.SendKeys "%"+"F"
objShell.SendKeys "X"
Wscript.Sleep 1000
objShell.SendKeys "%"+"F"
objShell.SendKeys "X"
Wscript.Sleep 10000

xor