autohotkey multi-threading

Get help with using AutoHotkey and its commands and hotkeys
Posts: 40
Joined: 27 Sep 2017, 22:38

autohotkey multi-threading

20 Nov 2017, 20:18

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

for example, i wanna run hotkey f1, f2 simultaneously.(actual scripts are much more complicated.)
but can't run this because autohotkey is not multi-threading program
how can i run this?
Posts: 142
Joined: 26 Jun 2017, 08:12

Re: autohotkey multi-threading

20 Nov 2017, 20:52

here is an example of fake multi thread:

Code: [Select all] [Expand] [Download] (Untitled.ahk)GeSHi © Codebox Plus

User avatar
Capn Odin
Posts: 1288
Joined: 23 Feb 2016, 19:45
Location: Denmark

Re: autohotkey multi-threading

20 Nov 2017, 21:06

In AutoHotkey_L the closest thing to multi-threading is to run multiple scripts at the same time. However it possible to achieve a similar effect using SetTimer, this will alternate between executing the difference threads instead of executing them at the same time.
AutoHotkey_H has native support of multi-threading see AhkThread.

Edit: here is an example using SetTimers

Code: [Select all] [Expand] [Download] (timerExample.ahk)GeSHi © Codebox Plus

Please excuse my spelling I am dyslexic.
Posts: 36
Joined: 21 Aug 2017, 01:15

Re: autohotkey multi-threading

22 Nov 2017, 15:38

There is a very useful function, LoadFile(), by lexikos. It creates separate processes using pipe and allows the main script to communicate with child processes by sharing objects. It's worth trying.

Return to “Ask For Help”

Who is online

Users browsing this forum: IsaacElenbaas, jamie1992, krpi and 47 guests