Sinisterly
Help In AutoIt Loops Please! - Printable Version

+- Sinisterly (https://sinister.li)
+-- Forum: Coding (https://sinister.li/Forum-Coding)
+--- Forum: Coding (https://sinister.li/Forum-Coding--71)
+--- Thread: Help In AutoIt Loops Please! (/Thread-Help-In-AutoIt-Loops-Please)



Help In AutoIt Loops Please! - Kilo - 11-08-2011

so i have a code, to calculate what someone got on a test (just practicing basic stuff.) and i have this so far:

Code:
Dim $GradeGot = InputBox("Grade You Got","Now Enter The Grade You Got",0) Dim $Maxgrade = InputBox("Max Grade","Enter The Max Grade You Could Have Got. (Example: 45 out of 50. Enter the 50)",0) Dim $Percent = $GradeGot/$Maxgrade*100 Switch 1 Case $Maxgrade = 0 MsgBox(0,"Error","Please Enter a Number Bigger Then 0") Case $Percent > 0 MsgBox(0, "Percent Recevied", "You Got a " & $Percent & " % On Your Test.") EndSwitch

and it works, but i want to get it a little better, because when i use it and say you enter 0 as the max grade you could have gotten well i have a message pop up saying enter something other then 0, but then it ends the program, how can i make it so it will loop it back up towhere you enter the number again?
thanks Smile


RE: Help In AutoIt Loops Please! - 1234hotmaster - 11-08-2011

Code:
_Main() Func _Main() Dim $GradeGot = InputBox("Grade You Got","Now Enter The Grade You Got",0) Dim $Maxgrade = InputBox("Max Grade","Enter The Max Grade You Could Have Got. (Example: 45 out of 50. Enter the 50)",0) If $Maxgrade <= 0 Or $GradeGot <= 0 Then MsgBox(16,"Error","Please Enter a Number Bigger Then 0",1) _Main() Else Dim $Percent = $GradeGot/$Maxgrade*100 MsgBox(0, "Percent Recevied", "You Got a " & $Percent & " % On Your Test.") EndIf EndFunc

Not the best way but works Wink


RE: Help In AutoIt Loops Please! - Kilo - 11-08-2011

thanks! it works, ull need to explain this some more sometime for me Smile