Shams Posted July 20, 2015 Share Posted July 20, 2015 (edited) Hi Guys,I became familiar with Autoit just recently and trying to automate a software. The problem is that as I run it, the Do loop is not working. I want to know if there is any problems with the loop or not.... would you guys please help meDo $String_1 = InputBox ( "Unit Type", "Select your Unit type : Sub for Sub-critical, Super for Super-critical, Ultra for Ultra Super-critical") Until $String_1 = "Sub" or "Super" or "Ultra" If $String_1 = "Sub" Then Send ( "{Up}") ElseIf $String_1 = "Super" Then Send ( "") ElseIf $String_1 = "Ultra" Then Send ( "{down}") EndIfI want to use the output of the Do loop for the next stages. Edited July 20, 2015 by Jos Link to comment Share on other sites More sharing options...
mikell Posted July 20, 2015 Share Posted July 20, 2015 Until $String_1 = "Sub" or "Super" or "Ultra"should beUntil $String_1 = "Sub" or $String_1 = "Super" or $String_1 = "Ultra"BTW you also should use the code tags to post code Link to comment Share on other sites More sharing options...
Shams Posted July 20, 2015 Author Share Posted July 20, 2015 Thanks Mikell, I do not know what code tags are, but it worked and it is now fine. Thanks Link to comment Share on other sites More sharing options...
Developers Jos Posted July 20, 2015 Developers Share Posted July 20, 2015 CodeTags are like he shown in his answer... oh wait he didn't use the either. Click the <> icon in the editor when posting and paste your code there.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. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted July 20, 2015 Moderators Share Posted July 20, 2015 Code tags (<> button in the toolbar when you post) turn this:Do $String_1 = InputBox ( "Unit Type", "Select your Unit type : Sub for Sub-critical, Super for Super-critical, Ultra for Ultra Super-critical") Until $String_1 = "Sub" or "Super" or "Ultra" If $String_1 = "Sub" Then Send ( "{Up}") ElseIf $String_1 = "Super" Then Send ( "") ElseIf $String_1 = "Ultra" Then Send ( "{down}") EndIf...into this...Do $String_1 = InputBox ( "Unit Type", "Select your Unit type : Sub for Sub-critical, Super for Super-critical, Ultra for Ultra Super-critical") Until $String_1 = "Sub" or "Super" or "Ultra" If $String_1 = "Sub" Then Send ( "{Up}") ElseIf $String_1 = "Super" Then Send ( "") ElseIf $String_1 = "Ultra" Then Send ( "{down}") EndIf...and keep our eyes from bleeding as we try to read your code "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
JohnOne Posted July 20, 2015 Share Posted July 20, 2015 If you have a lot of that in your code, just make a little function to help.Do $Input = InputBox("title", "prompt") Until _StringIs($Input, "Sub|Super|Ultra") Func _StringIs($String, $SubString) If Not StringInStr($SubString, "|") Then Return ($String == $SubString) EndIf $aStrings = StringSplit($SubString, "|", 2) For $i = 0 To UBound($aStrings) - 1 If $String == $aStrings[$i] Then Return True EndIf Next Return False EndFunc Rockerfeller and 232showtime 2 AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
232showtime Posted July 22, 2015 Share Posted July 22, 2015 Good day @JohnOne your example is good for practising coding skills, but how do I make it to not case sensitive?I have tried like thisDo $Input = InputBox("title", "prompt") Until _StringIs($Input, "Sub|Super|Ultra|sub|super|ultra") Func _StringIs($String, $SubString) If Not StringInStr($SubString, "|") Then Return ($String == $SubString) EndIf $aStrings = StringSplit($SubString, "|", 2) For $i = 0 To UBound($aStrings) - 1 If $String == $aStrings[$i] Then Return MsgBox(64, "", $Input) EndIf Next Return False EndFuncit worked but is there any other way to make it not casesensitive??? ill get to that... i still need to learn and understand a lot of codes Correct answer, learn to walk before you take on that marathon. Link to comment Share on other sites More sharing options...
Exit Posted July 22, 2015 Share Posted July 22, 2015 Just replace '==' with '=' 232showtime 1 App: Au3toCmd UDF: _SingleScript() Link to comment Share on other sites More sharing options...
ViciousXUSMC Posted July 22, 2015 Share Posted July 22, 2015 You could try a combobox in a GUI to list the options so that users can only choose the options you offer them rather than looping them through an inputbox until they provide a proper answer. I just wanted to come up with my own strange solution to this where I could use this code for the combobox but since its an inputbox it loops back to the function until a proper answer is given. Test() Func Test() $vInput = InputBox("Unit Type", "Select your Unit type : Sub for Sub-critical, Super for Super-critical, Ultra for Ultra Super-critical") Switch $vInput Case "Sub" MsgBox(0, "", "Good Answer - Sub") Case "Super" MsgBox(0, "", "Good Answer - Super") Case "Ultra" MsgBox(0, "", "Good Answer - Ultra") Case Else Test() EndSwitch EndFunc Link to comment Share on other sites More sharing options...
232showtime Posted July 23, 2015 Share Posted July 23, 2015 Just replace '==' with '='thanks, you got a sharp eye didnt notice this lineIf $String == $aStrings[$i] ;"==" ill get to that... i still need to learn and understand a lot of codes Correct answer, learn to walk before you take on that marathon. 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