Rishav Posted July 20, 2009 Share Posted July 20, 2009 (edited) Hi all I was working on a UI for some batch processing and am kinda stuck on a few points. I want the grid to be refreshed every time a new entry is added to it, so that it shows the newly added row in the Profiles file. I am thinking 3dding a new function for this, which will first clear the grid and then reinsert data from the profiles file. I am hoping that the clearing part will not be necessary. How do I go about reading data from the ini file and putting it into the grid rows using a for loop? Since i need to use loop, i can't use the normal ways of putting data like guisetdata etc. My function that I tried to use for this is plain crap. T expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.1.1 (beta) Author: Rishav Sharan Script Function: GUI to create simple import test cases #ce ---------------------------------------------------------------------------- ;~ Includes #include <GuiConstantsEx.au3> #include <GuiListView.au3> #include <ButtonConstants.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <ComboConstants.au3> #include <GuiDateTimePicker.au3> #include <GuiTab.au3> ;~ GUI Backend data file $ProfilesINI = @ScriptDir & "\Profiles.ini" ; GUI $MainGUI = GUICreate("Optima Rate Import Test Case Creator", 1100, 900, -1, -1, BitOR($WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_SYSMENU, $WS_CAPTION, $WS_POPUPWINDOW, $WS_GROUP, $WS_TABSTOP, $WS_BORDER, $WS_CLIPSIBLINGS)) GUISetIcon(@SystemDir & "\mspaint.exe", 0) GUISetBkColor(0xFFFFFF) $x1 = 10 $y1 = 10 GUICtrlCreateGroup("Please set the Path parameters", $x1, $y1, 920, 230) ; DETAILS FIELDS $TCName_label = GUICtrlCreateLabel("Test Case Name", $x1 + 10, $y1 + 20, 90, 15) $TCName_field = GUICtrlCreateCombo("", $x1 + 110, $y1 + 20, 170, 20, $ES_UPPERCASE) $TCPassNo_label = GUICtrlCreateLabel("Pass Number", $x1 + 320, $y1 + 20, 90, 15) $TCPassNo_field = GUICtrlCreateInput("1", $x1 + 420, $y1 + 20, 170, 20, $ES_NUMBER) $CarrierName_label = GUICtrlCreateLabel("Carrier Name", $x1 + 630, $y1 + 20, 90, 15) $CarrierName_field = GUICtrlCreateInput("", $x1 + 730, $y1 + 20, 170, 20, $ES_UPPERCASE) $TestType_label = GUICtrlCreateLabel("Test Type", $x1 + 10, $y1 + 50, 90, 15) $TestType_field = GUICtrlCreateCombo("", $x1 + 110, $y1 + 50, 170, 20, $CBS_DROPDOWNLIST) GUICtrlSetData($TestType_field, "Import Carrier Rates|Edit Carrier Rates|Run SQL File|Run Win Batch File", "Import Carrier Rates") $AdditionalDetails_label = GUICtrlCreateLabel("Additional Details", $x1 + 320, $y1 + 50, 90, 15) $AdditionalDetails_field = GUICtrlCreateCombo("", $x1 + 420, $y1 + 50, 170, 20, $CBS_DROPDOWNLIST) GUICtrlSetData($AdditionalDetails_field, "Edit Entry|Delete Entry|Clear All", "Edit Entry") $TNS_label = GUICtrlCreateLabel("TNS Name", $x1 + 630, $y1 + 50, 90, 15) $TNS_field = GUICtrlCreateInput("", $x1 + 730, $y1 + 50, 170, 20) ; CHECKBOX $AutoExpire_Chkbox = GUICtrlCreateCheckbox("Automatically Expire Previously Priced Destinations", $x1 + 10, $y1 + 80, 250, 20) ; DATES $IncrDate_label = GUICtrlCreateLabel("Increase Date", $x1 + 320, $y1 + 80, 90, 20) $IncrDate_datefield = GUICtrlCreateDate("", $x1 + 420, $y1 + 80, 170, 20) $IncrDate_handle = GUICtrlGetHandle($IncrDate_datefield) _GUICtrlDTP_SetFormat($IncrDate_handle, "ddd, dd/MMM/yy") $DecrDate_label = GUICtrlCreateLabel("Decrease Date", $x1 + 630, $y1 + 80, 90, 20) $DecrDate_datefield = GUICtrlCreateDate("", $x1 + 730, $y1 + 80, 170, 20) $DecrDate_handle = GUICtrlGetHandle($DecrDate_datefield) _GUICtrlDTP_SetFormat($DecrDate_handle, "ddd, dd/MMM/yy") ; DETAILS FIELDS $Destnination_label = GUICtrlCreateLabel("Destination Name", $x1 + 10, $y1 + 110, 90, 15) $Destnination_field = GUICtrlCreateInput("", $x1 + 110, $y1 + 110, 170, 20) $DialCode_label = GUICtrlCreateLabel("Dial Code", $x1 + 320, $y1 + 110, 90, 15) $DialCode_field = GUICtrlCreateInput("", $x1 + 420, $y1 + 110, 170, 20, $ES_NUMBER) $UidPass_label = GUICtrlCreateLabel("User Id/Password", $x1 + 630, $y1 + 110, 90, 15) $UidPass_field = GUICtrlCreateInput("", $x1 + 730, $y1 + 110, 170, 20) ; DETAILS FIELDS $Rate_label = GUICtrlCreateLabel("Rate", $x1 + 10, $y1 + 140, 90, 15) $Rate_field = GUICtrlCreateInput("", $x1 + 110, $y1 + 140, 170, 20, $ES_NUMBER) ;~ CHECKBOXED DATE $tDate = 0 $EffDate_label = GUICtrlCreateLabel("Use Effective Date", $x1 + 320, $y1 + 140, 90, 20) $EffDate_datefield = GUICtrlCreateDate("", $x1 + 420, $y1 + 140, 170, 20, BitOR($DTS_SHOWNONE, $DTS_LONGDATEFORMAT)) $EffDate_handle = GUICtrlGetHandle($EffDate_datefield) _GUICtrlDTP_SetFormat($EffDate_handle, "ddd, dd/MMM/yy") _GUICtrlDTP_SetSystemTimeEx($EffDate_handle, $tDate, True) $ExpDate_label = GUICtrlCreateLabel("Use Expiry Date", $x1 + 630, $y1 + 140, 90, 20) $ExpDate_datefield = GUICtrlCreateDate("", $x1 + 730, $y1 + 140, 170, 20, BitOR($DTS_SHOWNONE, $DTS_LONGDATEFORMAT)) $ExpDate_handle = GUICtrlGetHandle($ExpDate_datefield) _GUICtrlDTP_SetFormat($ExpDate_handle, "ddd, dd/MMM/yy") _GUICtrlDTP_SetSystemTimeEx($ExpDate_handle, $tDate, True) ;~ $DatafileLocation_value = IniRead($ProfilesINI, "Paths", "$DatafileLocation", "Field Missing") $RSDeffFileLocation_label = GUICtrlCreateLabel("Import File", $x1 + 10, $y1 + 170, 90, 15) $RSDeffFileLocation_field = GUICtrlCreateInput("", $x1 + 110, $y1 + 170, 670, 20) $RSDeffFileLocation_button = GUICtrlCreateButton("Browse", $x1 + 830, $y1 + 170, 50, 20) $RefDeffFileLocation_label = GUICtrlCreateLabel("Reference File", $x1 + 10, $y1 + 200, 90, 15) $RefDeffFileLocation_field = GUICtrlCreateInput("", $x1 + 110, $y1 + 200, 670, 20) $RefDeffFileLocation_button = GUICtrlCreateButton("Browse", $x1 + 830, $y1 + 200, 50, 20) ; BUTTONS $SaveBatch_button = GUICtrlCreateButton("Save to Grid", $x1 + 930, $y1, 150, 25) $AddSeparator_button = GUICtrlCreateButton("Add Separator", $x1 + 930, $y1 + 30, 150, 25) $AddAnal_button = GUICtrlCreateButton("Add Analysis Stage", $x1 + 930, $y1 + 60, 150, 25) $RemFromGrid_button = GUICtrlCreateButton("Remove from Grid", $x1 + 930, $y1 + 90, 150, 25) $MoveUp_button = GUICtrlCreateButton("Move up Item", $x1 + 930, $y1 + 120, 150, 25) $MoveDown_button = GUICtrlCreateButton("Move Down Item", $x1 + 930, $y1 + 150, 150, 25) $RunBatch_button = GUICtrlCreateButton("Run Batch", $x1 + 930, $y1 + 180, 150, 40, $BS_DEFPUSHBUTTON) ; TC SUITE TABS $Tab_TCSuite = _GUICtrlTab_Create($MainGUI, 0, 255, 1280) ; ADD TABS TO TAB BAR _GUICtrlTab_InsertItem($Tab_TCSuite, 0, "TC Suite 1") _GUICtrlTab_InsertItem($Tab_TCSuite, 1, "Tab 2") _GUICtrlTab_InsertItem($Tab_TCSuite, 2, "This tab is awesome 3") _GUICtrlTab_InsertItem($Tab_TCSuite, 3, "Tab 4") _GUICtrlTab_InsertItem($Tab_TCSuite, 4, "Tab 5") _GUICtrlTab_InsertItem($Tab_TCSuite, 5, "Tab 6") _GUICtrlTab_InsertItem($Tab_TCSuite, 6, "Tab 7") ; LIST VIEW $BatchList = GUICtrlCreateListView("", 0, 280, 1100, 620, BitOR(-1, $LVS_NOSORTHEADER, $WS_VSCROLL), BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_HEADERDRAGDROP)) $BatchList_handle = GUICtrlGetHandle($BatchList) $Grid_serial_col = _GUICtrlListView_AddColumn($BatchList, "Serial No.") $Grid_Timestamp_col = _GUICtrlListView_AddColumn($BatchList, "Timestamp", $LVSCW_AUTOSIZE_USEHEADER) $Grid_Status_col = _GUICtrlListView_AddColumn($BatchList, "Test Case Status", $LVSCW_AUTOSIZE_USEHEADER) $Grid_OverallResult_col = _GUICtrlListView_AddColumn($BatchList, "Overall Result", $LVSCW_AUTOSIZE_USEHEADER) $Grid_TCName_col = _GUICtrlListView_AddColumn($BatchList, "Test Case Name", $LVSCW_AUTOSIZE_USEHEADER) $Grid_PassNo_col = _GUICtrlListView_AddColumn($BatchList, "Pass No.", $LVSCW_AUTOSIZE_USEHEADER) $Grid_Carrier_col = _GUICtrlListView_AddColumn($BatchList, "Carrier Name", $LVSCW_AUTOSIZE_USEHEADER) $Grid_TestType_col = _GUICtrlListView_AddColumn($BatchList, "Test Type.", $LVSCW_AUTOSIZE_USEHEADER) $Grid_Details_col = _GUICtrlListView_AddColumn($BatchList, "Details", $LVSCW_AUTOSIZE_USEHEADER) $Grid_TNS_col = _GUICtrlListView_AddColumn($BatchList, "TNS", $LVSCW_AUTOSIZE_USEHEADER) $Grid_AutoExpire_col = _GUICtrlListView_AddColumn($BatchList, "Autoexpire", $LVSCW_AUTOSIZE_USEHEADER) $Grid_IncrDate_col = _GUICtrlListView_AddColumn($BatchList, "Increase Date", $LVSCW_AUTOSIZE_USEHEADER) $Grid_DecrDate_col = _GUICtrlListView_AddColumn($BatchList, "Decrease Date", $LVSCW_AUTOSIZE_USEHEADER) $Grid_DestName_col = _GUICtrlListView_AddColumn($BatchList, "Destination", $LVSCW_AUTOSIZE_USEHEADER) $Grid_DialCode_col = _GUICtrlListView_AddColumn($BatchList, "Dial Code", $LVSCW_AUTOSIZE_USEHEADER) $Grid_Extra2_col = _GUICtrlListView_AddColumn($BatchList, "Extra2", $LVSCW_AUTOSIZE_USEHEADER) $Grid_Rate_col = _GUICtrlListView_AddColumn($BatchList, "Rate", $LVSCW_AUTOSIZE_USEHEADER) $Grid_EffectievDate_col = _GUICtrlListView_AddColumn($BatchList, "Effective Date", $LVSCW_AUTOSIZE_USEHEADER) $Grid_ExpiryDate_col = _GUICtrlListView_AddColumn($BatchList, "Expiry Date", $LVSCW_AUTOSIZE_USEHEADER) $Grid_RSFile_col = _GUICtrlListView_AddColumn($BatchList, "Template File", $LVSCW_AUTOSIZE) $Grid_RefFile_col = _GUICtrlListView_AddColumn($BatchList, "Reference File", $LVSCW_AUTOSIZE) ; different statuses are ||(paused), >(Running), v(passed), x(failed) ;~ GuiCtrlCreateListViewItem("Azzzzz|One|Trident|Ponsus|Krakatua|11243525|87687|pippa", $BatchList) ;~ GuiCtrlCreateListViewItem("B|Two|Trident|Ponsus|Krakatua|11243525|87687|pippa", $BatchList) ;~ GuiCtrlCreateListViewItem("********************|********************|********************|********************|********************|********************|********************|********************|********************|********************|********************|********************|********************|********************|********************|********************|********************|********************|********************|********************|********************|********************", $BatchList) ;~ GuiCtrlCreateListViewItem("C|Three|Trident|Ponsus|Krakatua|11243525|87687|pippa", $BatchList) ; DISABLE ALL CARRIER RATES FIELDS CURRENTLY GUICtrlSetState($AdditionalDetails_field, $GUI_DISABLE) GUICtrlSetState($TNS_field, $GUI_DISABLE) GUICtrlSetState($Destnination_field, $GUI_DISABLE) GUICtrlSetState($DialCode_field, $GUI_DISABLE) GUICtrlSetState($UidPass_field, $GUI_DISABLE) GUICtrlSetState($Rate_field, $GUI_DISABLE) GUICtrlSetState($EffDate_datefield, $GUI_DISABLE) GUICtrlSetState($ExpDate_datefield, $GUI_DISABLE) ; GUI MESSAGE LOOP GUISetState() ; Capture and execute all button clicks While 1 $msg = GUIGetMsg() Select Case $msg = $RSDeffFileLocation_button $var = FileSaveDialog("Choose the DB Datafiles Folder", @WorkingDir, "Text files (*.ini;*.txt)") GUICtrlSetData($RSDeffFileLocation_field, $var) Case $msg = $RefDeffFileLocation_button $var = FileSaveDialog("Choose the DB Datafiles Folder", @WorkingDir, "Text files (*.ini;*.txt)") GUICtrlSetData($RefDeffFileLocation_field, $var) ;~ Case $msg = $SVNClientFolder_button ;~ $var = FileSelectFolder("Choose the DB Datafiles Folder", "") ;~ GUICtrlSetData($SVNClientFolder_field, $var) ;~ Case $msg = $ClientInstallFolder_button ;~ $var = FileSelectFolder("Choose the DB Datafiles Folder", "") ;~ GUICtrlSetData($ClientInstallFolder_field, $var) ;~ Case $msg = $LicenseGeneratorFolder_button ;~ $var = FileSelectFolder("Choose the DB Datafiles Folder", "") ;~ GUICtrlSetData($LicenseGeneratorFolder_field, $var) ;~ Case ControlGetText("Optima Rate Import Test Case Creator", "Test Case Name",$TestType_field)="Import Carrier Rates" ;~ GUISetState($ExpDate_datefield,$GUI_DISABLE) Case $msg = $GUI_EVENT_CLOSE SoundPlay(@WindowsDir & "\media\Windows XP Pop-up Blocked.wav") Exit Case $msg = $SaveBatch_button SoundPlay(@WindowsDir & "\media\Windows XP Pop-up Blocked.wav") $Timestamp_data = @MDAY & @MON & @YEAR & "_" & @HOUR & @MIN & @SEC IniWriteSection($ProfilesINI, $Timestamp_data, "") $TestCaseStatus_data = "" IniWrite($ProfilesINI, $Timestamp_data, "TEST CASE STATUS", $TestCaseStatus_data) $OverallResult_data = "" IniWrite($ProfilesINI, $Timestamp_data, "OVERALL RESULT", $OverallResult_data) $TCName_data = ControlGetText("Optima Rate Import Test Case Creator", "Test Case Name", $TCName_field) IniWrite($ProfilesINI, $Timestamp_data, "TEST CASE NAME", $TCName_data) $TCPassNo_data = ControlGetText("Optima Rate Import Test Case Creator", "Pass Number", $TCPassNo_field) IniWrite($ProfilesINI, $Timestamp_data, "PASS NUMBER", $TCPassNo_data) $CarrierName_data = ControlGetText("Optima Rate Import Test Case Creator", "Carrier Name", $CarrierName_field) IniWrite($ProfilesINI, $Timestamp_data, "CARRIER NAME", $CarrierName_data) $TestType_data = ControlGetText("Optima Rate Import Test Case Creator", "Test Type", $TestType_field) IniWrite($ProfilesINI, $Timestamp_data, "TEST TYPE", $TestType_data) $AdditionalDetails_data = ControlGetText("Optima Rate Import Test Case Creator", "Additional Details", $AdditionalDetails_field) IniWrite($ProfilesINI, $Timestamp_data, "DETAILS", $AdditionalDetails_data) $TNS_data = ControlGetText("Optima Rate Import Test Case Creator", "TNS Name", $TNS_field) IniWrite($ProfilesINI, $Timestamp_data, "TNS", $TNS_data) $AutoExpire_data = ControlCommand("Optima Rate Import Test Case Creator", "Automatically Expire Previously Priced Destinations", $AutoExpire_Chkbox, "IsChecked", "") IniWrite($ProfilesINI, $Timestamp_data, "AUTOEXPIRE", $AutoExpire_data) $IncrDate_data = GUICtrlRead($IncrDate_datefield) IniWrite($ProfilesINI, $Timestamp_data, "INCREASE DATE", $IncrDate_data) $DecrDate_data = GUICtrlRead($DecrDate_datefield) IniWrite($ProfilesINI, $Timestamp_data, "DECREASE DATE", $DecrDate_data) $Destnination_data = ControlGetText("Optima Rate Import Test Case Creator", "Destination Nam", $Destnination_field) IniWrite($ProfilesINI, $Timestamp_data, "DESTINATION", $Destnination_data) $DialCode_data = ControlGetText("Optima Rate Import Test Case Creator", "Rate", $DialCode_field) IniWrite($ProfilesINI, $Timestamp_data, "DIAL CODE", $DialCode_data) $UidPass_data = ControlGetText("Optima Rate Import Test Case Creator", "User Id/Password", $UidPass_field) IniWrite($ProfilesINI, $Timestamp_data, "USERID AND PASSWORD", $UidPass_data) $Rate_data = ControlGetText("Optima Rate Import Test Case Creator", "Rate", $Rate_field) IniWrite($ProfilesINI, $Timestamp_data, "RATE", $Rate_data) $EffDate_data = GUICtrlRead($EffDate_datefield) IniWrite($ProfilesINI, $Timestamp_data, "EFFECTIVE DATE", $EffDate_data) $ExpDate_data = GUICtrlRead($ExpDate_datefield) IniWrite($ProfilesINI, $Timestamp_data, "EXPIRY DATE", $ExpDate_data) $RSDeffFileLocation_data = ControlGetText("Optima Rate Import Test Case Creator", "Import File", $RSDeffFileLocation_field) IniWrite($ProfilesINI, $Timestamp_data, "IMPORT FILE", $RSDeffFileLocation_data) $RefDeffFileLocation_data = ControlGetText("Optima Rate Import Test Case Creator", "Reference File", $RefDeffFileLocation_field) IniWrite($ProfilesINI, $Timestamp_data, "REFERENCE FILE", $RefDeffFileLocation_data) _RefreshGridData() EndSelect WEnd Func _RefreshGridData() $Grid_Serial_listdata = IniReadSectionNames($ProfilesINI) If @error Then MsgBox(4096, "", "Error occurred, Please check INI file.") Else For $a = 1 To $Grid_Serial_listdata[0] $Grid_All_listdata = IniReadSection($ProfilesINI, $Grid_Serial_listdata[$a]) For $b = 1 To $Grid_All_listdata[0][0] _GUICtrlListView_AddArray($BatchList_handle, $Grid_All_listdata[0][$b]) Next Next EndIf EndFunc ;==>_RefreshGridData Here is a working Profile ini file. just place this ini file in the same directoory; expandcollapse popup[20072009_143841] TEST CASE STATUS= OVERALL RESULT= TEST CASE NAME=TC 1 PASS NUMBER=2 CARRIER NAME=Carrier Alpha TEST TYPE=Import Carrier Rates DETAILS=Edit Entry TNS=ORCL AUTOEXPIRE=1 INCREASE DATE=Thu, 30/Jul/09 DECREASE DATE=Mon, 20/Jul/09 DESTINATION=Los Angeles DIAL CODE=1123 USERID AND PASSWORD=Rishav/fjhjhccx RATE=1.234 EFFECTIVE DATE=Mon, 20/Jul/09 EXPIRY DATE=Fri, 24/Jul/09 IMPORT FILE=D:\Documents and Settings\rishav\Belgelerim\My Dropbox\Workspace\Import Function\Profiles\Suite.ini REFERENCE FILE=D:\Documents and Settings\rishav\Belgelerim\My Dropbox\Workspace\Import Function\Profiles\Suite.ini [20072009_143852] TEST CASE STATUS= OVERALL RESULT= TEST CASE NAME=TC 2 PASS NUMBER=3 CARRIER NAME=Carrier BETA TEST TYPE=Edit Carrier Rates DETAILS=Edit Entry TNS=ORCL AUTOEXPIRE=1 INCREASE DATE=Thu, 30/Jul/09 DECREASE DATE=Mon, 20/Jul/09 DESTINATION=Los Angeles DIAL CODE=1123 USERID AND PASSWORD=Rishav/fjhjhccx RATE=1.234 EFFECTIVE DATE=Mon, 20/Jul/09 EXPIRY DATE=Fri, 24/Jul/09 IMPORT FILE=D:\Documents and Settings\rishav\Belgelerim\My Dropbox\Workspace\Import Function\Profiles\Suite.ini REFERENCE FILE=D:\Documents and Settings\rishav\Belgelerim\My Dropbox\Workspace\Import Function\Profiles\Suite.ini [20072009_143921] TEST CASE STATUS= OVERALL RESULT= TEST CASE NAME=TC 3 PASS NUMBER=1 CARRIER NAME=Carrier GAMMA TEST TYPE=Run Win Batch File DETAILS=Edit Entry TNS=SYSTEM AUTOEXPIRE=1 INCREASE DATE=Thu, 30/Jul/09 DECREASE DATE=Sat, 25/Jul/09 DESTINATION=Los Angeles DIAL CODE=1123 USERID AND PASSWORD=Rishav/fjhjhccx RATE=1.234 EFFECTIVE DATE=Mon, 20/Jul/09 EXPIRY DATE=Fri, 24/Jul/09 IMPORT FILE=D:\Documents and Settings\rishav\Belgelerim\My Dropbox\Workspace\Import Function\Profiles\Suite.ini REFERENCE FILE=D:\Documents and Settings\rishav\Belgelerim\My Dropbox\Workspace\Import Function\Profiles\Suite.ini Edited July 20, 2009 by Rishav Link to comment Share on other sites More sharing options...
trung0407 Posted July 20, 2009 Share Posted July 20, 2009 (edited) Nice GUI but it's a bit too big for a resolution 1024*768, don't you think? -.- Why do you want to refresh it? Everytime you added an element (use _GUICtrlListView_AddItem), the listview is refreshed And since you are in the same script, use GuiCtrlRead instead of ControlGetText Edited July 20, 2009 by trung0407 Link to comment Share on other sites More sharing options...
Rishav Posted July 20, 2009 Author Share Posted July 20, 2009 (edited) heh. thanks but i work on 1280*1024. hopefully, the resolution wouldn't hold you back from helping me out. 0.o ps. weird smiley pics... Edited July 20, 2009 by Rishav Link to comment Share on other sites More sharing options...
trung0407 Posted July 20, 2009 Share Posted July 20, 2009 I can't even see all button But tell me an example. What button should I click first, and what result do you expect? Link to comment Share on other sites More sharing options...
Rishav Posted July 20, 2009 Author Share Posted July 20, 2009 (edited) well at present all buttons tabs etc are useless except "Save to grid". You open the gui, fill stuff in the fields and click Save to grid. the data is then added to the ini file. this i can do. Now once data has been added onto the ini file, it should come in the grid too. this is where the problem lies. I have provided an inifile. if you can get my stubborn code to get the data in the grid, using the inifile, i will be very grateful. All the problem lies in the function at the very end of the script, the _RefreshGridData func. I am still working on it and it seems that even my arrarys are all screwed up. T_T UPDATE: Made some changes. Now I can atleast get the serial number data working. No luck on the actual problem though. expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.1.1 (beta) Author: Rishav Sharan Script Function: GUI to create simple import test cases #ce ---------------------------------------------------------------------------- ;~ Includes #include <GuiConstantsEx.au3> #include <GuiListView.au3> #include <ButtonConstants.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <ComboConstants.au3> #include <GuiDateTimePicker.au3> #include <GuiTab.au3> #Include <Array.au3> ;~ GUI Backend data file $ProfilesINI = @ScriptDir & "\Profiles\Profiles.ini" ; GUI $MainGUI = GUICreate("Optima Rate Import Test Case Creator", 1100, 900, -1, -1, BitOR($WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_SYSMENU, $WS_CAPTION, $WS_POPUPWINDOW, $WS_GROUP, $WS_TABSTOP, $WS_BORDER, $WS_CLIPSIBLINGS)) GUISetIcon(@SystemDir & "\mspaint.exe", 0) GUISetBkColor(0xFFFFFF) $x1 = 10 $y1 = 10 GUICtrlCreateGroup("Please set the Path parameters", $x1, $y1, 920, 230) ; DETAILS FIELDS $TCName_label = GUICtrlCreateLabel("Test Case Name", $x1 + 10, $y1 + 20, 90, 15) $TCName_field = GUICtrlCreateCombo("", $x1 + 110, $y1 + 20, 170, 20, $ES_UPPERCASE) $TCPassNo_label = GUICtrlCreateLabel("Pass Number", $x1 + 320, $y1 + 20, 90, 15) $TCPassNo_field = GUICtrlCreateInput("1", $x1 + 420, $y1 + 20, 170, 20, $ES_NUMBER) $CarrierName_label = GUICtrlCreateLabel("Carrier Name", $x1 + 630, $y1 + 20, 90, 15) $CarrierName_field = GUICtrlCreateInput("", $x1 + 730, $y1 + 20, 170, 20, $ES_UPPERCASE) $TestType_label = GUICtrlCreateLabel("Test Type", $x1 + 10, $y1 + 50, 90, 15) $TestType_field = GUICtrlCreateCombo("", $x1 + 110, $y1 + 50, 170, 20, $CBS_DROPDOWNLIST) GUICtrlSetData($TestType_field, "Import Carrier Rates|Edit Carrier Rates|Run SQL File|Run Win Batch File", "Import Carrier Rates") $AdditionalDetails_label = GUICtrlCreateLabel("Additional Details", $x1 + 320, $y1 + 50, 90, 15) $AdditionalDetails_field = GUICtrlCreateCombo("", $x1 + 420, $y1 + 50, 170, 20, $CBS_DROPDOWNLIST) GUICtrlSetData($AdditionalDetails_field, "Edit Entry|Delete Entry|Clear All", "Edit Entry") $TNS_label = GUICtrlCreateLabel("TNS Name", $x1 + 630, $y1 + 50, 90, 15) $TNS_field = GUICtrlCreateInput("", $x1 + 730, $y1 + 50, 170, 20) ; CHECKBOX $AutoExpire_Chkbox = GUICtrlCreateCheckbox("Automatically Expire Previously Priced Destinations", $x1 + 10, $y1 + 80, 250, 20) ; DATES $IncrDate_label = GUICtrlCreateLabel("Increase Date", $x1 + 320, $y1 + 80, 90, 20) $IncrDate_datefield = GUICtrlCreateDate("", $x1 + 420, $y1 + 80, 170, 20) $IncrDate_handle = GUICtrlGetHandle($IncrDate_datefield) _GUICtrlDTP_SetFormat($IncrDate_handle, "ddd, dd/MMM/yy") $DecrDate_label = GUICtrlCreateLabel("Decrease Date", $x1 + 630, $y1 + 80, 90, 20) $DecrDate_datefield = GUICtrlCreateDate("", $x1 + 730, $y1 + 80, 170, 20) $DecrDate_handle = GUICtrlGetHandle($DecrDate_datefield) _GUICtrlDTP_SetFormat($DecrDate_handle, "ddd, dd/MMM/yy") ; DETAILS FIELDS $Destnination_label = GUICtrlCreateLabel("Destination Name", $x1 + 10, $y1 + 110, 90, 15) $Destnination_field = GUICtrlCreateInput("", $x1 + 110, $y1 + 110, 170, 20) $DialCode_label = GUICtrlCreateLabel("Dial Code", $x1 + 320, $y1 + 110, 90, 15) $DialCode_field = GUICtrlCreateInput("", $x1 + 420, $y1 + 110, 170, 20, $ES_NUMBER) $UidPass_label = GUICtrlCreateLabel("User Id/Password", $x1 + 630, $y1 + 110, 90, 15) $UidPass_field = GUICtrlCreateInput("", $x1 + 730, $y1 + 110, 170, 20) ; DETAILS FIELDS $Rate_label = GUICtrlCreateLabel("Rate", $x1 + 10, $y1 + 140, 90, 15) $Rate_field = GUICtrlCreateInput("", $x1 + 110, $y1 + 140, 170, 20, $ES_NUMBER) ;~ CHECKBOXED DATE $tDate = 0 $EffDate_label = GUICtrlCreateLabel("Use Effective Date", $x1 + 320, $y1 + 140, 90, 20) $EffDate_datefield = GUICtrlCreateDate("", $x1 + 420, $y1 + 140, 170, 20, BitOR($DTS_SHOWNONE, $DTS_LONGDATEFORMAT)) $EffDate_handle = GUICtrlGetHandle($EffDate_datefield) _GUICtrlDTP_SetFormat($EffDate_handle, "ddd, dd/MMM/yy") _GUICtrlDTP_SetSystemTimeEx($EffDate_handle, $tDate, True) $ExpDate_label = GUICtrlCreateLabel("Use Expiry Date", $x1 + 630, $y1 + 140, 90, 20) $ExpDate_datefield = GUICtrlCreateDate("", $x1 + 730, $y1 + 140, 170, 20, BitOR($DTS_SHOWNONE, $DTS_LONGDATEFORMAT)) $ExpDate_handle = GUICtrlGetHandle($ExpDate_datefield) _GUICtrlDTP_SetFormat($ExpDate_handle, "ddd, dd/MMM/yy") _GUICtrlDTP_SetSystemTimeEx($ExpDate_handle, $tDate, True) ;~ $DatafileLocation_value = IniRead($ProfilesINI, "Paths", "$DatafileLocation", "Field Missing") $RSDeffFileLocation_label = GUICtrlCreateLabel("Import File", $x1 + 10, $y1 + 170, 90, 15) $RSDeffFileLocation_field = GUICtrlCreateInput("", $x1 + 110, $y1 + 170, 670, 20) $RSDeffFileLocation_button = GUICtrlCreateButton("Browse", $x1 + 830, $y1 + 170, 50, 20) $RefDeffFileLocation_label = GUICtrlCreateLabel("Reference File", $x1 + 10, $y1 + 200, 90, 15) $RefDeffFileLocation_field = GUICtrlCreateInput("", $x1 + 110, $y1 + 200, 670, 20) $RefDeffFileLocation_button = GUICtrlCreateButton("Browse", $x1 + 830, $y1 + 200, 50, 20) ; BUTTONS $SaveBatch_button = GUICtrlCreateButton("Save to Grid", $x1 + 930, $y1, 150, 25) $AddSeparator_button = GUICtrlCreateButton("Add Separator", $x1 + 930, $y1 + 30, 150, 25) $AddAnal_button = GUICtrlCreateButton("Add Analysis Stage", $x1 + 930, $y1 + 60, 150, 25) $RemFromGrid_button = GUICtrlCreateButton("Remove from Grid", $x1 + 930, $y1 + 90, 150, 25) $MoveUp_button = GUICtrlCreateButton("Move up Item", $x1 + 930, $y1 + 120, 150, 25) $MoveDown_button = GUICtrlCreateButton("Move Down Item", $x1 + 930, $y1 + 150, 150, 25) $RunBatch_button = GUICtrlCreateButton("Run Batch", $x1 + 930, $y1 + 180, 150, 40, $BS_DEFPUSHBUTTON) ; TC SUITE TABS $Tab_TCSuite = _GUICtrlTab_Create($MainGUI, 0, 255, 1280) ; ADD TABS TO TAB BAR _GUICtrlTab_InsertItem($Tab_TCSuite, 0, "TC Suite 1") _GUICtrlTab_InsertItem($Tab_TCSuite, 1, "Tab 2") _GUICtrlTab_InsertItem($Tab_TCSuite, 2, "This tab is awesome 3") _GUICtrlTab_InsertItem($Tab_TCSuite, 3, "Tab 4") _GUICtrlTab_InsertItem($Tab_TCSuite, 4, "Tab 5") _GUICtrlTab_InsertItem($Tab_TCSuite, 5, "Tab 6") _GUICtrlTab_InsertItem($Tab_TCSuite, 6, "Tab 7") ; LIST VIEW $BatchList = GUICtrlCreateListView("", 0, 280, 1100, 620, BitOR(-1, $LVS_NOSORTHEADER, $WS_VSCROLL), BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_HEADERDRAGDROP)) $BatchList_handle = GUICtrlGetHandle($BatchList) $Grid_serial_col = _GUICtrlListView_AddColumn($BatchList, "Serial No.") $Grid_Timestamp_col = _GUICtrlListView_AddColumn($BatchList, "Timestamp", $LVSCW_AUTOSIZE_USEHEADER) $Grid_Status_col = _GUICtrlListView_AddColumn($BatchList, "Test Case Status", $LVSCW_AUTOSIZE_USEHEADER) $Grid_OverallResult_col = _GUICtrlListView_AddColumn($BatchList, "Overall Result", $LVSCW_AUTOSIZE_USEHEADER) $Grid_TCName_col = _GUICtrlListView_AddColumn($BatchList, "Test Case Name", $LVSCW_AUTOSIZE_USEHEADER) $Grid_PassNo_col = _GUICtrlListView_AddColumn($BatchList, "Pass No.", $LVSCW_AUTOSIZE_USEHEADER) $Grid_Carrier_col = _GUICtrlListView_AddColumn($BatchList, "Carrier Name", $LVSCW_AUTOSIZE_USEHEADER) $Grid_TestType_col = _GUICtrlListView_AddColumn($BatchList, "Test Type.", $LVSCW_AUTOSIZE_USEHEADER) $Grid_Details_col = _GUICtrlListView_AddColumn($BatchList, "Details", $LVSCW_AUTOSIZE_USEHEADER) $Grid_TNS_col = _GUICtrlListView_AddColumn($BatchList, "TNS", $LVSCW_AUTOSIZE_USEHEADER) $Grid_AutoExpire_col = _GUICtrlListView_AddColumn($BatchList, "Autoexpire", $LVSCW_AUTOSIZE_USEHEADER) $Grid_IncrDate_col = _GUICtrlListView_AddColumn($BatchList, "Increase Date", $LVSCW_AUTOSIZE_USEHEADER) $Grid_DecrDate_col = _GUICtrlListView_AddColumn($BatchList, "Decrease Date", $LVSCW_AUTOSIZE_USEHEADER) $Grid_DestName_col = _GUICtrlListView_AddColumn($BatchList, "Destination", $LVSCW_AUTOSIZE_USEHEADER) $Grid_DialCode_col = _GUICtrlListView_AddColumn($BatchList, "Dial Code", $LVSCW_AUTOSIZE_USEHEADER) $Grid_Extra2_col = _GUICtrlListView_AddColumn($BatchList, "Extra2", $LVSCW_AUTOSIZE_USEHEADER) $Grid_Rate_col = _GUICtrlListView_AddColumn($BatchList, "Rate", $LVSCW_AUTOSIZE_USEHEADER) $Grid_EffectievDate_col = _GUICtrlListView_AddColumn($BatchList, "Effective Date", $LVSCW_AUTOSIZE_USEHEADER) $Grid_ExpiryDate_col = _GUICtrlListView_AddColumn($BatchList, "Expiry Date", $LVSCW_AUTOSIZE_USEHEADER) $Grid_RSFile_col = _GUICtrlListView_AddColumn($BatchList, "Template File", $LVSCW_AUTOSIZE) $Grid_RefFile_col = _GUICtrlListView_AddColumn($BatchList, "Reference File", $LVSCW_AUTOSIZE) ; different statuses are ||(paused), >(Running), v(passed), x(failed) ;~ GuiCtrlCreateListViewItem("Azzzzz|One|Trident|Ponsus|Krakatua|11243525|87687|pippa", $BatchList) ;~ GuiCtrlCreateListViewItem("B|Two|Trident|Ponsus|Krakatua|11243525|87687|pippa", $BatchList) ;~ GuiCtrlCreateListViewItem("********************|********************|********************|********************|********************|********************|********************|********************|********************|********************|********************|********************|********************|********************|********************|********************|********************|********************|********************|********************|********************|********************", $BatchList) ;~ GuiCtrlCreateListViewItem("C|Three|Trident|Ponsus|Krakatua|11243525|87687|pippa", $BatchList) ; DISABLE ALL CARRIER RATES FIELDS CURRENTLY GUICtrlSetState($AdditionalDetails_field, $GUI_DISABLE) GUICtrlSetState($TNS_field, $GUI_DISABLE) GUICtrlSetState($Destnination_field, $GUI_DISABLE) GUICtrlSetState($DialCode_field, $GUI_DISABLE) GUICtrlSetState($UidPass_field, $GUI_DISABLE) GUICtrlSetState($Rate_field, $GUI_DISABLE) GUICtrlSetState($EffDate_datefield, $GUI_DISABLE) GUICtrlSetState($ExpDate_datefield, $GUI_DISABLE) ; GUI MESSAGE LOOP GUISetState() _RefreshGridData() ; Capture and execute all button clicks While 1 $msg = GUIGetMsg() Select Case $msg = $RSDeffFileLocation_button $var = FileSaveDialog("Choose the DB Datafiles Folder", @WorkingDir, "Text files (*.ini;*.txt)") GUICtrlSetData($RSDeffFileLocation_field, $var) Case $msg = $RefDeffFileLocation_button $var = FileSaveDialog("Choose the DB Datafiles Folder", @WorkingDir, "Text files (*.ini;*.txt)") GUICtrlSetData($RefDeffFileLocation_field, $var) ;~ Case $msg = $SVNClientFolder_button ;~ $var = FileSelectFolder("Choose the DB Datafiles Folder", "") ;~ GUICtrlSetData($SVNClientFolder_field, $var) ;~ Case $msg = $ClientInstallFolder_button ;~ $var = FileSelectFolder("Choose the DB Datafiles Folder", "") ;~ GUICtrlSetData($ClientInstallFolder_field, $var) ;~ Case $msg = $LicenseGeneratorFolder_button ;~ $var = FileSelectFolder("Choose the DB Datafiles Folder", "") ;~ GUICtrlSetData($LicenseGeneratorFolder_field, $var) ;~ Case ControlGetText("Optima Rate Import Test Case Creator", "Test Case Name",$TestType_field)="Import Carrier Rates" ;~ GUISetState($ExpDate_datefield,$GUI_DISABLE) Case $msg = $GUI_EVENT_CLOSE SoundPlay(@WindowsDir & "\media\Windows XP Pop-up Blocked.wav") GUIDelete() Exit Case $msg = $SaveBatch_button SoundPlay(@WindowsDir & "\media\Windows XP Pop-up Blocked.wav") $Timestamp_data = @MDAY & @MON & @YEAR & "_" & @HOUR & @MIN & @SEC IniWriteSection($ProfilesINI, $Timestamp_data, "") $TestCaseStatus_data = "" IniWrite($ProfilesINI, $Timestamp_data, "TEST CASE STATUS", $TestCaseStatus_data) $OverallResult_data = "" IniWrite($ProfilesINI, $Timestamp_data, "OVERALL RESULT", $OverallResult_data) $TCName_data = ControlGetText("Optima Rate Import Test Case Creator", "Test Case Name", $TCName_field) IniWrite($ProfilesINI, $Timestamp_data, "TEST CASE NAME", $TCName_data) $TCPassNo_data = ControlGetText("Optima Rate Import Test Case Creator", "Pass Number", $TCPassNo_field) IniWrite($ProfilesINI, $Timestamp_data, "PASS NUMBER", $TCPassNo_data) $CarrierName_data = ControlGetText("Optima Rate Import Test Case Creator", "Carrier Name", $CarrierName_field) IniWrite($ProfilesINI, $Timestamp_data, "CARRIER NAME", $CarrierName_data) $TestType_data = ControlGetText("Optima Rate Import Test Case Creator", "Test Type", $TestType_field) IniWrite($ProfilesINI, $Timestamp_data, "TEST TYPE", $TestType_data) $AdditionalDetails_data = ControlGetText("Optima Rate Import Test Case Creator", "Additional Details", $AdditionalDetails_field) IniWrite($ProfilesINI, $Timestamp_data, "DETAILS", $AdditionalDetails_data) $TNS_data = ControlGetText("Optima Rate Import Test Case Creator", "TNS Name", $TNS_field) IniWrite($ProfilesINI, $Timestamp_data, "TNS", $TNS_data) $AutoExpire_data = ControlCommand("Optima Rate Import Test Case Creator", "Automatically Expire Previously Priced Destinations", $AutoExpire_Chkbox, "IsChecked", "") IniWrite($ProfilesINI, $Timestamp_data, "AUTOEXPIRE", $AutoExpire_data) $IncrDate_data = GUICtrlRead($IncrDate_datefield) IniWrite($ProfilesINI, $Timestamp_data, "INCREASE DATE", $IncrDate_data) $DecrDate_data = GUICtrlRead($DecrDate_datefield) IniWrite($ProfilesINI, $Timestamp_data, "DECREASE DATE", $DecrDate_data) $Destnination_data = ControlGetText("Optima Rate Import Test Case Creator", "Destination Nam", $Destnination_field) IniWrite($ProfilesINI, $Timestamp_data, "DESTINATION", $Destnination_data) $DialCode_data = ControlGetText("Optima Rate Import Test Case Creator", "Rate", $DialCode_field) IniWrite($ProfilesINI, $Timestamp_data, "DIAL CODE", $DialCode_data) $UidPass_data = ControlGetText("Optima Rate Import Test Case Creator", "User Id/Password", $UidPass_field) IniWrite($ProfilesINI, $Timestamp_data, "USERID AND PASSWORD", $UidPass_data) $Rate_data = ControlGetText("Optima Rate Import Test Case Creator", "Rate", $Rate_field) IniWrite($ProfilesINI, $Timestamp_data, "RATE", $Rate_data) $EffDate_data = GUICtrlRead($EffDate_datefield) IniWrite($ProfilesINI, $Timestamp_data, "EFFECTIVE DATE", $EffDate_data) $ExpDate_data = GUICtrlRead($ExpDate_datefield) IniWrite($ProfilesINI, $Timestamp_data, "EXPIRY DATE", $ExpDate_data) $RSDeffFileLocation_data = ControlGetText("Optima Rate Import Test Case Creator", "Import File", $RSDeffFileLocation_field) IniWrite($ProfilesINI, $Timestamp_data, "IMPORT FILE", $RSDeffFileLocation_data) $RefDeffFileLocation_data = ControlGetText("Optima Rate Import Test Case Creator", "Reference File", $RefDeffFileLocation_field) IniWrite($ProfilesINI, $Timestamp_data, "REFERENCE FILE", $RefDeffFileLocation_data) ;~ _RefreshGridData() EndSelect WEnd Func _RefreshGridData() $Grid_Serial_listdata = IniReadSectionNames($ProfilesINI) ;~ If @error Then ;~ MsgBox(4096, "", "Error occurred, Please check INI file.") ;~ Else For $a = 1 To $Grid_Serial_listdata[0] $Grid_All_listdata = IniReadSection($ProfilesINI, $Grid_Serial_listdata[$a]) _GUICtrlListView_AddItem($BatchList_handle, $a) for $b = 1 to $Grid_All_listdata[0][0] _GUICtrlListView_AddSubItem($BatchList_handle, $a, $Grid_All_listdata[$b][1],3) ;~ _GUICtrlListView_AddSubItem($BatchList_handle, $a, $Grid_All_listdata[$b][1],$b) Next Next ;~ EndIf EndFunc ;==>_RefreshGridData ;~ MsgBox(0,$Grid_Serial_listdata[0] & "/" & $b, $Grid_All_listdata[1][6]) ;~ _ArrayDisplay($Grid_All_listdata) ;~ MsgBox(0,"",$Grid_All_listdata[5][1]) ;~ _GUICtrlListView_AddArray($BatchList_handle, $Grid_All_listdata) Edited July 20, 2009 by Rishav Link to comment Share on other sites More sharing options...
trung0407 Posted July 20, 2009 Share Posted July 20, 2009 (edited) Normally, ppl use an INI file for load or save data and options only. You shouldn't use it as a reference of data. It means that at the beginning you should load all data and stuffs into an Array (or more) And every time you add an data: - modify, add a new element to the end of the array - add a new item into ListView - modify dynamically the INI file if you don't want to create a button Save. But with Save, you can prevent adding wrong information before storing. Remember, use ini to load options only. Edited July 20, 2009 by trung0407 Link to comment Share on other sites More sharing options...
Rishav Posted July 20, 2009 Author Share Posted July 20, 2009 Normally, ppl use an INI file for load or save data and options only. You shouldn't use it as a reference of data. It means that at the beginning you should load all data and stuffs into an Array (or more) And every time you add an data: - modify, add a new element to the end of the array - add a new item into ListView - modify dynamically the INI file if you don't want to create a button Save. But with Save, you can prevent adding wrong information before storing. Remember, use ini to load options only. That is exactly my intention. in the function, i first covert the ini file data into arrary and then try to insert that data into the grid. Func _RefreshGridData() $Grid_Serial_listdata = IniReadSectionNames($ProfilesINI) ;~ If @error Then ;~ MsgBox(4096, "", "Error occurred, Please check INI file.") ;~ Else For $a = 1 To $Grid_Serial_listdata[0] $Grid_All_listdata = IniReadSection($ProfilesINI, $Grid_Serial_listdata[$a]) _GUICtrlListView_AddItem($BatchList_handle, $a) for $b = 1 to $Grid_All_listdata[0][0] _GUICtrlListView_AddSubItem($BatchList_handle, $a, $Grid_All_listdata[$b][1],3) ;~ _GUICtrlListView_AddSubItem($BatchList_handle, $a, $Grid_All_listdata[$b][1],$b) Next Next ;~ EndIf EndFunc ;==>_RefreshGridData Link to comment Share on other sites More sharing options...
trung0407 Posted July 20, 2009 Share Posted July 20, 2009 Dealing with arrays is the pain in the ass. You should always use _ArrayDisplay or ConsoleWrite or MsgBox to keep track of your data, script. Link to comment Share on other sites More sharing options...
Rishav Posted July 20, 2009 Author Share Posted July 20, 2009 Dealing with arrays is the pain in the ass. You should always use _ArrayDisplay or ConsoleWrite or MsgBox to keep track of your data, script. done all that too. ;~ MsgBox(0,$Grid_Serial_listdata[0] & "/" & $b, $Grid_All_listdata[1][6]) ;~ _ArrayDisplay($Grid_All_listdata) ;~ MsgBox(0,"",$Grid_All_listdata[5][1]) ;~ _GUICtrlListView_AddArray($BatchList_handle, $Grid_All_listdata) Link to comment Share on other sites More sharing options...
Yashied Posted July 20, 2009 Share Posted July 20, 2009 I see you finally won something TimePicker. My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
KaFu Posted July 20, 2009 Share Posted July 20, 2009 (edited) Jes... the count of rows in the ini-file does not match the count of columns in the listview... Func _RefreshGridData() $Grid_Serial_listdata_sections = IniReadSectionNames($ProfilesINI) If @error Then MsgBox(4096, "", "Error occurred, Please check INI file.") ElseIf $Grid_Serial_listdata_sections[0] > 0 then _GUICtrlListView_BeginUpdate($BatchList_handle) _GUICtrlListView_DeleteAllItems($BatchList_handle) ;_ArrayDisplay($Grid_Serial_listdata_sections) for $i = 1 to $Grid_Serial_listdata_sections[0] $Grid_Serial_listdata = IniReadSection($ProfilesINI, $Grid_Serial_listdata_sections[$i]) ;_ArrayDisplay($Grid_Serial_listdata) if not @error then if $Grid_Serial_listdata[0][0] > 0 Then _GUICtrlListView_AddItem($BatchList_handle, "", $Grid_Serial_listdata[1][1], 1) for $y = 2 to $Grid_Serial_listdata[0][0] _GUICtrlListView_AddSubItem($BatchList_handle, $i-1,$Grid_Serial_listdata[$y][1],$y+1) Next EndIf endif next for $i = 0 to _GUICtrlListView_GetColumnCount($BatchList_handle) _GUICtrlListView_SetColumnWidth($BatchList_handle, $i, $LVSCW_AUTOSIZE_USEHEADER) Next _GUICtrlListView_EndUpdate($BatchList_handle) EndIf EndFunc ;==>_RefreshGridData Edit: Commented a ArrayDisplay()... Edited July 20, 2009 by KaFu  OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Rishav Posted July 20, 2009 Author Share Posted July 20, 2009 I see you finally won something TimePicker. yes sir, but the victory was short lived. got new issue to play with. Hopefully I am still not making the same dumb mistake that I made in Timepicker.Jes... the count of rows in the ini-file does not match the count of columns in the listview...Was that really the only prob? Because i am about to leave my attempts at coding altogether and become a hobo. I seriously suck at it. :/anyway, your code snippet works awesomely. Time to pick it apart and see what makes it work...Thanks all. 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