Champak Posted May 18, 2006 Share Posted May 18, 2006 I'm trying to do a loop based on a condition without forming 2 totally seporate loop statements, so this is what I did: For If $Formating = 1 Then $a = 1 To $looping - 1 Else $a = 1 To $looping EndIf I'm getting an error with this. I've tried various combonations surrounding this small statement, but all of them produce errors. Is something like this possible, or do I need to do two entire loop functions? Link to comment Share on other sites More sharing options...
seandisanti Posted May 18, 2006 Share Posted May 18, 2006 (edited) I'm trying to do a loop based on a condition without forming 2 totally seporate loop statements, so this is what I did: For If $Formating = 1 Then $a = 1 To $looping - 1 Else $a = 1 To $looping EndIf I'm getting an error with this. I've tried various combonations surrounding this small statement, but all of them produce errors. Is something like this possible, or do I need to do two entire loop functions?why not just: If $formatting = 1 Then $step = -1 Else $step = 1 EndIf For $a = 1 To $looping Step $step ***edit*** apparently changed [ autoit] [ /autoit] tags to [ code] [ /code] tags, since the former didn't work for me... Edited May 18, 2006 by cameronsdad Link to comment Share on other sites More sharing options...
Champak Posted May 18, 2006 Author Share Posted May 18, 2006 Thanks, but that doesn't work...or at least the way I need or expect it to work. $looping is a variable input box that determines how many times the looping is suppose to function. If $Formatting = 1 then I want $looping to happen one less times. If $Formatting does not equal one, then the $looping happens to whatever number specified in the input. With what you gave me, if it equals 1, which would be "-1", the loop just happens once...meaning it doesn't loop. And the Else, will make it just continue none stop. What now? Link to comment Share on other sites More sharing options...
w0uter Posted May 18, 2006 Share Posted May 18, 2006 (edited) For $a = 1 To $looping - $Formatting ... Next only works if $formatting is 0 or 1 else you could do like if $formatting Then For $a = 1 To $looping - 1 _function() next else for $a = 1 to $looping _function() Next Endif func _function() ... endfunc typed in the brouwser so dont hang me... Edited May 18, 2006 by w0uter My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
Champak Posted May 19, 2006 Author Share Posted May 19, 2006 The second one is what I was trying to avoid because it would make the script too big. The first one was causing problems. What I did was take the idea of the first one and added something to it. I made a checkbox activate a hidden inputbox with a 1 or 0, and had the "Formatting" read that inputbox. That worked. Thanks for your help though. 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