Yeezus Posted January 12, 2016 Share Posted January 12, 2016 So I've been trying this to run this loop 10 times and then stopping.$e = 9 Do $counter=0 $counter+=1 run() sleep(2000) Until $e < $counterBut it hasn't been working. How can I make it so the loop runs a set amount of times before exiting the loop? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 12, 2016 Moderators Share Posted January 12, 2016 Yeezus,Welcome to the AutoIt forums.Look at For...To...Step...Next in the Help file - that is what you need.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...
Trong Posted January 12, 2016 Share Posted January 12, 2016 Local $nCounter=9 While $nCounter Run() $nCounter-=1 Sleep(2000) WEnd Regards, Link to comment Share on other sites More sharing options...
EmilyLove Posted January 13, 2016 Share Posted January 13, 2016 https://www.autoitscript.com/autoit3/docs/keywords/For.htm#include <MsgBoxConstants.au3> For $i = 5 To 1 Step -1 MsgBox($MB_SYSTEMMODAL, "", "Count down!" & @CRLF & $i) Next MsgBox($MB_SYSTEMMODAL, "", "Blast Off!") Link to comment Share on other sites More sharing options...
nitekram Posted January 13, 2016 Share Posted January 13, 2016 So I've been trying this to run this loop 10 times and then stopping.$e = 9 Do $counter=0 $counter+=1 run() sleep(2000) Until $e < $counterBut it hasn't been working. How can I make it so the loop runs a set amount of times before exiting the loop?The reason this will never end is because at each start of the loop, you zero out the variable you are trying to compare it to...therefore it will never be less than the counter. 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator 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