I'm experiencing a problem to add Dynamic variable within the AhkThread.
In the code below the program reads a .txt file that has columns and rows, I need to present the same information it presents in the CheckScript: label but it does not recognize the dynamic variable.
Script.ahk
Code: Select all
Gui, Font, s30
Gui, Add, Button, w200 h80 gStart, Start
Gui, Show, , Dynamic variable in AhkThread
return
CheckScript:
d=`;
TotalLine=
Loop, Read, %A_scriptDir%\test.txt
{
TotalLine = %A_Index%
COLUMN2=
COLUMN3=
COLUMN4=
COLUMN5=
COLUMN6=
StringSplit, COLUMN, A_LoopReadLine, %d%,
VarCOLUMN2Line%TotalLine% = %COLUMN2%
VarCOLUMN3Line%TotalLine% = %COLUMN3%
VarCOLUMN4Line%TotalLine% = %COLUMN4%
VarCOLUMN5Line%TotalLine% = %COLUMN5%
VarCOLUMN6Line%TotalLine% = %COLUMN6%
MsgBox, % VarCOLUMN3Line%TotalLine% ; <------------ HERE OK
}
return
toggle := 0
Start:
toggle := !toggle
if (toggle) {
gosub, CheckScript
VarCrit := CriticalObject({"TotalLine":TotalLine})
script:="
("
#NoEnv
#NoTrayIcon
ListLines Off
#KeyHistory 0
SendMode Input
SetTitleMatchMode 2
SetTitleMatchMode Fast
SetDefaultMouseSpeed, 0
Loop {
VarCrit := CriticalObject(A_Args[1])
CoordMode, Tooltip
CoordMode, Pixel, Screen
CoordMode, Mouse
TotalLine = `% VarCrit.TotalLine
Loop, %TotalLine%
{
Count = %A_Index%
Col2Check = VarCOLUMN2Linha%Count% ; <------------ DONT WORK
Col3Check = % VarCOLUMN3Linha%Count% ; <------------ DONT WORK WITH %
Col4Check = VarCOLUMN4Linha%Count% ; <------------ DONT WORK
Col5Check = % VarCOLUMN5Linha%Count% ; <------------ DONT WORK WITH %
Col6Check = VarCOLUMN6Linha%Count% ; <------------ DONT WORK
MsgBox, Col2Check: %Col2Check%
MsgBox, Col3Check: %Col3Check%
MsgBox, Col4Check: %Col4Check%
MsgBox, Col5Check: %Col5Check%
MsgBox, Col6Check: %Col6Check%
}
}
)"
DllOn:=AhkThread(script,&VarCrit)
} else {
DllOn.ahkTerminate.1
}
return
GuiClose:
ExitApp
Code: Select all
1;1;+1;NoCondition;Wait;8
2;5;-2;NoCondition;Wait;8
3;1;0;NoCondition;Wait;8
4;2;-5;NoCondition;Wait;8
5;3;+7;NoCondition;Wait;8