ganeshk225 Posted August 27, 2012 Posted August 27, 2012 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 EndIfEndFuncWhen 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 EndIfEndFuncThis 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!
JohnOne Posted August 27, 2012 Posted August 27, 2012 Get the handle of the application window, and only set flag if handle is <> original. Bit of jiggery pokery in the middle wont harm either. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
stormbreaker Posted August 27, 2012 Posted August 27, 2012 (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 August 27, 2012 by MKISH ---------------------------------------- :bye: Hey there, was I helpful? ---------------------------------------- My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now