Sign in to follow this  
Followers 0
willwatters

Unexpected Errors

7 posts in this topic

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

Share this post


Link to post
Share on other sites



Other windows with "Error" ?

Use Opt("WinTitleMatchMode", 2) at the top of your script for substring title search

:(

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
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

Share this post


Link to post
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?

Share this post


Link to post
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
Sign in to follow this  
Followers 0