Login Register






Help In AutoIt Loops Please! filter_list
Author
Message
Help In AutoIt Loops Please! #1
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

Reply

RE: Help In AutoIt Loops Please! #2
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
Pierce the life fibers with your drill.

Reply

RE: Help In AutoIt Loops Please! #3
thanks! it works, ull need to explain this some more sometime for me Smile

Reply