leuce Posted August 6, 2006 Share Posted August 6, 2006 G'day everyone I'm using Do...Until in a loop and I want the script to exit that loop when the time is ripe. However, the loop doesn't want to stop looping. Here's my code (the entire script is attached -- the additional programs in it are ResHack and XnView): $a = 0 Do ;Some stuff here If WinExists ("Dialog", "") Then ; Do some XYZ stuff Else $a = 1 EndIf Until $a = 1 My reasoning is that once $a is 1, the Do loop should stop... right? But it doesn't. It continues even though the window "Dialog" no longer exists. Any ideas? Thanks Samuelscreencapscript2.zip Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted August 6, 2006 Moderators Share Posted August 6, 2006 You could always do it with a while/wend loop a bit different:While 1 If WinExists ("Dialog", "") Then WinActivate ("Dialog", "") WinWaitActive ("Dialog", "") Send ("!d") Sleep (100) $a = 1 EndIf If Not WinExists('Dialog') And $a = 1 Then ExitLoop WEnd 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. Link to comment Share on other sites More sharing options...
ChrisL Posted August 6, 2006 Share Posted August 6, 2006 What about using a while loop While WinExists ("Dialog", "") ;Do stuff Wend [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
theguy0000 Posted August 6, 2006 Share Posted August 6, 2006 (edited) While WinExists("Dialog", "") ;stuff to do while the dialog exists; WEnd ? Edit: ChrisL beat me to it Edited August 6, 2006 by theguy0000 The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted August 6, 2006 Moderators Share Posted August 6, 2006 He had alot more stuff in that loop is why I suggested what I did. 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. Link to comment Share on other sites More sharing options...
theguy0000 Posted August 6, 2006 Share Posted August 6, 2006 He had alot more stuff in that loop is why I suggested what I did.he's righht of course. The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN Link to comment Share on other sites More sharing options...
PsaltyDS Posted August 6, 2006 Share Posted August 6, 2006 (edited) G'day everyone I'm using Do...Until in a loop and I want the script to exit that loop when the time is ripe. However, the loop doesn't want to stop looping. Here's my code (the entire script is attached -- the additional programs in it are ResHack and XnView): $a = 0 Do ;Some stuff here If WinExists ("Dialog", "") Then ; Do some XYZ stuff Else $a = 1 EndIf Until $a = 1 My reasoning is that once $a is 1, the Do loop should stop... right? But it doesn't. It continues even though the window "Dialog" no longer exists. Any ideas? Thanks Samuel I think SmOke_N was closest, but the logic is changed my moving the $a=1. I would have dropped it completely and put: While 1 ; Other stuff from the original Do loop... If WinExists("Dialog", "") Then WinActivate("Dialog", "") WinWaitActive("Dialog", "") Send ("!d") Sleep (100) Else ExitLoop EndIf WEnd Allows you to check that the script gets to that code at all. Edited August 6, 2006 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
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