Code: Select all
Engagement_IN_ARRAY := []
Loop, read, % A_ScriptDir "\Engagement_Codes.txt" ; reading file that is within the script directory for engagement codes and description
{
Loop, parse, A_LoopReadLine, `n, ";" ; read file line by line
{
Readin_ARRAY := StrSplit(A_loopReadLine, "|") ; looking for | as the delimiter
x := Readin_ARRAY[1] ; taking the string before (engagement code) the delimiter and writing it to a variable
y := Readin_ARRAY[2] ; taking the string after (description) the delimiter and writing it to a variable
Description_IN_ARRAY[y] := x ; setting description as the key and engagement code as the value
}
}
After the user has selected the appropriate drop-down item from the combobox from the GUI, I want to pass that value to a loop below that will feed that variable as the key into the array to obtain the matching value. The problem that I keep running into is the call to the associative array either breaks at run time or returns a null value (current code displays a null). I've validated that the variable "Eng_desc_loop_var" is successfully passing the right information from the combobox, but the "Eng_code_loop_var" isn't appropriately pulling from the associative array. I believe this might be a syntax issue, any help would be greatly appreciated.
Code: Select all
ArrayCountC := 0
while ArrayCountC < 8
{
ArrayCountC += 1
GUI_Eng_var := "Eng" . ArrayCountC ; building variable to be able to loop through GUI inputs
GuiControlGet, Eng_desc_loop_var,, %GUI_Eng_var% ; defining GUI inputs as variables
Eng_code_loop_var := Description_IN_ARRAY[Eng_desc_loop_var]
}