Sign in to follow this  
Followers 0
KenNichols

1 Easy Question

7 posts in this topic

Please forgive me as I am new.

Is it possible to run 2 completely separate tasks at the same time?

I just found out that I can not run 2 functions at the same time. But I need to be able to run 2 completely separate tasks at 100ms intervals and the problem is if one of the values is true it could take a few seconds for the first task to complete and at that point it would be to late for second task to run so I need them to run independent from one another. I am using While 1 right now.

Thanks,

Ken Nichols


[topic="21048"]New to AutoIt? Check out AutoIt 1-2-3![/topic] Need to make a GUI? You NEED KODA FormDesigner!

Share this post


Link to post
Share on other sites



you could always have two separate scripts that check on the process of the other running script before it does it's next function.


Giggity

Share this post


Link to post
Share on other sites

you could always have two separate scripts that check on the process of the other running script before it does it's next function.

2 scripts with 1 GUI? where could I find an example?


[topic="21048"]New to AutoIt? Check out AutoIt 1-2-3![/topic] Need to make a GUI? You NEED KODA FormDesigner!

Share this post


Link to post
Share on other sites

No he meant 2 totally different scripts. But if you are using a GUI, have one exe be for the GUI, one be for process 'a', one for process 'b', etc, depending on your need.

Autoit isn't multithreaded, so 1 script is only going to do one thing at a time.


While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd

Share this post


Link to post
Share on other sites

No he meant 2 totally different scripts. But if you are using a GUI, have one exe be for the GUI, one be for process 'a', one for process 'b', etc, depending on your need.

Autoit isn't multithreaded, so 1 script is only going to do one thing at a time.

So I could have the GUI run the other 2 scripts Run("Process a.exe" And "Process b.exe") and call functions from them using the GUI?


[topic="21048"]New to AutoIt? Check out AutoIt 1-2-3![/topic] Need to make a GUI? You NEED KODA FormDesigner!

Share this post


Link to post
Share on other sites

You'd have to be a little bit creative. Depending on what your end need is, you could pass command line parameters to each called exe (called from the GUI) noting what function you need to run, then on the called exe side have an if/then statement checking the command line parameter passed and running whatever function.

There are options open to you, it depends on what you need to be done and what level coding you are. There are a lot of topics on the forum regarding multithreading, running 2 exe's, and communicating between 2 or more running scripts. I would suggest you do some reading at what solutions the other people have found and see if any lightbulbs go off.


While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd

Share this post


Link to post
Share on other sites

You'd have to be a little bit creative. Depending on what your end need is, you could pass command line parameters to each called exe (called from the GUI) noting what function you need to run, then on the called exe side have an if/then statement checking the command line parameter passed and running whatever function.

There are options open to you, it depends on what you need to be done and what level coding you are. There are a lot of topics on the forum regarding multithreading, running 2 exe's, and communicating between 2 or more running scripts. I would suggest you do some reading at what solutions the other people have found and see if any lightbulbs go off.

Sound like a plan. Thanks for your help.


[topic="21048"]New to AutoIt? Check out AutoIt 1-2-3![/topic] Need to make a GUI? You NEED KODA FormDesigner!

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