Announcement

Collapse
No announcement yet.

Delete all Section from INI file with similar Data ?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Delete all Section from INI file with similar Data ?

    Hello Everyone.

    How Can i Delete all Section from INI file with similar Data ? (without set Section Name)
    for example i want to delete section 1 and 2 because version of both is 1.2.7

    ------------------------------------------------------------------------------
    [Section1]
    File=test1.zip
    version=1.2.7

    [Section2]
    File=test2.zip
    version=1.2.7

    [Section3]
    File=test3.zip
    version=4.2.7

    [Section4]
    File=test4.zip
    version=3.2.7
    ------------------------------------------------------------------------------

    Code:
    MyFile = INIFile.GetSectionNames(_WindowsFolder.."\\My Settings.ini");
    Compare = String.CompareFileVersions("1.2.7", MyFile);
    if MyFile == Compare then
    INIFile.DeleteSection(_WindowsFolder.."\\My Settings.ini", "All Section With Similar Data" );
    ------------------------------------------------------------------------------

    Thanx

  • #2
    Originally posted by JSTX2013 View Post
    Hello Everyone.

    How Can i Delete all Section from INI file with similar Data ? (without set Section Name)
    for example i want to delete section 1 and 2 because version of both is 1.2.7

    ------------------------------------------------------------------------------
    [Section1]
    File=test1.zip
    version=1.2.7

    [Section2]
    File=test2.zip
    version=1.2.7

    [Section3]
    File=test3.zip
    version=4.2.7

    [Section4]
    File=test4.zip
    version=3.2.7
    ------------------------------------------------------------------------------

    Code:
    MyFile = INIFile.GetSectionNames(_WindowsFolder.."\\My Settings.ini");
    Compare = String.CompareFileVersions("1.2.7", MyFile);
    if MyFile == Compare then
    INIFile.DeleteSection(_WindowsFolder.."\\My Settings.ini", "All Section With Similar Data" );
    ------------------------------------------------------------------------------

    Thanx
    Wouldn't you want to just delete one of them ? as if you delete both there wont be any left at all lol

    you could do it many ways really there is more ini options you can use also loops and tables will help you, I would say collect all your sections and values in a table compare them delete the ones you don't need and resave to a ini or remove that section name from the ini.
    Plugins or Sources MokoX
    BunnyHop 2021 Here

    Comment


    • #3
      Thank you for reply.

      if it possible please show example.

      thanx

      Comment


      • #4
        Originally posted by JSTX2013 View Post
        Thank you for reply.

        if it possible please show example.

        thanx
        Sadly not as loops and INI examples are all over the forum from yesteryear and the help file also has all you need, plus my internet connect is really bad so I can't upload any APZ's I feel if you read the manual though the INI sections and look at loops, whiles and so on in the help file, in the help file type loops and then click Control Structures in the list is a good start.

        Good luck.
        Plugins or Sources MokoX
        BunnyHop 2021 Here

        Comment

        Working...
        X