Kralamour Posted Sunday at 06:21 AM Posted Sunday at 06:21 AM Hello, I have this code : Global $nbClass = Number(GUICtrlRead($ClassNumber)) If $nbClass > 0 Then While $ok2 MsgBox(0, '', "is ok") Else while $ok4 _logMessage("Class number must be one number.", 0) $ok4 = False WEnd WEnd EndIf I want show message logmessage if $classnumber is up to 0. But why i exit all loop, i want repeat error _logMessage("Class number must be one number.", 0) And when is one number up to 0, I exit all loop. THX
Developers Jos Posted Sunday at 07:49 AM Developers Posted Sunday at 07:49 AM (edited) This can't be code that runs. Post some example code that works and demonstrates your problem. Edited Sunday at 07:50 AM by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Kralamour Posted Sunday at 09:00 AM Author Posted Sunday at 09:00 AM hello. I send my code : Global $ok2 = True Global $ok3 = True MsgBox(0, '$ok2', $ok2) MsgBox(0, '$ok3', $ok3) Global $nbFarm = Number(GUICtrlRead($ClassNumber)) while $ok2 While $ok3 If $nbclass Then MsgBox(0, '', 'class ok') $ok2 = False Else MsgBox(0, 'ERROR', "Class number must be one number.") $ok2 = False ;ExitLoop EndIf WEnd WEnd
Kralamour Posted Sunday at 09:02 AM Author Posted Sunday at 09:02 AM Global $ok2 = True Global $ok3 = True MsgBox(0, '$ok2', $ok2) MsgBox(0, '$ok3', $ok3) Global $nbclass = Number(GUICtrlRead($ClassNumber)) while $ok2 While $ok3 If $nbclass Then MsgBox(0, '', 'class ok') $ok2 = False Else MsgBox(0, 'ERROR', "Class number must be one number.") $ok2 = False ;ExitLoop EndIf WEnd WEnd
Dan_555 Posted Sunday at 09:05 AM Posted Sunday at 09:05 AM (edited) Please post a code with the needed gui elements ... something that we can copy/paste and run to see what is not going ok. something like this: GUICreate("hi", 320, 200) $ClassNumber = GUICtrlCreateInput("1", 1, 1, 30, 30) GUISetState() Global $ok2 = True Global $ok3 = True MsgBox(0, '$ok2', $ok2) MsgBox(0, '$ok3', $ok3) While $ok2 While $ok3 Global $nbclass = Number(GUICtrlRead($ClassNumber)) If $nbclass Then MsgBox(0, '', 'class ok' & @crlf & $nbclass & @CRLF & "Is it a number: " & IsNumber($nbclass) & @crlf & "Is it an integer: " & IsInt($nbclass)) $ok2 = False Else MsgBox(0, 'ERROR', "Class number must be one number.") $ok2 = False ;ExitLoop EndIf WEnd WEnd Edited Sunday at 09:18 AM by Dan_555 Some of my script sourcecode
Developers Jos Posted Sunday at 09:23 AM Developers Posted Sunday at 09:23 AM (edited) 24 minutes ago, Kralamour said: hello. I send my code : Guess you haven't tried to run that, as it won't run! Also, please try to make your code better readable by tidying it with proper indentations: Global $ok2 = True Global $ok3 = True MsgBox(0, '$ok2', $ok2) MsgBox(0, '$ok3', $ok3) Global $nbclass = Number(GUICtrlRead($ClassNumber)) While $ok2 While $ok3 If $nbclass Then MsgBox(0, '', 'class ok') $ok2 = False Else MsgBox(0, 'ERROR', "Class number must be one number.") $ok2 = False ;ExitLoop EndIf WEnd WEnd This way you can see that the code really doesn't make any sense having these 2 While-Wend loops, of which one depends on $ok3, which will never change in your code. Also the ok2 will never change as you aren't updating $nbclass inside the While-Wend loops. Edited Sunday at 09:25 AM by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Developers Jos Posted Sunday at 09:30 AM Developers Posted Sunday at 09:30 AM No shit, Yuchan is back.... This isn't going to end well. Somerset and argumentum 2 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Kralamour Posted Sunday at 10:20 AM Author Posted Sunday at 10:20 AM Thank you. If i take this code : GUICreate("hi", 320, 200) $ClassNumber = GUICtrlCreateInput("1", 1, 1, 30, 30) GUISetState() Global $nbclass = Number(GUICtrlRead($ClassNumber)) While $ok2 While $ok3 If $nbclass Then MsgBox(0, '', 'class ok') $ok2 = False Else MsgBox(0, 'ERROR', "Class number must be one number.") $ok2 = False ;ExitLoop EndIf WEnd WEnd I don't know how to ask everytime a class value in input and not send error if classnumber is one number up to 1 value THX
Somerset Posted Sunday at 11:02 AM Posted Sunday at 11:02 AM The classnumber you are trying to use is on the wrong floor, and your hallpass to get there is poorly written.
Kralamour Posted Sunday at 11:26 AM Author Posted Sunday at 11:26 AM Hello, Sorry i not understand. What's is wrong with this code ?
Developers Jos Posted Sunday at 01:22 PM Developers Posted Sunday at 01:22 PM (edited) Just THINK and RTFM in an effort to understand your own code. comeback when you have some progress to show for. Edited Sunday at 01:23 PM by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Kralamour Posted Sunday at 03:06 PM Author Posted Sunday at 03:06 PM I have this but don't work at 100% I don't know hot close message box for edit input because is 0 or not number I have write and try is my code, i can't make more : Global $ok2 = True GUICreate("test", 320, 200) $ClassNumber = GUICtrlCreateInput("1", 1, 1, 30, 30) GUISetState() Global $nbclass = Number(GUICtrlRead($ClassNumber)) while $ok2 If $nbclass > 0 Then MsgBox(0, '', 'class ok, number up to 0') ;exit while $ok2 = False Else MsgBox(0, 'ERROR', "Class number must be one number = or upo to 0.") $ok2 = False #ASK AGAIN A NUMBER BECAUSE IS WRONG EndIf WEnd Please i very need help. I think is easy but i have never make this.
Kralamour Posted Sunday at 03:13 PM Author Posted Sunday at 03:13 PM Global $ok2 = True GUICreate("test", 320, 200) $ClassNumber = GUICtrlCreateInput("1", 1, 1, 30, 30) GUISetState() Global $nbclass = Number(GUICtrlRead($ClassNumber)) while $ok2 If $nbclass > 0 Then MsgBox(0, '', 'class ok, number up to 0') ;exit while $ok2 = False Else MsgBox(0, 'ERROR', "Class number must be one number = or upo to 0.") $ok2 = False ;ASK AGAIN A NUMBER BECAUSE IS WRONG EndIf WEnd
Dan_555 Posted Sunday at 03:57 PM Posted Sunday at 03:57 PM Your code does not work because you are not reading the input field for the number in the loop. Some of my script sourcecode
Kralamour Posted Sunday at 10:22 PM Author Posted Sunday at 10:22 PM Hello thank you. I have this now : GUICreate("test", 320, 200) $ClassNumber = GUICtrlCreateInput("1", 1, 1, 30, 30) GUISetState() While $ok2 Global $ok2 = True Global $ok3 = True MsgBox(0, '', $ok2) Global $nbclass = Number(GUICtrlRead($ClassNumber)) If $nbclass Then MsgBox(0, '', 'class ok') $ok2 = False Else While $ok3 MsgBox(0, 'ERROR', "Class number must be one number.") $ok3 = False ExitLoop WEnd EndIf WEnd All is ok but why i not exit loop in *else* Every time he show erreor msgbox.
argumentum Posted Sunday at 11:07 PM Posted Sunday at 11:07 PM 35 minutes ago, Kralamour said: I have this now : My english is limited. I tend to speak code but I'll use language because your coding is.... without practical use. What do you envision ?, what's the idea ?. If you present your practical need for a real scenario maybe we ( any of us here ) can give you a better head start. Welcome to coding..., does your nick mean "king of love" ?, meh, welcome to the forum 42 minutes ago, Kralamour said: While $ok2 Global $ok2 = True Global $ok3 = True ...and, don't declare a global in a loop. Do something like: ... ... Global $ok2 = True, $ok3 = True While $ok2 $ok2 = True $ok3 = True ... ... Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
Kralamour Posted Monday at 12:14 AM Author Posted Monday at 12:14 AM Hello. From where are you ? For my code i have edit : Global $ok2 = True Global $ok3 = True GUICreate("test", 320, 200) $ClassNumber = GUICtrlCreateInput("1", 1, 1, 30, 30) GUISetState() While $ok2 Global $nbclass = Number(GUICtrlRead($ClassNumber)) If $nbclass Then MsgBox(0, '', 'class ok') $ok2 = False Else While $ok3 MsgBox(0, 'ERROR', "Class number must be one number.") $ok3 = False ExitLoop WEnd EndIf WEnd But when i have click on error message after if i edit classnumber i don"t have message. I think isd because he is on one loop. Can you help me please ?
argumentum Posted Monday at 01:06 AM Posted Monday at 01:06 AM 51 minutes ago, Kralamour said: From where are you ? Argentina 51 minutes ago, Kralamour said: Can you help me please ? ..not really because: 1 hour ago, argumentum said: What do you envision ?, what's the idea ?. If you present your practical need for a real scenario maybe we ( any of us here ) can give you a better head start. Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
Kralamour Posted Monday at 02:27 AM Author Posted Monday at 02:27 AM I have one INPUT on my GUI. I want check if this INPUT are up to 0. If INPUT VALUE is 0 i want say withg MsgBox to enter a true value. If all is ok, leave loop
argumentum Posted Monday at 02:31 AM Posted Monday at 02:31 AM ok, give me 5 min. Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
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