Simultaneous loops? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
DannyB

Simultaneous loops?

01 Sep 2018, 07:23

Hi!

The script I've written relies on executing several loops. At first it was quite short and there was no delay, however as I've expanded the contents of the loops I've begun to see a noticeable delay between starting the the first and finishing the final loop.

I'm wondering if there's a way to execute multiple loops simultaneously. Either through a single AHK file/script or by splitting each loop into its own .AHK file and executing them at the same time?

Thanks in advance for the advice!
User avatar
jackdunning
Posts: 126
Joined: 01 Aug 2016, 18:17
Contact:

Re: Simultaneous loops?  Topic is solved

01 Sep 2018, 11:50

An AutoHotkey script only does one thing at a time (threads). Even if you use a command such as SetTimer to launch multiple threads, they interrupt each other—depending upon when they are launched and their priority. That's not to say the proper coordination of your loops won't save some time.

You can try breaking up the loops into different scripts. Then, you depend upon Windows to efficiently run the scripts. This may help, but the fact is that processing loops can take a long time.

You can always try getting a faster computer.

Another Thought: Can you terminate any loops earlier? Often people allow loops to continue to the end even though they have reached a desired result. Plus, do your loops require a lot of hard drive access? It's quicker to loop through a variable in memory than a file. The FileRead command with a Parsing loop works better than a file reading loop.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Anput, Rohwedder, Sniperman and 397 guests