Page 1 of 1

async method ?

Posted: 03 Jul 2019, 16:22
by bourdin07
I really wish to see async method in v2, or other possibility to create a worker thread

Re: async method ?

Posted: 03 Jul 2019, 16:26
by guest3456
you could use AHK_H

Re: async method ?

Posted: 03 Jul 2019, 16:27
by wolf_II
Have you tried SetTimer with Period = -1 :?:

Re: async method ?

Posted: 06 Jul 2019, 13:31
by bourdin07
hello,
do you have exemple code?

Re: async method ?

Posted: 06 Jul 2019, 13:49
by wolf_II
Try this:

Code: Select all

#Persistent
SetTimer, WorkerThread, -1


WorkerThread:
    ToolTip, WorkerThread at work
    sleep, 2000
    ToolTip, WorkerThread done
return
I hope that helps.

This is AHK v1 code!
AHK v2 does not yet offer multithreading, As far as I know.

If your question is not aimed at me, ignore please and sorry. AHK_H is the way to go, as mentioned before.

Re: async method ?

Posted: 25 Jul 2019, 09:19
by bourdin07
in my opinion async implementation must be the priority for AutoHotkey v2

Re: async method ?

Posted: 25 Jul 2019, 20:12
by kczx3
Something along the lines of Promises as in JavaScript would be helpful. I’ve considered trying to implement it myself but haven’t taken the dive yet.

Re: async method ?

Posted: 26 Jul 2019, 02:31
by Ragnar
You can also execute code as a new process. See Run example #3 (ExecScript).

Re: async method ?

Posted: 26 Jul 2019, 21:12
by lexikos
I think this is outside the scope of v2.0 or the development forum. Perhaps Ask for Help/v2 would be more appropriate to explore the current options, otherwise Wish List (although in that case there are sure to be existing topics that cover this).

Re: async method ?

Posted: 28 Jul 2019, 13:18
by iseahound
Something similar is needed for despite there being work-arounds. Hopefully we not Promises though.

Re: async method ?

Posted: 28 Jul 2019, 14:05
by kczx3
Care to explain your dissatisfaction with Promises?

Re: async method ?

Posted: 28 Jul 2019, 15:48
by iseahound
They're hard to understand initially, very verbose, and their generalized structure is the monad (which Promises are not.) I skimmed through a few of these articles. 1, 2