Jump to content
Sign in to follow this  
AfterBurn

Help with AutoIt Func and loop

Recommended Posts

AfterBurn

Ok i am wondering is there a way to make two func's loop at the same time. I have writen a script and I have func 1() and func 2() I loop them using the While command, but I have to wait for Func 1() to finish before Func 2() will start so is it possible to make Func 1() loop at the same time Func 2() is looping. Please Help.

Share this post


Link to post
Share on other sites
AfterBurn

You can't multithread, but you can AdlibRegister.

SO how would I add this adlib code to my script heres a example

MsgBox(4096 ,"Test Program","Looks like it is working", 30)

Run("C:\Users\daddysputter\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Accessories\NotePad.exe")
Sleep(2000)


Func one()
winwaitactive("notepad.exe")    
    Sleep(2000)
    Send("(2 down}") 
    Sleep(10000)
    Send("{2 up}")
EndFunc

Func two()
    winwaitactive("notepad.exe")
    Send("a")
    Sleep(1000)
    Send('b")
EndFunc
    
    
    While 1
        one()
        two()
    WEnd

THank for the respons I was afriad I couldnt multithread, guess I was right. Thanks again.

Edited by AfterBurn

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.