Sign in to follow this  
Followers 0
desertcolt

mutiple threads

6 posts in this topic

I have two functions as seperate au3 files and I have a top.au3 script like

---------------------------

#include "file1.au3"

#include "file2.au3"

func1()

func2()

---------------------------

The above functions execute one by one BUT I want both the functions to execute simultaneously. How I can do that ?

Share this post


Link to post
Share on other sites



You have to turn the scripts into .exe's to use Run() or use Run() in conjunction with AutoIt3.exe. Make sure you call the function at the beginning of the scripts.

Because of the way AutoIt is setup... we dont support multi threading from one script. If you want 2 things done at the same time you have to run 2 scripts at the same time. (Though it wont really be at the exact same time).

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

Welcome to the forums!

Depending on what you're trying to do, sometimes it's possible to achieve the working of two functions within the one function (through clever use of TimerInit() and TimerDiff(), etc.).

If you feel like posting your code we might be able to help you do it this way if running two scripts simultaneously doesn't appeal to you.

Share this post


Link to post
Share on other sites

In particular, my last post to this thread might give you some inspiration depending on what you want to achieve.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

This should work. You must compile it to an exe.

#NoTrayIcon

If $CmdLine[0] = 1 And $CmdLine[1] == "!func1" Then
    AutoItWinSetTitle("!func1")
    func1()
    Exit
EndIf

Run('"' & @ScriptFullPath & '" !func1')
WinWait("!func1")
func2()
WinWaitClose("!func1"); syncronize
msgbox(0, "both funcs done", "")
Exit

Func func1()
   msgbox(0, "Function One", "")
EndFunc

Func func2()
   msgbox(0, "Function Two", "")
EndFunc
Edited by tylo

blub

Share this post


Link to post
Share on other sites

This should work. You must compile it to an exe.

I can't even see the box with this one! :whistle:

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