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

Post AHK_H specific scripts & libraries and discuss the usage and development of HotKeyIt's fork/branch
murataygun
Posts: 104
Joined: 07 Aug 2015, 15:53

Can a Thread run a function in main script?

11 Nov 2022, 08:26

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.
murataygun
Posts: 104
Joined: 07 Aug 2015, 15:53

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

11 Nov 2022, 08:35

I figured out that;

When you define
AhkExe := AhkExported()
in thread. You can do it like;
AhkExe.ahkFunction["myFunction"]
bloom11
Posts: 4
Joined: 12 Oct 2022, 14:06

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

07 May 2024, 02:46

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?

Return to “AutoHotkey_H”

Who is online

Users browsing this forum: No registered users and 4 guests