Sign in to follow this  
Followers 0
El-Trucha

How do I run multiple loops @ the same time?

13 posts in this topic

Hello every1!! :D

I need to run several loops at once within the same script...how?? :idiot:

Thanx!! ;)

Btw, what I'm doing is................a time machine............ :lol:


El-Truchahttp://www.truchasoft.tk[url="ftp://tsfc.homeftp.net"]ftp://tsfc.homeftp.net[/url]hotline://tsfc.ath.cx

Share this post


Link to post
Share on other sites

#2 ·  Posted (edited)

Hello every1!!  :D

I need to run several loops at once within the same script...how??  :idiot:

Thanx!! ;)

Btw, what I'm doing is................a time machine............ :lol:

<{POST_SNAPBACK}>

For having them run at EXACTLY the same time you have to have multiple autoit programs running.

Otherwise you can mix all the functions withen ONE loop.

You can also nest them by just having the loop withen the loop like:

For $countA = 1 To 5
     For $countB = 1 to 5
          MsgBox(0,'',$countA & @CRLF & $countB)
     Next
Next
Edited by Wolvereness

Offering any help to anyone (to my capabilities of course)Want to say thanks? Click here! [quote name='Albert Einstein']Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.[/quote][quote name='Wolvereness' date='7:35PM Central, Jan 11, 2005']I'm NEVER wrong, I call it something else[/quote]

Share this post


Link to post
Share on other sites

Oooohh...ok...the problem is that all my functions have loops in them!! :idiot:

Thanx!! :D


El-Truchahttp://www.truchasoft.tk[url="ftp://tsfc.homeftp.net"]ftp://tsfc.homeftp.net[/url]hotline://tsfc.ath.cx

Share this post


Link to post
Share on other sites

You can't run more than one function at once anyway.


My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote]

Share this post


Link to post
Share on other sites

Ohh...well, I'll find a way 2 do it then... :idiot:

Thanx!! :D


El-Truchahttp://www.truchasoft.tk[url="ftp://tsfc.homeftp.net"]ftp://tsfc.homeftp.net[/url]hotline://tsfc.ath.cx

Share this post


Link to post
Share on other sites

This is possibly closest thing to 2 loops at once, that you can have.

You can have several functions in the main while loop.

$x is just inserted, to make it safely stop at 10 loops.

example:

Run('notepad')

$x = 1
while $x < 10
   $x = $x + 1
   WinWaitActive('Untitled')
   Send(@sec & 'loop' & @cr)
   loop()
WEnd

Func loop()
   While 1
      WinWaitActive('Untitled')
      Send(@sec & 'func' & @cr)
      ExitLoop
   WEnd
EndFunc

Share this post


Link to post
Share on other sites

Yah, thats what I was doing till now... :idiot:

Thanx!!! :D


El-Truchahttp://www.truchasoft.tk[url="ftp://tsfc.homeftp.net"]ftp://tsfc.homeftp.net[/url]hotline://tsfc.ath.cx

Share this post


Link to post
Share on other sites

For running your script code in concurrent pathes you would need threads.

Sorry currently no threads support for scripts in AutoIt.

(As far as i know the AutoIt engine uses additional threads when needed, but does not expose threading to direct use by scripts.)

Alternatively You can split Your code and run it in parallel processes by starting multiple AutoIt scripts.

Share this post


Link to post
Share on other sites

Umm...I'm gonna run 2 scripts @ the same time... :idiot:

But can one script access the other script's variables??

Both scripts/loops need 2 access GUI variables... :D

Thanx!! :lol:


El-Truchahttp://www.truchasoft.tk[url="ftp://tsfc.homeftp.net"]ftp://tsfc.homeftp.net[/url]hotline://tsfc.ath.cx

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

What about adding FileRead and FileWrite to the loops that both scripts will access?

That way you could make sure that both scripts have access to the variables you need?

Set up a section that will poll the file for the variable you're looking for about once every 250 to 500 msec

Edited for spelling

Edited by Blue_Drache

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites

Hmm...how would I do that??

Sorry, I dont get it... :idiot:


El-Truchahttp://www.truchasoft.tk[url="ftp://tsfc.homeftp.net"]ftp://tsfc.homeftp.net[/url]hotline://tsfc.ath.cx

Share this post


Link to post
Share on other sites

If Your scripts have windows (even hidden) you can pass data by setting the contents of one windows (hidden) control (e.g. text for a text control by using ControlSetText) from the other window.

Share this post


Link to post
Share on other sites

Oooohh...ok, thanx!! :idiot:


El-Truchahttp://www.truchasoft.tk[url="ftp://tsfc.homeftp.net"]ftp://tsfc.homeftp.net[/url]hotline://tsfc.ath.cx

Share this post


Link to post
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
Sign in to follow this  
Followers 0