iAmNewbe

How To Call a Function Simultaneously X Times?

3 posts in this topic

I have a function that has multiple loops inside of it.  AutoIT waits for each loop to complete before continuing.  I need to run this loop concurrently X times, how can I do this?
I am using the current public stable build of AutoIT
 

Func MyFunction($num)
  For Loop
      Nested For Loop
          Nested For Loop
              Do STUFF
          Next
      Next
  Next
EndFunc

While Loop
    Switch $num
        Case 10     
            MyFunction(1)
        Case 20    
            MyFunction(2)
        Case 30    
            MyFunction(3)
    EndSwitch
EndWhile


I thought of using recursion but that resulted in same thing, waiting for the loops to complete before going to the next iteration of the function.

I need to run this simultaneously, I read in the help documentation that Functions are treated as objects but using isObj on the function the result was 0 not an object..  I am confused.

Thoughts on how to do what I need here?

Share this post


Link to post
Share on other sites



Hello iAmNewbe,

AutoIt can't run multiple functions at the same time. One way to achieve this would be to create a new process to run the function each time. But it all depends on the type of program you're trying to create, it might not even be necessary. Let me know if you need further help!


s!mpL3 LAN Messenger

Current version 2.9.8.8 [30/09/2015]

Download Here

s!mpL3

Share this post


Link to post
Share on other sites

Thanks,  I read through my code again and it seems I have several logic errors so I am reworking out the logic then will recode the loops.

It would be easier if AutoIT were OOP with classes like PHP or other OOP Languages. It seems that Objects in AutoIT are referring to COM or Hardware related things and not what I initially thought.   Will post back if I have further questions.
 

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