Page 1 of 1

How to add parameters into AhkThread ?

Posted: 26 Mar 2018, 04:19
by gameba

Code: Select all

threads:=[]
Loop 4
threads[A_Index]:=AhkThread("
(
	msgbox `% A_Args[1]
	msgbox `% A_Args[2]
	msgbox `% A_Args[3]

)", "1 2 %A_Index%")

ESC::
ExitAPP
I tried add parameter to AhkThread. A_Args[1], A_Args[2] work fine, but A_Args[3] not get A_Index value. Pls, Help me!

Re: How to add parameters into AhkThread ?  Topic is solved

Posted: 26 Mar 2018, 18:30
by HotKeyIt

Code: Select all

threads:=[]
Loop 4
threads[A_Index]:=AhkThread("
(
	msgbox `% A_Args[1]
	msgbox `% A_Args[2]
	msgbox `% A_Args[3]

)", "1 2 " A_Index)

ESC::
ExitAPP

Re: How to add parameters into AhkThread ?

Posted: 26 Mar 2018, 20:47
by guest3456
ahk v2 used to allow this syntax:

"1 2 %A_Index%"

but lexikos removed it. so you can no longer deference inside a quoted string, so you have to do it the same as in v1 as HotKeyIt showed

Re: How to add parameters into AhkThread ?

Posted: 01 May 2018, 22:13
by Galaxis
HotKeyIt wrote:

Code: Select all

threads:=[]
Loop 4
threads[A_Index]:=AhkThread("
(
	msgbox `% A_Args[1]
	msgbox `% A_Args[2]
	msgbox `% A_Args[3]

)", "1 2 " A_Index)

ESC::
ExitAPP

Noob question- i just started using AHK_H recently for its multithreading. I was curious about the usage of ("( )") and its function. If I had to guess, it seems similar to concatenate. Is this the sole method for going to a new line- making the code look all neat and crisp? I don't remember that being possible in normal AHK

Re: How to add parameters into AhkThread ?

Posted: 01 May 2018, 23:47
by swagfag
thats the continuation section from ahk_l
though there are some differences in behaviour switching from v1 to v2

https://autohotkey.com/docs/Scripts.htm#continuation
https://lexikos.github.io/v2/docs/Scrip ... ntinuation

Re: How to add parameters into AhkThread ?

Posted: 02 May 2018, 11:49
by Galaxis
Ur awesome! thanks