Sign in to follow this  
Followers 0
majkinetor

multithreading support ?

7 posts in this topic

#1 ·  Posted (edited)

Hi there.

I never used AutoIt before. I am comming from AHK community.

Can anybody tell me does AutoIt support real multithreading?

That is, is it possible to isolate different scripts from eatchother ?

Situtation:

I have 10 complex scripts I want to run. I don't want to start 10 instances of AutoIt but to merge all scripts into the single one. Is this possible without some specific script design construct (ie I want to grab 3th party script and just merge it with my own).

Example:

In AHK I did this

In Mother script:

Script1_Init(....)

Scritp2_Init(....)

...

ScriptN_Init(...)

return

#include Script1

...

#include Scriptn

Questions:

1. If 1 script is processing somehting and 2nd is called will it interupt the first one and if so, can it be avoided ? (multithreading)

2. How big is script isolation ? Can one script change some option that will influence other script or all options exist only in the scripts pivate memory (namespaces)

3. Are there any notes with GUI events (windows messages)

Thx in advance.

Edited by majkinetor

Share this post


Link to post
Share on other sites



Search the forum for "CoRoutine"

Share this post


Link to post
Share on other sites

Can anybody tell me does AutoIt support real multithreading?

Welcome,

AutoIt scripts do not support real multithreading for users. Only multithreading done would be within the builtin functions themselves to make them operate correctly. None for the user to make a separate thread.

""CoRoutine" is multitasking with separate processes, not multithreading.

:D

Share this post


Link to post
Share on other sites

Take a look at this UDF i just put in the scripts and scraps forum. You may find it useful though it only a multithreading work around.

http://www.autoitscript.com/forum/index.php?showtopic=29088


"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Share this post


Link to post
Share on other sites

Hypothetical situation:

script: Display little GUI counting from 1 - 10000 then doing it again.

Lets say I have 2 identical scripts named A & B doing above.

I merge them using approach described above

A_Init()

B_Init()

...

#include A

#include B

Some hotkeys are defined that will triger them

#p:: A_Run()

#n:: B_Run()

Are they going to interupt eachother? According to your posts, they will, and there is no way that both counts, only one will do, since there is no real multithreading. I could design A & B so that they know for eachother and to run for some time, then allow other script to run (for instance, A could run 10ms, then go to sleep, then B run, and so on...)

So MHz is this what you told me ? That I must run two separate instances of AutoIt driving A & B respectively to make them work at the same time ?

I wrote an article about AutoHotKey script merging technique that I designed. I could solve all other issues except this one, so script merging works for scripts that doesn't run in parallel witch is often the case with hotkeys. I just want to know can this problem be solved in AutoIt. Also, is multithreading scheduled for later implementation, that is, is it on Wish List ?

Share this post


Link to post
Share on other sites

So MHz is this what you told me ? That I must run two separate instances of AutoIt driving A & B respectively to make them work at the same time ?

If the 2 scripts were not created for running as 1, then Yes. Planning and having 2 or more Gui's sharing the same script maybe possible but would not be an efficiency gain as to 2 scripts doing it. The 2 scripts are 2 separate programs as I am mentioning.

Some of the members here are using workarounds to imitate multithreading with starting another instance or process. Not a bad idea, but I would prefer the real multithreading. I would doubt that AHK or AutoIt will have multithreading in the near future unless seemly, a massive amount of programming was done to the source to make it happen.

Multithreading might be a good option if it were available, but I'm not overly concerned for any need for it. :D

Share this post


Link to post
Share on other sites

Multithreading might be a good option if it were available, but I'm not overly concerned for any need for it. :D

I know... it is not typical user desire, rigtht ? :wacko:

I heard that too many times.

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