MadBoy Posted January 30, 2006 Share Posted January 30, 2006 (edited) Hey, got little question about WHILE. I added 2 'while'. First one checks if everything is correct and displays it on screen and it's working correctly because there's Exit Loop command so i have no problem with it. But then the next While is started and if i don't add exit the loop continues to display text over and over(so it looks like the text is moving all the time). If i would add 'exit' after displaying text it would end application and user couldn't see it. Is there a way to prevent it? For example to make app wait until user closes the application by button or 'esc'? I added While '3' and it seems to work. But dunno if it's best solution? Would appreciate some information about that. While 3 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd expandcollapse popupWhile 1 office_check() If $office_version = "2003" Then GUICtrlSetData( $Label11, "Tak, " & $office_version ,$GUI_SHOW ) EndIf If $office_version = "XP" Then GUICtrlSetData( $Label11, "Tak, " & $office_version ,$GUI_SHOW ) EndIf If $office_version = "NOPE" Then GUICtrlSetData( $Label11, "Nie",$GUI_SHOW ) EndIf project_check() If $project_version = "2003" Then GUICtrlSetData( $Label12, "Tak, " & $project_version ,$GUI_SHOW ) EndIf If $project_version = "XP" Then GUICtrlSetData( $Label12, "Tak, " & $project_version ,$GUI_SHOW ) EndIf If $project_version = "NOPE" Then GUICtrlSetData( $Label12, "Nie",$GUI_SHOW ) EndIf visio_check() If $visio_version = "2003" Then GUICtrlSetData( $Label13, "Tak, " & $visio_version ,$GUI_SHOW ) EndIf If $visio_version = "XP" Then GUICtrlSetData( $Label13, "Tak, " & $visio_version ,$GUI_SHOW ) EndIf If $visio_version = "NOPE" Then GUICtrlSetData( $Label13, "Nie",$GUI_SHOW ) EndIf ; Checking for DOMAIN status domain_check() If $logged_to_domain = "Yes" Then GUICtrlSetData( $Label14, "Tak",$GUI_SHOW ) Else GUICtrlSetData( $Label14, "Nie",$GUI_SHOW ) EndIf ; Checking for Lan connection and best server server_check() If $ping_error = "No" Then GUICtrlSetData( $Label15, "Tak, " & $server_to_use,$GUI_SHOW ) ExitLoop Else GUICtrlSetData( $Label15, "Nie" ) ExitLoop EndIf $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ;FileRecycle ("C:\Windows\Temp.gif") Exit EndSelect WEnd While 2 If $office_version = "2003" OR $office_version = "XP" OR $project_version = "2003" OR $project_version = "XP" OR $visio_version = "2003" OR $visio_version = "XP" Then If $logged_to_domain = "Yes" Then If $ping_error = "Yes" Then ; BRAK KONTAKTU Z SERWEREM! GUICtrlSetData( $Label61, "Brak kontaktu z serwerem. " ,$GUI_SHOW ) Else ; WSZYSTKO OKEJ --> CO ROBIC!!!! GUICtrlSetData( $Label61, "Office Updater wykona teraz aktualizacje produktow. Prosze czekac...",$GUI_SHOW ) If $office_version = "2003" Then EndIf If $office_version = "XP" Then EndIf If $project_version = "2003" Then EndIf If $project_version = "XP" Then EndIf If $visio_version = "2003" Then EndIf If $visio_version = "XP" Then EndIf GUICtrlSetData( $Label61, "Produkty Office zostały zaaktualizowane!",$GUI_SHOW ) EndIf Else ; UZYTKOWNIK NIE JEST ZALOGOWANY DO DOMENY! GUICtrlSetData( $Label61, "Testy potrzebne do aktualizacji instalacji administracyjnej produktów Office",$GUI_SHOW ) Else ; ZADEN Z PRODUKTOW NIE JEST ZAINSTALOWANY! GUICtrlSetData( $Label61, "Żaden produkt Office nie jest zainstalowany! Po co Ci Microsoft Office Updater?!",$GUI_SHOW ) EndIf $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd Edited January 30, 2006 by MadBoy My little company: Evotec (PL version: Evotec) Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 30, 2006 Moderators Share Posted January 30, 2006 You could nest the Whiles within each other to possibly help you: While 1 $msg = GUIGetMsg() If $msg = - 3 Then Exit While 'Something you want for this loop is true'; eg..$something <> $something else If $someotherthing = $thesamething Then ExitLoop WEnd While 'again the same type as above' If $that <> $this Then ExitLoop WEnd 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...
MadBoy Posted January 30, 2006 Author Share Posted January 30, 2006 Good idea I guess i will use it in some next program. This one is almost finished so no sense to 'rebuild it'. Tnx My little company: Evotec (PL version: Evotec) Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 30, 2006 Moderators Share Posted January 30, 2006 Good idea I guess i will use it in some next program. This one is almost finished so no sense to 'rebuild it'. TnxYou obviously are not understanding what I'm saying. There's no need to rebuild, but no matter what solution you get, you're going to have to 'CHANGE' something. The above was a 2 second fix. 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...
MadBoy Posted January 30, 2006 Author Share Posted January 30, 2006 You obviously are not understanding what I'm saying. There's no need to rebuild, but no matter what solution you get, you're going to have to 'CHANGE' something. The above was a 2 second fix.Well i would have to put the While 2 into While 1 but since the While 1, While 2 and While 3 works fine (unless it's some hard felony using it that way) it doesn't require changing I might update it in version 0.5. Atm i gotta fix a lot of other things like better detection of office or if server is accesible. My little company: Evotec (PL version: Evotec) 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