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!
Simultaneous loops? Topic is solved
- jackdunning
- Posts: 126
- Joined: 01 Aug 2016, 18:17
- Contact:
Re: Simultaneous loops? Topic is solved
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.
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.
Jack Dunning
I have a passion for helping new users grow maniacal about AutoHotkey Windows scripting.
Jack's AutoHotkey Blog
Free AutoHotkey Scripts and Apps for Learning Script Writing and Generating Ideas
AutoHotkey Books
AutoHotkey Library Bundles
Jack's Motley Assortment of AutoHotkey Tips
I have a passion for helping new users grow maniacal about AutoHotkey Windows scripting.
Jack's AutoHotkey Blog
Free AutoHotkey Scripts and Apps for Learning Script Writing and Generating Ideas
AutoHotkey Books
AutoHotkey Library Bundles
Jack's Motley Assortment of AutoHotkey Tips