Jammer Posted February 22, 2005 Share Posted February 22, 2005 (edited) First the material.... Old ini: [a] a1=someinfo1 a2=someinfo2 a3=someinfo3 a4=someinfo4 a5=someinfo5 New ini(The result i need to get):[a] a1=someinfo1 a2=someinfo3 a3=someinfo4 a4=someinfo5 My script witch isin't working: $a = "f.ini" $z = 0 $f = 0 $line = 2;The line witch should be deleted.... Do $f = $f + 1 Until IniRead($a, "a", "a" & $f, "") = "" Do $z = $z + 1 Until $line = IniRead($a, "a", "a" & $z, "") ;IniDelete($a, "a", "a" & $z) Do $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 Do 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 February 22, 2005 by Jammer Link to comment Share on other sites More sharing options...
Developers Jos Posted February 22, 2005 Developers Share Posted February 22, 2005 Hope some1 is smart enought to do this...<{POST_SNAPBACK}>Aha a challenge.... 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) EndIf WEnd ;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 comment Share on other sites More sharing options...
Jammer Posted February 22, 2005 Author Share Posted February 22, 2005 tyvm - thank you very much... ur genius Link to comment Share on other sites More sharing options...
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