I am not sure about the best way to go about it, whether by controlID or whatever; but, for testing purposes, when I select a checkbox, I should be able write to the console the entire column/array that I selected.....but I am unable to do so and have tried several iterations of it. By doing so, this should let me (in the future) run through each array, row by row. But for now, I would like to be able to correlate the checkbox with the array/column I selected.
Code:
AutoIt
#cs Solution to that is to move the window to the same screen location every time the program is run or the loop recycles. Or test to see if it's on the X/Y you want and if not, force it there. #ce #include <file.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> Global $a_csv $s_Path = FileOpenDialog("Select CVS File", @ScriptDir, "comma seperated values (*.csv)") If @error Then MsgBox(4096, "", "No File(s) chosen") Exit Else _FileReadToArray($s_Path, $a_csv) GUICreate("CSV Listview", 900, 450, -1, -1) $listview = GUICtrlCreateListView(StringReplace($a_csv[1], ",", "|"), 10, 10, 600, 210) $checkboxName = StringSplit($a_csv[1], ",") $iCount = $checkboxName[0] ;consolewrite($iCount) ;creating buttons Global $aCheck[$iCount + 1] Global $mapColumn[$iCount + 1] $nextSample = GUICtrlCreateButton("Map sample submition button ", 395, 320, 180, 30) $runProg = GUICtrlCreateButton("Run Program", 700, 400, 180, 30) For $j = 1 To $iCount ; Store controIDs of the checkboxes $aCheck[$j] = GUICtrlCreateCheckbox($checkboxName[$j], 10, 190 + (50 * $j), 100, 30) $mapColumn[$j] = GUICtrlCreateButton("Map " & '"' & $checkboxName[$j] & '"' & " to input box", 150, 190 + (50 * $j), 180, 30) GUICtrlSetState($aCheck[$j], $GUI_UNCHECKED) GUICtrlSetState($mapColumn[$j], $GUI_DISABLE) ;ConsoleWrite($aCheck[1]) Next For $i = 2 To UBound($a_csv) - 1 $s_temp = StringReplace($a_csv[$i], ",", "|") GUICtrlCreateListViewItem($s_temp, $listview) Next ;~ #cs -- Below Global $aOut[''][''] for $i = 2 to $a_csv[0] $aLine = stringsplit($a_csv[$i] , ",",3) If ubound($aLine) > ubound($aOut , 2) Then redim $aOut[$i][ubound($aLine)] _ArrayAdd($aOut , $a_csv[$i] , 0 , ",") ;consolewrite("line: " & $aLine[2] & @LF) next ;~ #ce -- See above EndIf GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop Case Else For $i = 1 To $iCount If $msg = $aCheck[$i] Then If GUICtrlRead($msg) = 1 Then GUICtrlSetState($mapColumn[$i], $GUI_ENABLE) Else GUICtrlSetState($mapColumn[$i], $GUI_DISABLE) EndIf ExitLoop EndIf Next EndSwitch WEnd Exit
CSV:
AutoIt
material_name,material_alias,period,letter HT-000001331,,r1,A1 HT-000001330,alias 3 not 4,r2,A2 dummy,,,A3 RS-000001336,,r4,A4 HT-000001335,,r2,A5 dummy,,,A6 HT-000001334,,r2,A7 HT-000001328,alias1,r1,A8 HT-000001333,,r2,B1 dummy,,,B2 dummy,,,B3 HT-000001332,,r1,B4 dummy,,,B5 HT-000001332,,r2,B6 HT-000001329,alias 2,r2,B7 dummy,,,B8 dummy,,,C1 dummy,,,C2 HT-000001329,alias 2,r1,C3 HT-000001334,,r1,C4 RS-000001336,,r1,C5 dummy,,,C6 HT-000001333,,r1,C7 dummy,,,C8 dummy,,,D1 dummy,,,D2 dummy,,,D3 dummy,,,D4 RS-000001336,,r2,D5 dummy,,,D6 HT-000001330,alias 3 not 4,r1,D7 HT-000001331,,r2,D8 dummy,,,E1 dummy,,,E2 HT-000001335,,r1,E3 RS-000001336,,r3,E4 dummy,,,E5 RS-000001336,,r5,E6 HT-000001328,alias1,r2,E7 dummy,,,E8
Thanks guys!
Tim