cgasb Posted October 31, 2007 Posted October 31, 2007 I am opening a window in a java app that takes varying amounts of time to appear. The window has no title and no visible or hidden text. It has a Basic Window Info Class: SunAwtDialog. It also has a Basic Control Info Class: SunAwtCanvas, with instances of 2 and 7. Is there any way I can wait for this window other than using sleep()? Thanks for the help. WinActivate("TotalPlus - []") Send("!{F9}") WinWaitActive(?????)
Paulie Posted October 31, 2007 Posted October 31, 2007 I think if you do Opt('WinTitleMatchMode',4) Then you can get the window with the classname.
Moderators SmOke_N Posted October 31, 2007 Moderators Posted October 31, 2007 (edited) Not tested: expandcollapse popup_myWinWait("SunAwtDialog", "SunAwtCanvas", "2", 10);Wait 10 Seconds If @error Then Switch @error Case 1 MsgBox(16, "Error", "Timed Out") Case 2 MsgBox(16, "Error", "No idea, it's a redundant error, no idea how you got it!! LOL") EndSwitch Else MsgBox(48, "Success", "The window has finally showed up!") EndIf Func _myWinWait($sClass, $sClassNN = "", $nIndex = "", $nTimeOut = -1);nTimeOut in seconds Local $nTimer = TimerInit() While 1 If WinExists("[CLASS:" & $sClass & "]") Then If $sClassNN = "" Then Return 1 If $sClassNN And _ ControlGetHandle("[CLASS:" & $sClass & "]", "", & _ "[CLASSNN:" & $sClassNN & $nIndex & "]") Then Return 1 EndIf If $nTimeOut And (TimerDiff($nTimer) / 1000) >= $nTimeOut Then Return SetError(1, 0, 0) WEnd Return SetError(2, 0, 0) EndFuncoÝ÷ ØGb´J뢸§r^[(jz-êè¦Ø¨¸y«"z²-zwm¢Þ®ØbKax,jÛbë*º`µ«¢+Ù}µå]¥¹]¥Ð ÅÕ½ÐíMÕ¹ÝÑ¥±½ÅÕ½Ðì°ÅÕ½ÐíMÕ¹ÝÑ ¹ÙÌÅÕ½Ðì°ÅÕ½ÐìÈÅÕ½Ðì°ÄÀ¤í]¥ÐÄÀM½¹Ì)%ÉɽÈQ¡¸(MÝ¥Ñ ÉɽÈ( ÍÄ(5Í ½à ÄØ°ÅÕ½ÐíÉɽÈÅÕ½Ðì°ÅÕ½ÐíQ¥µ=ÕÐÅÕ½Ðì¤( ÍÈ(5Í ½à ÄØ°ÅÕ½ÐíÉɽÈÅÕ½Ðì°ÅÕ½Ðí9¼¥°¥ÐÌäíÌÉÕ¹¹ÐÉɽȰ¹¼¥¡½Üå½Ô½Ð¥ÐÌÌìÌÌì1=0ÅÕ½Ðì¤(¹MÝ¥Ñ )±Í(5Í ½à Ðà°ÅÕ½ÐíMÕÍÌÅÕ½Ðì°ÅÕ½ÐíQ¡Ý¥¹½Ü¡Ì¥¹±±äÍ¡½ÝÕÀÌÌìÅÕ½Ðì¤)¹%()Õ¹}µå]¥¹]¥Ð ÀÌØíÍ ±Ḭ́ÀÌØíÍ ±ÍÍ98ôÅÕ½ÐìÅÕ½Ðì°ÀÌØí¹%¹àôÅÕ½ÐìÅÕ½Ðì°ÀÌØí¹Q¥µ=ÕÐô´Ä¤í¹Q¥µ=ÕÐ¥¸Í½¹Ì(%1½°ÀÌØí¹]¥Ðô]¥¹]¥Ð ÅÕ½Ðím 1MLèÅÕ½ÐìµÀìÀÌØíÍ ±Í̵ÀìÅÕ½ÐítÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ðì°ÀÌØí¹Q¥µ=ÕФ(%%ÀÌØí¹]¥ÐôÀQ¡¸IÑÕɸMÑÉÉ½È Ä°À°À¤(%%ÀÌØíÍ ±ÍÍ98ôÅÕ½ÐìÅÕ½ÐìQ¡¸IÑÕɸÄ(%%ÀÌØíÍ ±ÍÍ98¹ ½¹Ñɽ±Ñ!¹± ÅÕ½Ðím 1MLèÅÕ½ÐìµÀìÀÌØíÍ ±Í̵ÀìÅÕ½ÐítÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ðì°µÀì|($$$$$ÅÕ½Ðím 1MM98èÅÕ½ÐìµÀìÀÌØíÍ ±ÍÍ98µÀìÀÌØí¹%¹àµÀìÅÕ½ÐítÅÕ½Ðì¤Q¡¸IÑÕɸÄ(%IÑÕɸMÑÉÉ½È È°À°À¤)¹Õ¹ Edited October 31, 2007 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
cgasb Posted October 31, 2007 Author Posted October 31, 2007 I think if you do Opt('WinTitleMatchMode',4) Then you can get the window with the classname. Thanks for info; you got me on the right track. This seems to work well: WinWaitActive("[TITLE:; CLASS:SunAwtDialog]", "")
Moderators SmOke_N Posted October 31, 2007 Moderators Posted October 31, 2007 Thanks for info; you got me on the right track. This seems to work well: WinWaitActive("[TITLE:; CLASS:SunAwtDialog]", "")Ahh, thought you were waiting for a specific window with a specific control... yeah, that'll do'er if that's all you wanted was the win instance Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
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