Jump to content

Unable to detect error window


Recommended Posts

Hi,

The application i'm trying to automate sometimes crashes. An error window appears when the application crashes.

Hence in my autoit script, I'm using the adlib function to detect when the error window appears before the application crashes.

My adlib func looks something like this -

Func MyAdlib()

If WinExists ("titlename.exe") Then

$flag = 1

EndIf

EndFunc

When I used the title of the error window as shown above, autoit detects the error window, however doesnt seem to work as expected.

AutoIt doesnt seems to be able to differentiate the parent window title from the error pop-up window title though the title names are different. when the application is restarted, autoit detects the parent window of the application as the error window.

Question 1) "titlename.exe" happens to be the name of the process of the application. Is this the reason for the above behaviour??

Hence I decided to workaround the issue by using CLASS instead of title in the adlib function, as shown below -

Func MyAdlib()

If WinExists ("[CLASS:DirectUIHWND]") Then

$flag = 1

EndIf

EndFunc

This doesn't seem to work though I have the CLASS name is correct. I tried using INSTANCE as well along with CLASS.

Autoit is unable to detect it altogether.

Can anyone please suggest any workaround to get this working?

Thanks!

Link to comment
Share on other sites

I prefer the following workaround as Adlib function:

Func _MyAdlib()
$WINHANDLE = WinWaitActive("[CLASS:DirectUIHWND]", "")
If $WINHANDLE <> "0" then
Return Global $FLAG = 1
else
return Global $FLAG = 0
EndIf
EndFunc
Edited by MKISH

----------------------------------------

:bye: Hey there, was I helpful?

----------------------------------------

My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1

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...