Jump to content

Recommended Posts

Posted

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

Posted

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.

Posted

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

Posted

The function can be placed at the bottom of your script, out of the way.

The AdlibEnable() should be placed in the script when you want to start scanning for error windows.

Posted

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

Posted

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?

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
  • Recently Browsing   0 members

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