Rubbadubbadoo Posted May 18, 2022 Share Posted May 18, 2022 I am trying to write a script that will run two loops consecutively. Example would be something like: While1 repeat 20x Goto While2 While2 repeat 20x Goto While1 Any advice is appreciated. Link to comment Share on other sites More sharing options...
Solution spudw2k Posted May 18, 2022 Solution Share Posted May 18, 2022 (edited) I'm sure there is a method that can suit your needs. Will both loops always run the same number of times? If so, and depending on how complicated the activities are for each loop, you could create two functions for each "task" and then just run them both in sequence. For example Global $iLoopCount = 20 For $iX = 1 to $iLoopCount TaskA($iX) TaskB($iX) Next Func TaskA($iX) ConsoleWrite("Task A: " & $iX & " of " & $iLoopCount & " iterations" & @CRLF) ;do stuff EndFunc Func TaskB($iX) ConsoleWrite("Task B: " & $iX & " of " & $iLoopCount & " iterations" & @CRLF) ;do stuff EndFunc We may ask you to share some code or what you are trying to accomplish to better understand how to help. edit: Actually, I think I misread/misunderstood what you want to do. There is nothing stopping you from having one loop, then another. Use a FOR LOOP if you want to run a loop exactly X many times. For $iX = 1 to 20 ;do stuff Next For $iX = 1 to 20 ;do other stuff Next Edited May 18, 2022 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 18, 2022 Moderators Share Posted May 18, 2022 Moved to the appropriate AutoIt General Help and Support forum, as the AutoIt Example Scripts forum very clearly states: Quote Share your cool AutoIt scripts, UDFs and applications with others. Do not post general support questions here, instead use the AutoIt Help and Support forums. Moderation Team 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...
Rubbadubbadoo Posted May 19, 2022 Author Share Posted May 19, 2022 Thank you spudw2k! Both of those examples are exactly what I was looking for. I am new to this forum and do not know how to post my script but.... What I was after looks something like this: Global $Paused, $Runner HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") While 1 For $iX = 1 to 20 msgbox(1,"Title","1") ; This is an inline comment Next For $iX = 1 to 20 msgbox(1,"Title","2") ; This is an inline comment Next Wend Exit Func TogglePause() $Paused = Not $Paused While $Paused Sleep(100) ToolTip('Script is "Paused"', 0, 0) WEnd ToolTip("") EndFunc ;==>TogglePause Func Terminate() Exit 0 EndFunc ;==>Terminate Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 19, 2022 Moderators Share Posted May 19, 2022 36 minutes ago, Rubbadubbadoo said: I am new to this forum and do not know how to post my script When you post code in future please use Code tags - see here how to do it. Then you get a scrolling box and syntax colouring as you can see above now I have added the tags. Thanks in advance for your cooperation. 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...
Skysnake Posted May 23, 2022 Share Posted May 23, 2022 I'm sure this will be your next question https://www.autoitscript.com/wiki/Arrays#Comparing_Arrays Skysnake Why is the snake in the sky? 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