Jump to content

Unexpected Errors


Recommended Posts

Is the following code efficient to detect if an unexpected error occurs. If not please recommend any amendments. I'm using autoit to test applications, but need to detect if an unexpected error occurrs when i'm testing this automatically.

;/* check for unforeseen errors every 250 MS (i.e. checks for an error window to pop up unpredictably, etc)

AdlibEnable("myadlib")

Func myadlib()

If WinActive("Error") Then

_MyLog($Pre, "16", "CLMS Remote Access", "Unexpected error occurred", "")

WinClose("Flourish - Clms [ Multiple Setup Support ]")

WinClose("Flourish Client Login")

WinClose("CLMS - Northbook Technology - Magee Campus")

Exit

EndIf

EndFunc

Does the WinActive("Error") command only detect windows that say 'Error'. If so I need code to detect other error messages or errors that might vary in name, than 'Error'.

Thanks

Link to comment
Share on other sites

You could add the lines to the top of your code :

Opt("WinTitleMatchMode",2)
Opt("WinWaitDelay",10)

You could maybe be a little more specific on the title (or text) of the error-msgbox

if that is possible, since using the first line of code above and use only "Error" as

title can result in unwanted..results.

Link to comment
Share on other sites

Where abouts do I put this in my code:

AdlibEnable("myadlib")

Func myadlib()

If WinActive("Error") Then

_MyLog($Pre, "16", "CLMS Remote Access", "Unexpected error occurred", "")

WinClose("Flourish - Clms [ Multiple Setup Support ]")

WinClose("Flourish Client Login")

WinClose("CLMS - Northbook Technology - Magee Campus")

Exit

EndIf

EndFunc

Link to comment
Share on other sites

So is this the correct place to insert the new code:

AdlibEnable("myadlib")

Func myadlib()

Opt("WinTitleMatchMode",2)

Opt("WinWaitDelay",10)

If WinActive("Error") Then

_MyLog($Pre, "16", "CLMS Remote Access", "Unexpected error occurred", "")

WinClose("Flourish - Clms [ Multiple Setup Support ]")

WinClose("Flourish Client Login")

WinClose("CLMS - Northbook Technology - Magee Campus")

Exit

EndIf

EndFunc

Link to comment
Share on other sites

You could add the lines to the top of your code :

Opt("WinTitleMatchMode",2)
Opt("WinWaitDelay",10)

You could maybe be a little more specific on the title (or text) of the error-msgbox

if that is possible, since using the first line of code above and use only "Error" as

title can result in unwanted..results.

<{POST_SNAPBACK}>

what title or text do you recommend on using then?
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...