Jump to content

I have no idea....Totaly lost...

Recommended Posts

First the material....

Old ini:


New ini(The result i need to get):


My script witch isin't working:

$a = "f.ini"
$z = 0
$f = 0
$line = 2;The line witch should be deleted....
$f = $f + 1
Until IniRead($a, "a", "a" & $f, "") = ""  
    $z = $z + 1
Until $line = IniRead($a, "a", "a" & $z, "")
;IniDelete($a, "a", "a" & $z)
    $z = $z + 1;Somekinda nonsense
    $k = $z + 1;Somekinda nonsense
    $v = $z - 1;Somekinda nonsense
    IniWrite($a, "a", "a" & $v, IniRead($a, "a", "a" & $k, ""))
Until IniRead($a, "a", "a" & $f, "") = ""

What i need to do:

I get the number of line witch i need to delete in var $line so i need a script witch would delete the $line'th line (in my case now 2 line) and decrease all keys that are more then $line (in this case 3,4,5) by 1... so i would get (1,2,3,4 with no spaces like 1,3,4,5 but the result of the old key's has not to change...) New ini from old ini....

have no idea how to do this....

I need to do this so because my reading system is so:

$x = 0
GuiCtrlSetData(-1, IniRead("f.ini", "a", "a" & $x, ""))
$x = $x + 1
Until IniRead("f.ini", "a", "a" & $x, "") = ""

So if i get a space in my ini like a1 a2 a4 .(there will be no a3 key) the script will read only until a2

Hope some1 is smart enought to do this...

Edited by Jammer
Link to post
Share on other sites
  • Developers

Hope some1 is smart enought to do this...


Aha a challenge.... :lmao:

Global $File = "f.ini"
Global $line = 2         ;The line which should be deleted....
Global $i_Counter = 0    ;Input Counter
Global $o_Counter = 0    ;Output Counter
While 1
    $i_Counter = $i_Counter + 1
    $tmpVal = IniRead($File, "a", "a" & $i_Counter, "")
    If $tmpVal = "" Then ExitLoop
    If $i_Counter <> $line Then
        $o_Counter = $o_Counter + 1
        IniWrite($File, "a", "a" & $o_Counter, $tmpVal)
;remove last input record
If $i_Counter >  $line then IniDelete($File, "a", "a" & $i_Counter - 1)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
Live for the present,
Dream of the future,
Learn from the past.

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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...