Jump to content

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.

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 ;)

MCR.jpg?t=1286371579

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

  • 3 weeks later...

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...