Jump to content

Run 2 While loops at once?


 Share

Recommended Posts

4 hours ago, JockoDundee said:

Assuming you don’t mean like this:

While True
   While Random(0,1 1)
   WEnd
WEnd

then you need two programs.

(Just a typo) - you surely mean :  While Random(0, 1, 1) 

@Dxnny :

It is already very late here in Germany, so I may have misinterpreted your question 😴. In principle, While...Loops can be nested :

Global $vLoop1 = 1, $vLoop2 = 1, $i = 0
While $vLoop2 <= 3
    ConsoleWrite(" --------------------------------------------- " & @CRLF)
    While $vLoop1 <= 5
        $i += 1
        ConsoleWrite("value i = " & StringFormat("%3i", $i) & "  outer Loop = " & $vLoop2 & "  inner Loop = " & $vLoop1 & @CRLF)
        $vLoop1 += 1
    WEnd
    $vLoop2 += 1
    $vLoop1 = 1
WEnd

Also take a look at nested-loop

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Link to comment
Share on other sites

I pretty liked the attempt of this guy to make emulated thread in AutoIt. 

That allows you to run 2 while at same time. 

 

But it will be the same as doing what @JockoDundee said you. This UDF will run the two loop in different instances of AutoIt. But from one single script. 

The way this UDF work is not really approved by the good practice of AutoIt. Maybe it worth the try of it for you ?

 

https://github.com/jesobreira/authread

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

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...