Greetings all!
Obviously I am new to this forum and even more obviously I am new to AutoIT. But I am enjoying it and getting a lot of useful things out of it. I have been using these forums since I started messing around with AutoIT for hints and things to research. But I am now stuck on this one issue at the moment and was hoping someone could point me in the right direction or just point out what I am doing wrong with my scripts.
This part of my script is pretty simple. All I am having it do is launch a program and launch an update when the update window shows. All that works fine but every once in a while it gets an error right after launching the program. At that point I am wanting it to clear the error (enter or click OK) and relaunch the program and start the update. I have tried the following scripts but none seem to work. Any assistance would be appreciated.
Run('C:\CMProgram.exe')
If WinActivate("Error", "") Then
Send("{ENTER}")
Sleep(2000)
Run('C:\CMProgram.exe')
EndIf
_WinWaitActivate("Update Application", "")
Send("{ENTER}")
;=====================================================
Func CMerror()
If _WinWaitActivate("Error", "&OK") Then
MouseClick("left", 266, 11, 1)
MouseClick("left", 286, 98, 1)
Sleep(2000)
Run('C:\CMProgram.exe')
EndIf
EndFunc ;==>CMerror
AdlibRegister("CMerror")
Run('C:\CMProgram.exe')
_WinWaitActivate("Update Application", "")
Send("{ENTER}")
AdlibUnRegister("CMerror")
;==================================================
Run('C:\CMProgram.exe')
_WinWaitActivate("Error", "", 15)
Send("{ENTER}")
Sleep(2000)
Run('C:\CMProgram.exe')
_WinWaitActivate("Update Application", "")
Send("{ENTER}")