Sign in to follow this  
Followers 0
ganeshk225

Unable to detect error window

4 posts in this topic

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!

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

Thank you !! :)

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