How to create a thread inside another thread?

Ask for help, how to use AHK_H, etc.
terrypaton2
Posts: 15
Joined: 03 Aug 2018, 20:35

How to create a thread inside another thread?

18 Aug 2018, 02:04

Hi,
I want to create a subThread inside a MainThread , I tried code below but I get a error.

I use AHK_H v1 64bit 1.1.29

Code: Select all

Loop, 2
{
	MainThreads[A_Index]:=AhkThread("
	(
	
	#NoEnv
	SetBatchLines -1
	ListLines Off
	global disNoxPlayerX:=120
	global disNoxPlayerY:=120
	
		;Dosomething
	
		SubThreads:=AhkThread(""
		(
		
			msgbox % A_Args[1]
		
		
		)"",1)
	
	
	)",A_index)
}
How to create a thread inside another thread?
HotKeyIt
Posts: 1711
Joined: 29 Sep 2013, 18:35
Contact:

Re: How to create a thread inside another thread?

18 Aug 2018, 16:08

You are using continuation section within continuation section!
For AutoHotkey your first continuation section ends at ending for second (included) continuation section.
You can add " " to make clear that it does not end here, also use `% inside continuation section!

Code: Select all

Loop, 2
{
	MainThreads[A_Index]:=AhkThread("
	(
	
	#NoEnv
	#Persistent
	SetBatchLines -1
	ListLines Off
	global disNoxPlayerX:=120
	global disNoxPlayerY:=120
	
		;Dosomething
	
		SubThreads:=AhkThread(""
		(
		
			msgbox `% A_Args[1]
		
		
		" ")""," A_Index ")
	
	
	)",A_index)
}
Sleep 1000
MsgBox End

Return to “Ask For Help”

Who is online

Users browsing this forum: No registered users and 5 guests