Jump to content

how to create two or more loops and executed at the same time ?


Smurfin
 Share

Recommended Posts

hi, can anyone give a hint how to create two loops but executed at the same time, like running 2 compiled exe.

for example i want to freeze a value in memory using nomadmemory's _memorypointerwrite udf and loop it using while, and i want to put some other things in the loop but they have some delay in it using sleep(), if I put together in one loop, the _memorypointerwrite will be affected by the delay, but if i use two 'while' , it'll be nested in one of the 'while' until it terminates, so how do i make them running at the same time ?

Link to comment
Share on other sites

Autoit is not a multithreaded application, so you can not do that directly. However there may be other ways of doing what you want by approaching things in a different manner.

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Link to comment
Share on other sites

Hi Lo Smurfin........

Thats intresting......

Just a idea about this......not a programer but having a loop inside another loop is kinda bad.....

Now this might not help but here is a way to get around the problem.....and of coarse you will have to taylor it to your needs.

Most Loops will start with something to keep them running and when this value or page or whatever is no longer .........well the rollercoaster stops.

You did say you were wanting to use the While type of loop so lets do that one.

Global $nl

$nl = 0; this value will change

$x = 1

;-------------------------------------------------------------------

While $x = 1;rem this would be main loop

;The thing about call up a loop from a loop it just keeps banning away.......so you want to have some control over it......

If $x = 1 and $nl = 0 then; this should send it to your loop........but we do not want it coming back......

NextLoop()

Endif

Wend; End of main loop

;---------------------------------------------------------------------

Func NextLoop();Your next loop

$nl = 1; Setting another value to $nl so it will not come back from main loop

While $nl = 1

;your script

Wend

EndFunc

;---------------------------------------------------------------------

I am pretty sure this will be shot down by some else that actually knows something but it seems to work....if you want to have a few loops running at the same time......

Oh yes and think about a reset point where you reset you $nl back to zero

hope it helps

zz

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