Jump to content
Sign in to follow this  

Best way to do a file check/re-write

Recommended Posts


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.


1=Partly Cloudy
2=Isolated T-Storms
3=Mostly Cloudy
4=Mostly Sunny

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

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

Share this post

Link to post
Share on other sites

Better approach will be to avoid creating duplicates instead of removing them post.

I think with different INI structure it avoid duplicates:

1=Partly Cloudy|45,200
2=Isolated T-Storms|37,200
3=Mostly Cloudy|45,200
4=Mostly Sunny|47,200

Share this post

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.