Miranda Posted April 3, 2013 Share Posted April 3, 2013 unfortunately this: $step=1 for $i=1 to 1000 step $step Tooltip($i) Sleep(50) $step+=1 Next Doesn't work (or well, the step the for loop uses is always 1) Is there a way to get this to work? Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted April 3, 2013 Moderators Share Posted April 3, 2013 (edited) Errr, your loop uses 1 because you defined $step to be 1. This works just fine for me, regardless of the number I use for $step: $step = 14 For $i = 0 To 10000 Step $step MsgBox(0, "", $i) Next Edited April 3, 2013 by JLogan3o13 "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...
kylomas Posted April 3, 2013 Share Posted April 3, 2013 Miranda,From the help file...If stepVal or stop is a variable, its value is only read the first time the loop executes.kylomasP.S. I got caught on this once too! Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 3, 2013 Moderators Share Posted April 3, 2013 Miranda, And AutoIt also only reads the loop limit values once on entry as well - which is why if you loop through an array and delete some of the elements, you must always start from the bottom and work up. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
SandelPerieanu Posted April 3, 2013 Share Posted April 3, 2013 try this: $step = 1 $i=1 Do Tooltip($i) Sleep(50) $step += 1 $i += $step Until $i>=1000 Link to comment Share on other sites More sharing options...
Mechaflash Posted April 3, 2013 Share Posted April 3, 2013 (edited) loopty-loop $step = 1 $count = 1 While 1 for $i = $count to 1000 Step $step $step=1 Tooltip($i) Sleep(50) $count+=$step $step+=1 ContinueLoop(2) Next WEnd not tested... think it'll work =D http://qkme.me/3to2md Edited April 3, 2013 by Mechaflash Spoiler “Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.” Link to comment Share on other sites More sharing options...
kylomas Posted April 3, 2013 Share Posted April 3, 2013 Miranda, This for $i=1 to 1000 step 2 Tooltip($i) Sleep(50) Next looks functionally equivalent to your OP. kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
Mechaflash Posted April 3, 2013 Share Posted April 3, 2013 Miranda, This for $i=1 to 1000 step 2 Tooltip($i) Sleep(50) Next looks functionally equivalent to your OP. kylomas I think she's hoping to keep increasing step throughout the loop and the loop registering the change in step Spoiler “Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.” Link to comment Share on other sites More sharing options...
kylomas Posted April 3, 2013 Share Posted April 3, 2013 I think she's hoping to keep increasing step throughout the loop and the loop registering the change in stepYes, but she's increasing by "1". That is why I suggested "STEP 2". Any other value and I'm with you.. Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
Mechaflash Posted April 3, 2013 Share Posted April 3, 2013 (edited) When step is 2 and it goes through the loop, then step is 3... then 4... then 5... etc. EDIT: But it's possible the OP may not have been clear either so either of us may be right/wrong EDIT2: Or even both of us may be wrong... maybe we offered her a lounging chair and a rocking chair when OP wanted a Couch =D Edited April 3, 2013 by Mechaflash Spoiler “Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.” Link to comment Share on other sites More sharing options...
kylomas Posted April 3, 2013 Share Posted April 3, 2013 Build her a condo...then she has it all... Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
Miranda Posted April 3, 2013 Author Share Posted April 3, 2013 You guys are hilarious Thanks a lot for all the answers! The first post was only a proof of concept, but I didn't think of just using do and incrementing it manually, which works perfectly Link to comment Share on other sites More sharing options...
czardas Posted April 3, 2013 Share Posted April 3, 2013 SandelPerieanu's answer is the best so far. Anyway, it's easy enough to modify the iteration count. Local $iCount = 0 For $i = 1 To 1000 ; Code here ConsoleWrite($i & @LF) $i += $iCount $iCount += 1 Next operator64 ArrayWorkshop 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