How can i run two loops at the same time Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
A random guy
Posts: 31
Joined: 10 Feb 2017, 19:55

How can i run two loops at the same time

11 Mar 2017, 20:15

So i'm trying to run a loop while checking for a message from another script. This is not my actual code but has the same concept.

Code: Select all

Test = 1
OnMessage(0x5555, "MsgMonitor")
; this is the loop
if Test = 1
msgbox, 4144, test, test
sleep, 60000

; this is what i want while that loop is happening 
Test := %wParam%
User avatar
Posts: 2876
Joined: 17 Oct 2015, 20:28

Re: How can i run two loops at the same time  Topic is solved

11 Mar 2017, 20:19

To answer the title, you'd use SetTimer instead of Loop.

However, you don't need a loop to check for the message. OnMessage() does that for you. Once you have executed that line, the script in the background will wait for the message. When it gets it, it'll execute the label (or function) you assigned in OnMessage().

Return to “Ask For Help”

Who is online

Users browsing this forum: GTM, Rohwedder, timoshina and 360 guests