Damein Posted April 16, 2012 Posted April 16, 2012 So I have an INI with a bunch of different items in it. And in the program you can change a value of a section that corresponds to a different section. Now, to stop duplicates and also be able to continue adding to the ini correctly I wanted to see what the easiest way would be. I know this probably sounds confusing or something, but I'll try to explain. Statuses.ini [Status] 1=Partly Cloudy 2=Isolated T-Storms 3=Mostly Cloudy 4=Mostly Sunny [XY] Partly Cloudy=45,200 Isolated T-Storms=37,200 Mostly Cloudy=45,200 Mostly Sunny=47,200 So that is how the ini is setup. The Status section is the text for the label, and the XY is the X,Y location for the label. $CheckForDuplicate = IniReadSection("Statuses.ini", "Status") For $i = 1 To $CheckForDuplicate[0][0] If $CheckForDuplicate[0][1] = $OverViewStatus[1] Then $MsgBox = MsgBox(4,"Duplicate entry", "A duplicate entry has been found, over write previous alignment?") If $MsgBox = 7 Then ExitLoop Else Now with this code I'll check for duplicates, but if I find one, what would be the best way to over-write it easily? Also, I'll need a section for if there is no duplicate. Would I need to do a FileReadLine, add +1 to the value for the INI Status and then add the X,Y, as well? Just looking for some suggestions on the best way to do this, thanks 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
Zedna Posted May 7, 2012 Posted May 7, 2012 Better approach will be to avoid creating duplicates instead of removing them post. I think with different INI structure it avoid duplicates: [Status] 1=Partly Cloudy|45,200 2=Isolated T-Storms|37,200 3=Mostly Cloudy|45,200 4=Mostly Sunny|47,200 Resources UDF ResourcesEx UDF AutoIt Forum Search
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