Damein Posted July 13, 2014 Share Posted July 13, 2014 (edited) So let's say we have an INI setup like so: [Test] 0=Empty 1=Test1|0||1|1 2=Test2|1|1|1 3=Test3|0|0|0 And we wan't to remove entry 2. What would be the best way to remove that, and then change #3 to be labeled as #2 and do it in a fashion to if I had say hundred's of entries it would still accomplish this. Edited July 13, 2014 by Damein Most recent sig. I made Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic Link to comment Share on other sites More sharing options...
water Posted July 13, 2014 Share Posted July 13, 2014 Read #3, set #2 to the value of #3, delete #3. Using InIRead, IniWrite, InIDelete. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Solution Damein Posted July 13, 2014 Author Solution Share Posted July 13, 2014 Thank's water, I found a way to do it before reading this but essentially I think it's the same. Func _RemoveMovie() $Index = ControlListView($MainGui, "Movie Database", $MovieListView,"GetSelected") $ReadControl = _GUICtrlListView_GetItemText($MovieListView, 0+$Index) $MovieCount = IniReadSection(@ScriptDir & "/Data/Movie Database.ini", $CurrentCategory) For $i = 0 To $MovieCount[0][0] $SplitData = StringSplit($MovieCount[$i][1], "|") If $SplitData[1] = $ReadControl Then IniDelete(@ScriptDir & "/Data/Movie DataBase.ini", $CurrentCategory, $i -1) ExitLoop EndIf Next $MovieCount = IniReadSection(@ScriptDir & "/Data/Movie Database.ini", $CurrentCategory) For $i = 1 To $MovieCount[0][0] $OldData[$i] = IniRead(@ScriptDir & "/Data/Movie Database.ini", $CurrentCategory, $i, "NA") If $OldData[$i] = "NA" Then $OldData[$i] = IniRead(@ScriptDir & "/Data/Movie Database.ini", $CurrentCategory, $i+1, "NA") IniDelete(@ScriptDir & "/Data/Movie Database.ini", $CurrentCategory, $i+1) EndIf IniDelete(@ScriptDir & "/Data/Movie Database.ini", $CurrentCategory, $i) $Count = $i Next For $i = 1 To $Count - 1 IniWrite(@ScriptDir & "/Data/Movie Database.ini", $CurrentCategory, $i, $OldData[$i]) Next EndFunc Most recent sig. I made Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic 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