Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

While in Case statement not looping

$
0
0
Is there a way to format auto-it code to have space so it can look more neat? Anyways...

In the code below my while $i>0 .... wend only loops once and does not go infinitely like I want, would someone now how I can fix this? Also with the while loop it does not tab to my notepad and without while loop it does, is there a reason behind this as well?

Thank you!

Edit: Forgot to mention that it also closes the gui after it loops once

[ autoit ]         
#include <GUIConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <StaticConstants.au3> HotKeySet("{PAUSE}","terminate") GUICreate("abc",150,250) global $as = GUICtrlCreateButton("a",25,10,100,30) global $b = GUICtrlCreateButton("b",25,50,100,30) global $c = GUICtrlCreateButton("c",25,90,100,30) global $d = GUICtrlCreateButton("d",25,130,100,30) global $e = GUICtrlCreateButton("e",25,170,100,30) global $start = GUICtrlCreateButton("Start",25,210,100,30) GUISetState(@SW_SHOW) global $i = 0 while 1    global $msg = GUIGetMsg()    Select       Case $msg = $as          if $i<5 THEN             global $itok = MsgBox(0,"Select a " & $i+1,"Press ENTER to save location")             if $itok = 1 THEN                if $i = 0 THEN                   global $apos1 = MouseGetPos()                ElseIf $i = 1 Then                   global $apos2 = MouseGetPos()                ElseIf $i = 2 Then                   global $apos3 = MouseGetPos()                ElseIf $i = 3 Then                   global $apos4 = MouseGetPos()                ElseIf $i = 4 Then                   global $apos5 = MouseGetPos()                EndIf             Endif             $i += 1          Else             global $itok = MSGBox(0,"Error", "Maximum number of a exceeded")          EndIf       Case $msg = $b          global $bn = MsgBox(0,"Select b","Press ENTER to save location")          if $bn = 1 then             global $bnpos = MouseGetPos()          EndIf       Case $msg = $c          global $cd = MsgBox(0,"Select c","Press ENTER to save location")          if $cd = 1 then             global $cdpos = MouseGetPos()          EndIf       Case $msg = $d          global $dcc = MsgBox(0,"Select d","Press ENTER to save location")          if $dcc = 1 then             global $dccpos = MouseGetPos()          EndIf       Case $msg = $e          global $eill = MsgBox(0,"Select e","Press ENTER to save location")          if $eill = 1 then             global $epos = MouseGetPos()          EndIf       Case $msg = $start          WinActivate("[CLASS:Notepad]", "")          if $i = 1 THEN ;~             while $i>0                MouseMove($bnpos[0],$bnpos[1],10);bn                sleep(300)                MouseMove($epos[0],$epos[1],10);e                sleep(300)                MouseMove($apos1[0],$apos1[1],10);bn                sleep(2000)                MouseMove($dccpos[0],$dccpos[1],10);dcc                sleep(1250)                MouseMove($cdpos[0],$cdpos[1],10);cd                sleep(300)                MouseMove($epos[0],$epos[1],10);e                sleep(300)                MouseMove($apos1[0],$apos1[1],10);e                sleep(300)                MouseMove($epos[0],$epos[1],10);e                sleep(300) ;~             wend          EndIf    EndSelect    If $msg = $GUI_EVENt_CLOSE Then exitloop WEnd GUIDelete() func terminate()    Exit EndFunc

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>