Jump to content

Consecutive Loops - (Moved)


Go to solution Solved by spudw2k,

Recommended Posts

  • Solution

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 by spudw2k
Link to comment
Share on other sites

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

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

  • Moderators
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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...