Jump to content

Help with AutoIt Func and loop


Recommended Posts

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.

Link to comment
Share on other sites

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