Page 1 of 1

Can a Thread run a function in main script?

Posted: 11 Nov 2022, 08:26
by murataygun
1. Main script --> Create thread
2. Main script --> Run a function on thread ( dll.ahkFunction() as in docs.)
3. Thread does some work and inform main script.

How can i make thread to run a function on main script?

I know that ahkFunction waits for thread function to return but my thread waits for callbacks.

Thank you.

Re: Can a Thread run a function in main script?  Topic is solved

Posted: 11 Nov 2022, 08:35
by murataygun
I figured out that;

When you define
AhkExe := AhkExported()
in thread. You can do it like;
AhkExe.ahkFunction["myFunction"]

Re: Can a Thread run a function in main script?

Posted: 07 May 2024, 02:46
by bloom11
cool so you mean to run a function on the second secondary thread you have to call ahkExported() in it and then call the name of the function as you did. Isn't it the opposite, like calling ahkexported first from the main thread and then calling the function in the thread as you did ? And about the parameter like if I need to pass an object which is a reference to a big array how does it work in this case?