timdecker Posted April 15, 2015 Share Posted April 15, 2015 (edited) The program crashes in 2 places. 1st place of crash: If I click "Load File" without selecting a file, it will crash/exit out of its run. 2nd place of crash: If I select a checkbox but do NOT select an instrument and then click "Run program", it will crash/exit out of the program. What needs to be done to prevent this from happening? Code: expandcollapse popup#include <file.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <GuiListView.au3> #include <Array.au3> #include <ComboConstants.au3> #include <GuiComboBox.au3> #include <StaticConstants.au3> Global $a_csv Global $listview Global $checkboxName Global $iCount Global $runProg Global $acheck Global $mapColumn Global $runProg Global $selectInstrument Global $selectFile Global $s_Path $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) buildGUI() EndIf Func _loadNewFile() _FileReadToArray(GUICtrlRead($selectFile),$a_csv) $listview = GUICtrlCreateListView(StringReplace($a_csv[1], ",", "|"), 10, 10, 400, 210) For $i = 2 To UBound($a_csv) - 1 $s_temp = StringReplace($a_csv[$i], ",", "|") GUICtrlCreateListViewItem($s_temp, $listview) Next $checkboxName = StringSplit($a_csv[1], ",") $iCount = $checkboxName[0] Global $aCheck[$iCount + 1] Global $mapColumn[$iCount + 1] For $j = 1 To $iCount $aCheck[$j] = GUICtrlCreateCheckbox($checkboxName[$j], 10, 190 + (50 * $j), 100, 30) GUICtrlSetState($aCheck[$j], $GUI_UNCHECKED) Next EndFunc Func copyToInput() Select Case GUICtrlRead($selectInstrument) = "dummy" $textPos_1 = 4 $buttonClick_1 = 6 $buttonClick_2 = 2 $title_1 = "HPOV" $title_2 = "Job" Case GUICtrlRead($selectInstrument) = "TGA-100" $textPos_1 = 1161 $buttonClick_1 = 1152 $title_1 = "(METTLER) - TGA-100A with gas box" Case GUICtrlRead($selectInstrument) = "TGA-200" $textPos_1 = 1161 $buttonClick_1 = 1152 $title_1 = "(METTLER) - TGA-200A with gas box" Case GUICtrlRead($selectInstrument) = "AUTOCAT-100" $textPos_1 = 75 Case GUICtrlRead($selectInstrument) = "AUTOCAT-200" $textPos_1 = 15 EndSelect $allRows = _GUICtrlListView_GetItemCount($listview) For $rows = 0 to $allRows-1 $material_name = _GUICtrlListView_GetItem($listview, $rows, 0) $letter = _GUICtrlListView_GetItem($listview, $rows, 3) If GUICtrlRead($aCheck[1]) <> 1 and GUICtrlRead($aCheck[4]) <> 1 then continueloop If GUICtrlRead($aCheck[1]) = 1 Then controlsettext($title_1, "", $textPos_1, $material_name[3]) endif #cs - 2nd input box If GUICtrlRead($aCheck[4]) = 1 Then controlsettext($title, "", $textPos_2, $letter[3]) endif #ce controlclick($title_1, "", $buttonClick_1) Sleep(2000) ;there you can put some sleep(5000) = 5seconds, more or less, if u know exact applications processing time for this operation ;or ControlGetText("Myapplication title", "", CONTROL_WHICH_CHANGES_AFTER_BUTTONPRESS) and compare to older reads controlclick($title_2, "", $buttonClick_2) ;<-------------This is if there is a 2nd button to press, otherwise, comment this out Sleep(2000) ;there you can put some sleep(5000) = 5seconds, more or less, if u know exact applications processing time for this operation ;or ControlGetText("Myapplication title", "", CONTROL_WHICH_CHANGES_AFTER_BUTTONPRESS) and compare to older reads if msgbox(1,"", "You Shall Not Pass!" & @CRLF & "Ok actually you can, just press something") = 2 then ExitLoop endif Next EndFunc Func buildGUI() GUICreate("CSV Listview", 900, 450, -1, -1) $listview = GUICtrlCreateListView(StringReplace($a_csv[1], ",", "|"), 10, 10, 400, 210) GUICtrlCreateLabel("Select a sample file:", 450, 40, 200) $selectFile = GUICtrlCreateCombo("", 450, 60, 180, 200) _GUICtrlComboBox_BeginUpdate($selectFile) _GUICtrlComboBox_AddDir($selectFile, @ScriptDir & "\*.csv") _GUICtrlComboBox_EndUpdate($selectFile) $loadNewFile = GUICtrlCreateButton("Load File", 450, 80) GUICtrlCreateLabel("Select an instrument:", 700, 40, 200) $selectInstrument = GUICtrlCreateCombo("", 700, 60, 180, 25) GUICtrlSetData(-1, "dummy|TGA-100|TGA-200|AUTOCAT-100|AUTOCAT-200") $checkboxName = StringSplit($a_csv[1], ",") $iCount = $checkboxName[0] ;creating buttons ;$runProg = GUICtrlCreateButton("Run Program", 700, 400, 180, 30) $runProg = GUICtrlCreateButton("Run Program", 700, 330, 180, 30) GUICtrlSetState($runProg, $GUI_DISABLE) ;Building the checkboxes DYNAMICALLY....may need to switch to forced checkbox name ;Store controIDs of the checkboxes Global $aCheck[$iCount + 1] Global $mapColumn[$iCount + 1] For $j = 1 To $iCount $aCheck[$j] = GUICtrlCreateCheckbox($checkboxName[$j], 10, 190 + (50 * $j), 100, 30) GUICtrlSetState($aCheck[$j], $GUI_UNCHECKED) ;$mapColumn[$j] = GUICtrlCreateButton("Map " & '"' & $checkboxName[$j] & '"' & " to input box", 150, 190 + (50 * $j), 180, 30) ;GUICtrlSetState($mapColumn[$j], $GUI_DISABLE) Next For $i = 2 To UBound($a_csv) - 1 $s_temp = StringReplace($a_csv[$i], ",", "|") GUICtrlCreateListViewItem($s_temp, $listview) Next 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 Local $idCancelbutton = GUICtrlCreateButton("Exit", 700, 370, 180, 30) ; GUISetState(@SW_SHOW) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $runProg copyToInput() Case $loadNewFile _GUICtrlListView_DeleteAllItems($listview) For $i = 1 To $iCount GUICtrlDelete($aCheck[$i]) Next _loadNewFile() Case $GUI_EVENT_CLOSE, $idCancelbutton ExitLoop Case Else For $i = 1 To $iCount If $msg = $aCheck[$i] Then If GUICtrlRead($msg) = 1 Then ;GUICtrlSetState($mapColumn[$i], $GUI_ENABLE) GUICtrlSetState($runProg, $GUI_ENABLE) ;Local $text = "" ; For $k = 0 to $a_csv[0]-1 ; $text &= ControlListView ("CSV Listview", "", $listview, "GetText", $k, $i-1) & @crlf ; Next ; Msgbox(0,$checkboxName[$i], $text) ; debug, can see the list of samples you selected Else ;GUICtrlSetState($mapColumn[$i], $GUI_DISABLE) GUICtrlSetState($runProg, $GUI_DISABLE) EndIf ExitLoop EndIf Next EndSwitch WEnd GUIDelete() EndFunc Csv: material_name,material_alias,period,letter HT-000001333,,r1,C7 dummy1,,,C8 dummy2,,,D1 dummy3,,,D2 dummy4,,,D3 dummy5,,,D4 RS-000001336,,r2,D5 dummy7,,,D6 HT-000001330,alias 3 not 4,r1,D7 HT-000001331,,r2,D8 dummy8,,,E1 dummy0,,,E2 HT-000001335,,r1,E3 RS-000001336,,r3,E4 dummy11,,,E5 RS-000001336,,r5,E6 HT-000001328,alias1,r2,E7 dummy12,,,E8 Thanks, Â Tim Edited April 15, 2015 by timdecker Link to comment Share on other sites More sharing options...
MikahS Posted April 15, 2015 Share Posted April 15, 2015 Can you please post the error messages you are receiving upon each crash. Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Forum FAQ Â Link to comment Share on other sites More sharing options...
Danyfirex Posted April 15, 2015 Share Posted April 15, 2015 Hi. 1. Look over this part _loadNewFile() I think you want to load items into thet list view but you're using GUICtrlCreateListView (it create a listview control not an item) 2. I think the problem is into CopyToinput Function (continueloop, exitloop, for, next) part. Saludos  Danysys.com     AutoIt...  UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection  PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut   Link to comment Share on other sites More sharing options...
timdecker Posted April 15, 2015 Author Share Posted April 15, 2015 Can you please post the error messages you are receiving upon each crash. Â 1st place of crash: If I click "Load File" without selecting a file, it will crash/exit out of its run. Error: Subscript used on non-accessible variable. 2nd place of crash: If I select a checkbox but do NOT select an instrument and then click "Run program", it will crash/exit out of the program. Error: Variable used without being declared Link to comment Share on other sites More sharing options...
timdecker Posted April 15, 2015 Author Share Posted April 15, 2015 Hi. 1. Look over this part _loadNewFile() I think you want to load items into thet list view but you're using GUICtrlCreateListView (it create a listview control not an item) 2. I think the problem is into CopyToinput Function (continueloop, exitloop, for, next) part. Saludos  1. I had to use GUICtrlCreateListView because the headers would not change if I did not. 2. I am not sure what in that function I should change I just added the error messages above. Thanks! Tim Link to comment Share on other sites More sharing options...
Danyfirex Posted April 15, 2015 Share Posted April 15, 2015 If you got that error. use _arraydisplay to debug the array variable. Saludos  Danysys.com     AutoIt...  UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection  PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut   Link to comment Share on other sites More sharing options...
MikahS Posted April 15, 2015 Share Posted April 15, 2015 (edited) 1. Most likely I think it could be to the fact that if you do not select a file, _FileListToArray will not return an array, essentially making it so $a_csv is not actually an array. So, when you call $a_csv[1] and it isn't an array, it will exit the program. EDIT: I would add a bunch of debug code into your script. MsgBox where you think problems could be arising, or as a step through of your program. You will most likely catch the error yourself this way. Edited April 15, 2015 by MikahS Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Forum FAQ Â Link to comment Share on other sites More sharing options...
timdecker Posted April 15, 2015 Author Share Posted April 15, 2015 If you got that error. use _arraydisplay to debug the array variable. Saludos  1. Most likely I think it could be to the fact that if you do not select a file, _FileListToArray will not return an array, essentially making it so $a_csv is not actually an array. So, when you call $a_csv[1] and it isn't an array, it will exit the program.  I think the best way to solve this is to disable the button until I have selected a checkbox AND selected an instrument.... BUT I am not sure what or where to place it. Thanks, Tim Link to comment Share on other sites More sharing options...
Danyfirex Posted April 15, 2015 Share Posted April 15, 2015 Are you sure that GUICtrlRead($selectFile) into _loadNewFile() fuction is returning a valid path? Saludos  Danysys.com     AutoIt...  UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection  PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut   Link to comment Share on other sites More sharing options...
timdecker Posted April 15, 2015 Author Share Posted April 15, 2015 Are you sure that GUICtrlRead($selectFile) into _loadNewFile() fuction is returning a valid path? Saludos Yes, it works just fine if I select a file. It is when I don't select an item from the combobox that it crashes. I tried to add this to my while: If GUICtrlRead($msg) = 1 and GUICtrlRead($selectInstrument) <> "" Then But that just disables the button completely.... Link to comment Share on other sites More sharing options...
Valuater Posted April 15, 2015 Share Posted April 15, 2015 I would start with error checking... example Func _loadNewFile() Local $rFile = GUICtrlRead($selectFile) If $rFile = "" Then Return -1 _FileReadToArray($rFile, $a_csv) If Not IsArray($a_csv) Then Return -2 ... Link to comment Share on other sites More sharing options...
Danyfirex Posted April 15, 2015 Share Posted April 15, 2015 I made a simple changes look if it works. expandcollapse popup#include <file.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <GuiListView.au3> #include <Array.au3> #include <ComboConstants.au3> #include <GuiComboBox.au3> #include <StaticConstants.au3> Global $a_csv Global $listview Global $checkboxName Global $iCount Global $runProg Global $acheck Global $mapColumn Global $runProg Global $selectInstrument Global $selectFile Global $s_Path $s_Path = FileOpenDialog("Select CVS File", @ScriptDir, "comma seperated values (*.*)") If @error Then MsgBox(4096, "", "No File(s) chosen") Exit Else _FileReadToArray($s_Path, $a_csv) ;~ _ArrayDisplay($a_csv) buildGUI() EndIf Func _loadNewFile() If Not (FileExists(GUICtrlRead($selectFile))) Then MsgBox(0, "", "Should select a file in the combovox") Else cleanListview() _FileReadToArray(GUICtrlRead($selectFile), $a_csv) _ArrayDisplay($a_csv) $listview = GUICtrlCreateListView(StringReplace($a_csv[1], ",", "|"), 10, 10, 400, 210) For $i = 2 To UBound($a_csv) - 1 $s_temp = StringReplace($a_csv[$i], ",", "|") GUICtrlCreateListViewItem($s_temp, $listview) Next $checkboxName = StringSplit($a_csv[1], ",") $iCount = $checkboxName[0] Global $acheck[$iCount + 1] Global $mapColumn[$iCount + 1] For $j = 1 To $iCount $acheck[$j] = GUICtrlCreateCheckbox($checkboxName[$j], 10, 190 + (50 * $j), 100, 30) GUICtrlSetState($acheck[$j], $GUI_UNCHECKED) Next EndIf EndFunc ;==>_loadNewFile Func copyToInput() Local $title_1 Local $textPos_1 Local $material_name Local $buttonClick_1 Local $title_2 Local $buttonClick_2 Select Case GUICtrlRead($selectInstrument) = "dummy" $textPos_1 = 4 $buttonClick_1 = 6 $buttonClick_2 = 2 $title_1 = "HPOV" $title_2 = "Job" Case GUICtrlRead($selectInstrument) = "TGA-100" $textPos_1 = 1161 $buttonClick_1 = 1152 $title_1 = "(METTLER) - TGA-100A with gas box" Case GUICtrlRead($selectInstrument) = "TGA-200" $textPos_1 = 1161 $buttonClick_1 = 1152 $title_1 = "(METTLER) - TGA-200A with gas box" Case GUICtrlRead($selectInstrument) = "AUTOCAT-100" $textPos_1 = 75 Case GUICtrlRead($selectInstrument) = "AUTOCAT-200" $textPos_1 = 15 EndSelect $allRows = _GUICtrlListView_GetItemCount($listview) For $rows = 0 To $allRows - 1 $material_name = _GUICtrlListView_GetItem($listview, $rows, 0) $letter = _GUICtrlListView_GetItem($listview, $rows, 3) If GUICtrlRead($acheck[1]) <> 1 And GUICtrlRead($acheck[4]) <> 1 Then ContinueLoop If GUICtrlRead($acheck[1]) = 1 Then ControlSetText($title_1, "", $textPos_1, $material_name[3]) EndIf #cs - 2nd input box If GUICtrlRead($aCheck[4]) = 1 Then controlsettext($title, "", $textPos_2, $letter[3]) endif #ce ControlClick($title_1, "", $buttonClick_1) Sleep(2000) ;there you can put some sleep(5000) = 5seconds, more or less, if u know exact applications processing time for this operation ;or ControlGetText("Myapplication title", "", CONTROL_WHICH_CHANGES_AFTER_BUTTONPRESS) and compare to older reads ControlClick($title_2, "", $buttonClick_2) ;<-------------This is if there is a 2nd button to press, otherwise, comment this out Sleep(2000) ;there you can put some sleep(5000) = 5seconds, more or less, if u know exact applications processing time for this operation ;or ControlGetText("Myapplication title", "", CONTROL_WHICH_CHANGES_AFTER_BUTTONPRESS) and compare to older reads If MsgBox(1, "", "You Shall Not Pass!" & @CRLF & "Ok actually you can, just press something") = 2 Then EndIf Next EndFunc ;==>copyToInput Func buildGUI() GUICreate("CSV Listview", 900, 450, -1, -1) $listview = GUICtrlCreateListView(StringReplace($a_csv[1], ",", "|"), 10, 10, 400, 210) GUICtrlCreateLabel("Select a sample file:", 450, 40, 200) $selectFile = GUICtrlCreateCombo("", 450, 60, 180, 200) _GUICtrlComboBox_BeginUpdate($selectFile) _GUICtrlComboBox_AddDir($selectFile, @ScriptDir & "\*.csv") _GUICtrlComboBox_EndUpdate($selectFile) $loadNewFile = GUICtrlCreateButton("Load File", 450, 80) GUICtrlCreateLabel("Select an instrument:", 700, 40, 200) $selectInstrument = GUICtrlCreateCombo("", 700, 60, 180, 25) GUICtrlSetData(-1, "dummy|TGA-100|TGA-200|AUTOCAT-100|AUTOCAT-200") $checkboxName = StringSplit($a_csv[1], ",") $iCount = $checkboxName[0] ;creating buttons ;$runProg = GUICtrlCreateButton("Run Program", 700, 400, 180, 30) $runProg = GUICtrlCreateButton("Run Program", 700, 330, 180, 30) GUICtrlSetState($runProg, $GUI_DISABLE) ;Building the checkboxes DYNAMICALLY....may need to switch to forced checkbox name ;Store controIDs of the checkboxes Global $acheck[$iCount + 1] Global $mapColumn[$iCount + 1] For $j = 1 To $iCount $acheck[$j] = GUICtrlCreateCheckbox($checkboxName[$j], 10, 190 + (50 * $j), 100, 30) GUICtrlSetState($acheck[$j], $GUI_UNCHECKED) ;$mapColumn[$j] = GUICtrlCreateButton("Map " & '"' & $checkboxName[$j] & '"' & " to input box", 150, 190 + (50 * $j), 180, 30) ;GUICtrlSetState($mapColumn[$j], $GUI_DISABLE) Next For $i = 2 To UBound($a_csv) - 1 $s_temp = StringReplace($a_csv[$i], ",", "|") GUICtrlCreateListViewItem($s_temp, $listview) Next 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 Local $idCancelbutton = GUICtrlCreateButton("Exit", 700, 370, 180, 30) ; GUISetState(@SW_SHOW) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $runProg copyToInput() Case $loadNewFile _loadNewFile() Case $GUI_EVENT_CLOSE, $idCancelbutton ExitLoop Case Else For $i = 1 To $iCount If $msg = $acheck[$i] Then If GUICtrlRead($msg) = 1 Then ;GUICtrlSetState($mapColumn[$i], $GUI_ENABLE) GUICtrlSetState($runProg, $GUI_ENABLE) ;Local $text = "" ; For $k = 0 to $a_csv[0]-1 ; $text &= ControlListView ("CSV Listview", "", $listview, "GetText", $k, $i-1) & @crlf ; Next ; Msgbox(0,$checkboxName[$i], $text) ; debug, can see the list of samples you selected Else ;GUICtrlSetState($mapColumn[$i], $GUI_DISABLE) GUICtrlSetState($runProg, $GUI_DISABLE) EndIf ExitLoop EndIf Next EndSwitch WEnd GUIDelete() EndFunc ;==>buildGUI Func cleanListview() _GUICtrlListView_DeleteAllItems($listview) For $i = 1 To $iCount GUICtrlDelete($acheck[$i]) Next EndFunc ;==>cleanListview Saludos  Danysys.com     AutoIt...  UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection  PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut   Link to comment Share on other sites More sharing options...
timdecker Posted April 15, 2015 Author Share Posted April 15, 2015 I made a simple changes look if it works. expandcollapse popup#include <file.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <GuiListView.au3> #include <Array.au3> #include <ComboConstants.au3> #include <GuiComboBox.au3> #include <StaticConstants.au3> Global $a_csv Global $listview Global $checkboxName Global $iCount Global $runProg Global $acheck Global $mapColumn Global $runProg Global $selectInstrument Global $selectFile Global $s_Path $s_Path = FileOpenDialog("Select CVS File", @ScriptDir, "comma seperated values (*.*)") If @error Then MsgBox(4096, "", "No File(s) chosen") Exit Else _FileReadToArray($s_Path, $a_csv) ;~ _ArrayDisplay($a_csv) buildGUI() EndIf Func _loadNewFile() If Not (FileExists(GUICtrlRead($selectFile))) Then MsgBox(0, "", "Should select a file in the combovox") Else cleanListview() _FileReadToArray(GUICtrlRead($selectFile), $a_csv) _ArrayDisplay($a_csv) $listview = GUICtrlCreateListView(StringReplace($a_csv[1], ",", "|"), 10, 10, 400, 210) For $i = 2 To UBound($a_csv) - 1 $s_temp = StringReplace($a_csv[$i], ",", "|") GUICtrlCreateListViewItem($s_temp, $listview) Next $checkboxName = StringSplit($a_csv[1], ",") $iCount = $checkboxName[0] Global $acheck[$iCount + 1] Global $mapColumn[$iCount + 1] For $j = 1 To $iCount $acheck[$j] = GUICtrlCreateCheckbox($checkboxName[$j], 10, 190 + (50 * $j), 100, 30) GUICtrlSetState($acheck[$j], $GUI_UNCHECKED) Next EndIf EndFunc ;==>_loadNewFile Func copyToInput() Local $title_1 Local $textPos_1 Local $material_name Local $buttonClick_1 Local $title_2 Local $buttonClick_2 Select Case GUICtrlRead($selectInstrument) = "dummy" $textPos_1 = 4 $buttonClick_1 = 6 $buttonClick_2 = 2 $title_1 = "HPOV" $title_2 = "Job" Case GUICtrlRead($selectInstrument) = "TGA-100" $textPos_1 = 1161 $buttonClick_1 = 1152 $title_1 = "(METTLER) - TGA-100A with gas box" Case GUICtrlRead($selectInstrument) = "TGA-200" $textPos_1 = 1161 $buttonClick_1 = 1152 $title_1 = "(METTLER) - TGA-200A with gas box" Case GUICtrlRead($selectInstrument) = "AUTOCAT-100" $textPos_1 = 75 Case GUICtrlRead($selectInstrument) = "AUTOCAT-200" $textPos_1 = 15 EndSelect $allRows = _GUICtrlListView_GetItemCount($listview) For $rows = 0 To $allRows - 1 $material_name = _GUICtrlListView_GetItem($listview, $rows, 0) $letter = _GUICtrlListView_GetItem($listview, $rows, 3) If GUICtrlRead($acheck[1]) <> 1 And GUICtrlRead($acheck[4]) <> 1 Then ContinueLoop If GUICtrlRead($acheck[1]) = 1 Then ControlSetText($title_1, "", $textPos_1, $material_name[3]) EndIf #cs - 2nd input box If GUICtrlRead($aCheck[4]) = 1 Then controlsettext($title, "", $textPos_2, $letter[3]) endif #ce ControlClick($title_1, "", $buttonClick_1) Sleep(2000) ;there you can put some sleep(5000) = 5seconds, more or less, if u know exact applications processing time for this operation ;or ControlGetText("Myapplication title", "", CONTROL_WHICH_CHANGES_AFTER_BUTTONPRESS) and compare to older reads ControlClick($title_2, "", $buttonClick_2) ;<-------------This is if there is a 2nd button to press, otherwise, comment this out Sleep(2000) ;there you can put some sleep(5000) = 5seconds, more or less, if u know exact applications processing time for this operation ;or ControlGetText("Myapplication title", "", CONTROL_WHICH_CHANGES_AFTER_BUTTONPRESS) and compare to older reads If MsgBox(1, "", "You Shall Not Pass!" & @CRLF & "Ok actually you can, just press something") = 2 Then EndIf Next EndFunc ;==>copyToInput Func buildGUI() GUICreate("CSV Listview", 900, 450, -1, -1) $listview = GUICtrlCreateListView(StringReplace($a_csv[1], ",", "|"), 10, 10, 400, 210) GUICtrlCreateLabel("Select a sample file:", 450, 40, 200) $selectFile = GUICtrlCreateCombo("", 450, 60, 180, 200) _GUICtrlComboBox_BeginUpdate($selectFile) _GUICtrlComboBox_AddDir($selectFile, @ScriptDir & "\*.csv") _GUICtrlComboBox_EndUpdate($selectFile) $loadNewFile = GUICtrlCreateButton("Load File", 450, 80) GUICtrlCreateLabel("Select an instrument:", 700, 40, 200) $selectInstrument = GUICtrlCreateCombo("", 700, 60, 180, 25) GUICtrlSetData(-1, "dummy|TGA-100|TGA-200|AUTOCAT-100|AUTOCAT-200") $checkboxName = StringSplit($a_csv[1], ",") $iCount = $checkboxName[0] ;creating buttons ;$runProg = GUICtrlCreateButton("Run Program", 700, 400, 180, 30) $runProg = GUICtrlCreateButton("Run Program", 700, 330, 180, 30) GUICtrlSetState($runProg, $GUI_DISABLE) ;Building the checkboxes DYNAMICALLY....may need to switch to forced checkbox name ;Store controIDs of the checkboxes Global $acheck[$iCount + 1] Global $mapColumn[$iCount + 1] For $j = 1 To $iCount $acheck[$j] = GUICtrlCreateCheckbox($checkboxName[$j], 10, 190 + (50 * $j), 100, 30) GUICtrlSetState($acheck[$j], $GUI_UNCHECKED) ;$mapColumn[$j] = GUICtrlCreateButton("Map " & '"' & $checkboxName[$j] & '"' & " to input box", 150, 190 + (50 * $j), 180, 30) ;GUICtrlSetState($mapColumn[$j], $GUI_DISABLE) Next For $i = 2 To UBound($a_csv) - 1 $s_temp = StringReplace($a_csv[$i], ",", "|") GUICtrlCreateListViewItem($s_temp, $listview) Next 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 Local $idCancelbutton = GUICtrlCreateButton("Exit", 700, 370, 180, 30) ; GUISetState(@SW_SHOW) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $runProg copyToInput() Case $loadNewFile _loadNewFile() Case $GUI_EVENT_CLOSE, $idCancelbutton ExitLoop Case Else For $i = 1 To $iCount If $msg = $acheck[$i] Then If GUICtrlRead($msg) = 1 Then ;GUICtrlSetState($mapColumn[$i], $GUI_ENABLE) GUICtrlSetState($runProg, $GUI_ENABLE) ;Local $text = "" ; For $k = 0 to $a_csv[0]-1 ; $text &= ControlListView ("CSV Listview", "", $listview, "GetText", $k, $i-1) & @crlf ; Next ; Msgbox(0,$checkboxName[$i], $text) ; debug, can see the list of samples you selected Else ;GUICtrlSetState($mapColumn[$i], $GUI_DISABLE) GUICtrlSetState($runProg, $GUI_DISABLE) EndIf ExitLoop EndIf Next EndSwitch WEnd GUIDelete() EndFunc ;==>buildGUI Func cleanListview() _GUICtrlListView_DeleteAllItems($listview) For $i = 1 To $iCount GUICtrlDelete($acheck[$i]) Next EndFunc ;==>cleanListview Saludos  Thanks, That solved the problem for the load file, but not "Run Program". When I do that, it changes the button names and makes it impoosible to exit out of the loop. Link to comment Share on other sites More sharing options...
MikahS Posted April 15, 2015 Share Posted April 15, 2015 (edited) What is the significance of these in your copyToInput() function. It looks like they are declared and being used, but they don't have any value. Local $title_1 Local $textPos_1 Local $material_name Local $buttonClick_1 Local $title_2 Local $buttonClick_2 Just saw it was your code Dany, my bad. EDIT: did not see them in the case statement, I should have known, as I wrote the dang switch statement for him. Edited April 15, 2015 by MikahS Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use.                                                                              Forum FAQ  Link to comment Share on other sites More sharing options...
Danyfirex Posted April 15, 2015 Share Posted April 15, 2015 (edited) Is just to tell "Autoit interpreter $variable exist") I usually set some value. but for be fast I left them(their) clean. lol I can't remember how to write good english. Saludos Edited April 15, 2015 by Danyfirex  Danysys.com     AutoIt...  UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection  PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut   Link to comment Share on other sites More sharing options...
MikahS Posted April 15, 2015 Share Posted April 15, 2015 Tim can you give us the line you recieved the 2nd error on. Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use.                                                                              Forum FAQ  Link to comment Share on other sites More sharing options...
Danyfirex Posted April 15, 2015 Share Posted April 15, 2015 Try this: expandcollapse popup#include <file.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <GuiListView.au3> #include <Array.au3> #include <ComboConstants.au3> #include <GuiComboBox.au3> #include <StaticConstants.au3> Global $a_csv Global $listview Global $checkboxName Global $iCount Global $runProg Global $acheck Global $mapColumn Global $selectInstrument Global $selectFile Global $s_Path $s_Path = FileOpenDialog("Select CVS File", @ScriptDir, "comma seperated values (*.*)") If @error Then MsgBox(4096, "", "No File(s) chosen") Exit Else _FileReadToArray($s_Path, $a_csv) ;~ _ArrayDisplay($a_csv) buildGUI() EndIf Func _loadNewFile() If Not (FileExists(GUICtrlRead($selectFile))) Then MsgBox(0, "", "Should select a file in the combovox") Else cleanListview() _FileReadToArray(GUICtrlRead($selectFile), $a_csv) _ArrayDisplay($a_csv) $listview = GUICtrlCreateListView(StringReplace($a_csv[1], ",", "|"), 10, 10, 400, 210) For $i = 2 To UBound($a_csv) - 1 $s_temp = StringReplace($a_csv[$i], ",", "|") GUICtrlCreateListViewItem($s_temp, $listview) Next $checkboxName = StringSplit($a_csv[1], ",") $iCount = $checkboxName[0] Global $acheck[$iCount + 1] Global $mapColumn[$iCount + 1] For $j = 1 To $iCount $acheck[$j] = GUICtrlCreateCheckbox($checkboxName[$j], 10, 190 + (50 * $j), 100, 30) GUICtrlSetState($acheck[$j], $GUI_UNCHECKED) Next EndIf EndFunc ;==>_loadNewFile Func copyToInput() Local $title_1 Local $textPos_1 Local $material_name Local $buttonClick_1 Local $title_2 Local $buttonClick_2 Select Case GUICtrlRead($selectInstrument) = "dummy" $textPos_1 = 4 $buttonClick_1 = 6 $buttonClick_2 = 2 $title_1 = "HPOV" $title_2 = "Job" Case GUICtrlRead($selectInstrument) = "TGA-100" $textPos_1 = 1161 $buttonClick_1 = 1152 $title_1 = "(METTLER) - TGA-100A with gas box" Case GUICtrlRead($selectInstrument) = "TGA-200" $textPos_1 = 1161 $buttonClick_1 = 1152 $title_1 = "(METTLER) - TGA-200A with gas box" Case GUICtrlRead($selectInstrument) = "AUTOCAT-100" $textPos_1 = 75 Case GUICtrlRead($selectInstrument) = "AUTOCAT-200" $textPos_1 = 15 EndSelect $allRows = _GUICtrlListView_GetItemCount($listview) For $rows = 0 To $allRows - 1 $material_name = _GUICtrlListView_GetItem($listview, $rows, 0) $letter = _GUICtrlListView_GetItem($listview, $rows, 3) If GUICtrlRead($acheck[1]) <> 1 And GUICtrlRead($acheck[4]) <> 1 Then ContinueLoop If GUICtrlRead($acheck[1]) = 1 and $textPos_1<>0 Then ControlSetText($title_1, "", $textPos_1, $material_name[3]) EndIf #cs - 2nd input box If GUICtrlRead($aCheck[4]) = 1 Then controlsettext($title, "", $textPos_2, $letter[3]) endif #ce ControlClick($title_1, "", $buttonClick_1) Sleep(2000) ;there you can put some sleep(5000) = 5seconds, more or less, if u know exact applications processing time for this operation ;or ControlGetText("Myapplication title", "", CONTROL_WHICH_CHANGES_AFTER_BUTTONPRESS) and compare to older reads ControlClick($title_2, "", $buttonClick_2) ;<-------------This is if there is a 2nd button to press, otherwise, comment this out Sleep(2000) ;there you can put some sleep(5000) = 5seconds, more or less, if u know exact applications processing time for this operation ;or ControlGetText("Myapplication title", "", CONTROL_WHICH_CHANGES_AFTER_BUTTONPRESS) and compare to older reads If MsgBox(1, "", "You Shall Not Pass!" & @CRLF & "Ok actually you can, just press something") = 2 Then EndIf Next EndFunc ;==>copyToInput Func buildGUI() GUICreate("CSV Listview", 900, 450, -1, -1) $listview = GUICtrlCreateListView(StringReplace($a_csv[1], ",", "|"), 10, 10, 400, 210) GUICtrlCreateLabel("Select a sample file:", 450, 40, 200) $selectFile = GUICtrlCreateCombo("", 450, 60, 180, 200) _GUICtrlComboBox_BeginUpdate($selectFile) _GUICtrlComboBox_AddDir($selectFile, @ScriptDir & "\*.csv") _GUICtrlComboBox_EndUpdate($selectFile) $loadNewFile = GUICtrlCreateButton("Load File", 450, 80) GUICtrlCreateLabel("Select an instrument:", 700, 40, 200) $selectInstrument = GUICtrlCreateCombo("", 700, 60, 180, 25) GUICtrlSetData(-1, "dummy|TGA-100|TGA-200|AUTOCAT-100|AUTOCAT-200") $checkboxName = StringSplit($a_csv[1], ",") $iCount = $checkboxName[0] ;creating buttons ;$runProg = GUICtrlCreateButton("Run Program", 700, 400, 180, 30) $runProg = GUICtrlCreateButton("Run Program", 700, 330, 180, 30) GUICtrlSetState($runProg, $GUI_DISABLE) ConsoleWrite($runProg & @CRLF) ;Building the checkboxes DYNAMICALLY....may need to switch to forced checkbox name ;Store controIDs of the checkboxes Global $acheck[$iCount + 1] Global $mapColumn[$iCount + 1] For $j = 1 To $iCount $acheck[$j] = GUICtrlCreateCheckbox($checkboxName[$j], 10, 190 + (50 * $j), 100, 30) GUICtrlSetState($acheck[$j], $GUI_UNCHECKED) ;$mapColumn[$j] = GUICtrlCreateButton("Map " & '"' & $checkboxName[$j] & '"' & " to input box", 150, 190 + (50 * $j), 180, 30) ;GUICtrlSetState($mapColumn[$j], $GUI_DISABLE) Next For $i = 2 To UBound($a_csv) - 1 $s_temp = StringReplace($a_csv[$i], ",", "|") GUICtrlCreateListViewItem($s_temp, $listview) Next 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 Local $idCancelbutton = GUICtrlCreateButton("Exit", 700, 370, 180, 30) ; GUISetState(@SW_SHOW) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $runProg copyToInput() Case $loadNewFile _loadNewFile() Case $GUI_EVENT_CLOSE, $idCancelbutton ExitLoop Case Else For $i = 1 To $iCount If $msg = $acheck[$i] Then If GUICtrlRead($msg) = 1 Then ;GUICtrlSetState($mapColumn[$i], $GUI_ENABLE) GUICtrlSetState($runProg, $GUI_ENABLE) ;Local $text = "" ; For $k = 0 to $a_csv[0]-1 ; $text &= ControlListView ("CSV Listview", "", $listview, "GetText", $k, $i-1) & @crlf ; Next ; Msgbox(0,$checkboxName[$i], $text) ; debug, can see the list of samples you selected Else ;GUICtrlSetState($mapColumn[$i], $GUI_DISABLE) GUICtrlSetState($runProg, $GUI_DISABLE) EndIf ExitLoop EndIf Next EndSwitch WEnd GUIDelete() EndFunc ;==>buildGUI Func cleanListview() _GUICtrlListView_DeleteAllItems($listview) For $i = 1 To $iCount GUICtrlDelete($acheck[$i]) Next EndFunc ;==>cleanListview Saludos  Danysys.com     AutoIt...  UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection  PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut   Link to comment Share on other sites More sharing options...
timdecker Posted April 15, 2015 Author Share Posted April 15, 2015 Â What is the significance of these in your copyToInput() function. It looks like they are declared and being used, but they don't have any value. Local $title_1 Local $textPos_1 Local $material_name Local $buttonClick_1 Local $title_2 Local $buttonClick_2 That was added by Danyfirex. Here is what I did to get around the "Run Program" crashing part if I didn't select an instrument: Case $runProg if GUICtrlRead($selectInstrument) <> "" Then copyToInput() Else MsgBox(0, "", "Select and Instrument") endif And here is the complete code (that should be error free.....for now): expandcollapse popup#include <file.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <GuiListView.au3> #include <Array.au3> #include <ComboConstants.au3> #include <GuiComboBox.au3> #include <StaticConstants.au3> Global $a_csv Global $listview Global $checkboxName Global $iCount Global $runProg Global $acheck Global $mapColumn Global $runProg Global $selectInstrument Global $selectFile Global $s_Path $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) buildGUI() EndIf Func _loadNewFile() If Not (FileExists(GUICtrlRead($selectFile))) Then MsgBox(0, "", "Select a file from the dropdown menu") Else _FileReadToArray(GUICtrlRead($selectFile),$a_csv) $listview = GUICtrlCreateListView(StringReplace($a_csv[1], ",", "|"), 10, 10, 400, 210) For $i = 2 To UBound($a_csv) - 1 $s_temp = StringReplace($a_csv[$i], ",", "|") GUICtrlCreateListViewItem($s_temp, $listview) Next $checkboxName = StringSplit($a_csv[1], ",") $iCount = $checkboxName[0] For $j = 1 To $iCount $aCheck[$j] = GUICtrlCreateCheckbox($checkboxName[$j], 10, 190 + (50 * $j), 100, 30) GUICtrlSetState($aCheck[$j], $GUI_UNCHECKED) Next EndIf EndFunc Func copyToInput() Select Case GUICtrlRead($selectInstrument) = "dummy" $textPos_1 = 4 $buttonClick_1 = 6 $buttonClick_2 = 2 $title_1 = "HPOV" $title_2 = "Job" Case GUICtrlRead($selectInstrument) = "TGA-100" $textPos_1 = 1161 $buttonClick_1 = 1152 $title_1 = "(METTLER) - TGA-100A with gas box" Case GUICtrlRead($selectInstrument) = "TGA-200" $textPos_1 = 1161 $buttonClick_1 = 1152 $title_1 = "(METTLER) - TGA-200A with gas box" Case GUICtrlRead($selectInstrument) = "AUTOCAT-100" $textPos_1 = 75 Case GUICtrlRead($selectInstrument) = "AUTOCAT-200" $textPos_1 = 15 EndSelect $allRows = _GUICtrlListView_GetItemCount($listview) For $rows = 0 to $allRows-1 $material_name = _GUICtrlListView_GetItem($listview, $rows, 0) $letter = _GUICtrlListView_GetItem($listview, $rows, 3) If GUICtrlRead($aCheck[1]) <> 1 and GUICtrlRead($aCheck[4]) <> 1 then continueloop If GUICtrlRead($aCheck[1]) = 1 Then controlsettext($title_1, "", $textPos_1, $material_name[3]) endif #cs - 2nd input box If GUICtrlRead($aCheck[4]) = 1 Then controlsettext($title, "", $textPos_2, $letter[3]) endif #ce controlclick($title_1, "", $buttonClick_1) Sleep(2000) ;there you can put some sleep(5000) = 5seconds, more or less, if u know exact applications processing time for this operation ;or ControlGetText("Myapplication title", "", CONTROL_WHICH_CHANGES_AFTER_BUTTONPRESS) and compare to older reads controlclick($title_2, "", $buttonClick_2) ;<-------------This is if there is a 2nd button to press, otherwise, comment this out Sleep(2000) ;there you can put some sleep(5000) = 5seconds, more or less, if u know exact applications processing time for this operation ;or ControlGetText("Myapplication title", "", CONTROL_WHICH_CHANGES_AFTER_BUTTONPRESS) and compare to older reads if msgbox(1,"", "You Shall Not Pass!" & @CRLF & "Ok actually you can, just press something") = 2 then ExitLoop endif Next EndFunc Func buildGUI() GUICreate("CSV Listview", 900, 450, -1, -1) $listview = GUICtrlCreateListView(StringReplace($a_csv[1], ",", "|"), 10, 10, 400, 210) GUICtrlCreateLabel("Select a sample file:", 450, 40, 200) $selectFile = GUICtrlCreateCombo("", 450, 60, 180, 200) _GUICtrlComboBox_BeginUpdate($selectFile) _GUICtrlComboBox_AddDir($selectFile, @ScriptDir & "\*.csv") _GUICtrlComboBox_EndUpdate($selectFile) $loadNewFile = GUICtrlCreateButton("Load File", 450, 85) GUICtrlCreateLabel("Select an instrument:", 700, 40, 200) $selectInstrument = GUICtrlCreateCombo("", 700, 60, 180, 25) GUICtrlSetData(-1, "dummy|TGA-100|TGA-200|AUTOCAT-100|AUTOCAT-200") $checkboxName = StringSplit($a_csv[1], ",") $iCount = $checkboxName[0] ;creating buttons ;$runProg = GUICtrlCreateButton("Run Program", 700, 400, 180, 30) $runProg = GUICtrlCreateButton("Run Program", 530, 175, 250, 50) GUICtrlSetState($runProg, $GUI_DISABLE) ;Building the checkboxes DYNAMICALLY....may need to switch to forced checkbox name ;Store controIDs of the checkboxes Global $aCheck[$iCount + 1] Global $mapColumn[$iCount + 1] For $j = 1 To $iCount $aCheck[$j] = GUICtrlCreateCheckbox($checkboxName[$j], 10, 190 + (50 * $j), 100, 30) GUICtrlSetState($aCheck[$j], $GUI_UNCHECKED) ;$mapColumn[$j] = GUICtrlCreateButton("Map " & '"' & $checkboxName[$j] & '"' & " to input box", 150, 190 + (50 * $j), 180, 30) ;GUICtrlSetState($mapColumn[$j], $GUI_DISABLE) Next For $i = 2 To UBound($a_csv) - 1 $s_temp = StringReplace($a_csv[$i], ",", "|") GUICtrlCreateListViewItem($s_temp, $listview) Next 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 Local $idCancelbutton = GUICtrlCreateButton("Exit", 700, 400, 180, 30) ;GUISetState(@SW_SHOW) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $runProg if GUICtrlRead($selectInstrument) <> "" Then copyToInput() Else MsgBox(0, "", "Select and Instrument") endif Case $loadNewFile cleanListview() _loadNewFile() GUICtrlSetState($runProg, $GUI_DISABLE) Case $GUI_EVENT_CLOSE, $idCancelbutton ExitLoop Case Else For $i = 1 To $iCount If $msg = $aCheck[$i] Then If GUICtrlRead($msg) = 1 Then GUICtrlSetState($runProg, $GUI_ENABLE) ;GUICtrlSetState($mapColumn[$i], $GUI_ENABLE) ;Local $text = "" ; For $k = 0 to $a_csv[0]-1 ; $text &= ControlListView ("CSV Listview", "", $listview, "GetText", $k, $i-1) & @crlf ; Next ; Msgbox(0,$checkboxName[$i], $text) ; debug, can see the list of samples you selected Else ;GUICtrlSetState($mapColumn[$i], $GUI_DISABLE) GUICtrlSetState($runProg, $GUI_DISABLE) EndIf ExitLoop EndIf Next EndSwitch WEnd GUIDelete() EndFunc Func cleanListview() _GUICtrlListView_DeleteAllItems($listview) For $i = 1 To $iCount GUICtrlDelete($acheck[$i]) Next EndFunc Link to comment Share on other sites More sharing options...
Danyfirex Posted April 15, 2015 Share Posted April 15, 2015 I did it diferent.  But your way is better. Saludos  Danysys.com     AutoIt...  UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection  PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut   Link to comment Share on other sites More sharing options...
MikahS Posted April 15, 2015 Share Posted April 15, 2015 Glad you found a solution to fit your needs. Â Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Forum FAQ Â Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now