GEOSoft Posted May 31, 2010 Share Posted May 31, 2010 Here is a modified version of the function. Func _AddRecord($s_Name, $s_Address) Local $aNames = IniReadSection($sIni, "Name") Local $aAddress = IniReadSection($sIni, "Address") Local $iSet = 0 Local $iUbound = UBound($aNames) - 1 For $i = 1 To $iUbound ;MsgBox(0, $i, $aNames[$i][0]) If $aNames[$i][1] = "" OR $aNames[$i][0] > $i-1 Then IniWrite($sIni, "Name", $i - 1, $s_Name) IniWrite($sIni, "Address", $i - 1, $s_Address) $iSet = 1 ExitLoop EndIf Next If NOT $iSet Then IniWrite($sIni, "Name", $iUbound, "Added Name") IniWrite($sIni, "Address", $iUbound, "Added Address") EndIf EndFunc ;==>_AddRecord George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
GEOSoft Posted May 31, 2010 Share Posted May 31, 2010 thanks man for the help. this works. and its not that i dont use the previous one its that i don't understand how it works so i can't edit it to make it work with my script. cause i need the data saved in the ini to work with this function. Func Populate_CBOBox() Local $var = IniReadSection(@ScriptDir & "\Config.ini", "Address") If @error Then GUICtrlSetData($cboAddress, "Can't find a valid INI file.") Else For $i = 1 To $var[0][0] GUICtrlSetData($cboAddress, $var[$i][1]) Next EndIf EndFunc and when the combo-box is populated i want to be able to choose a user name or in the case of this script an address and press the delete button and that should delete the address and user name for that address.(maybe i should make the script re number the data left when it deletes an entry. what do you think) You shouldn't have to do a sort unless you are also deleting the key. I would just delete the records and leave it at that. The modified version I just posted allows for Deleting the key as well (Done with IniDelete) but that will require a sort afterwards. I have an IniSort function to do it but someplace in Example Scripts is one by SmOke_N that does a proper numerical sort. so it isn't sorted as 1 10 11 2 3 4 5 6 7 8 9 It has to sort like this for it to work. 1 2 3 4 5 6 7 8 9 10 11 The only problem I forsee is when populating your ComboBox, it will show empty entries if there are any. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Tiboi Posted June 1, 2010 Author Share Posted June 1, 2010 You shouldn't have to do a sort unless you are also deleting the key. I would just delete the records and leave it at that.The modified version I just posted allows for Deleting the key as well (Done with IniDelete) but that will require a sort afterwards. I have an IniSort function to do it but someplace in Example Scripts is one by SmOke_N that does a proper numerical sort. so it isn't sorted as1101123456789It has to sort like this for it to work.1234567891011The only problem I forsee is when populating your ComboBox, it will show empty entries if there are any.thanks man that helped a lot plus something you said to me i cant remember what i can now understand single dimension arrays and how to properly write the ini the way i want. thank you very very much, i appreciate you taking time to help me after asking so many questions 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