chssoccer Posted January 2, 2008 Share Posted January 2, 2008 (edited) How do I clear a section where there is nothing left in that section of the INI? Edited January 9, 2008 by chssoccer Link to comment Share on other sites More sharing options...
BigDod Posted January 2, 2008 Share Posted January 2, 2008 How do I clear a section where there is nothing left in that section of the INI?Try IniDelete without specifying a key. See the help file. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
chssoccer Posted January 2, 2008 Author Share Posted January 2, 2008 Try IniDelete without specifying a key. See the help file.no that didn't work... Link to comment Share on other sites More sharing options...
weaponx Posted January 2, 2008 Share Posted January 2, 2008 Works fine for me. IniWrite("test.ini","test1", "key1", "value1") IniWrite("test.ini","test2", "key2", "value2") IniWrite("test.ini","test3", "key3", "value3") IniDelete("test.ini", "test2") Link to comment Share on other sites More sharing options...
chssoccer Posted January 2, 2008 Author Share Posted January 2, 2008 Works fine for me. IniWrite("test.ini","test1", "key1", "value1") IniWrite("test.ini","test2", "key2", "value2") IniWrite("test.ini","test3", "key3", "value3") IniDelete("test.ini", "test2") That deletes the section, but I just want to delete everything in the section Link to comment Share on other sites More sharing options...
weaponx Posted January 2, 2008 Share Posted January 2, 2008 Are you saying you want to set all of the keys to blank values? Link to comment Share on other sites More sharing options...
chssoccer Posted January 2, 2008 Author Share Posted January 2, 2008 Are you saying you want to set all of the keys to blank values?No I want nothing in the section. Just to clear it completely. No keys, no values. Link to comment Share on other sites More sharing options...
weaponx Posted January 2, 2008 Share Posted January 2, 2008 Dude, if you use the IniDelete example I showed then it doesn't matter if the section name remains or not, if something attempts to write to that section it will recreate it. Link to comment Share on other sites More sharing options...
chssoccer Posted January 2, 2008 Author Share Posted January 2, 2008 Dude, if you use the IniDelete example I showed then it doesn't matter if the section name remains or not, if something attempts to write to that section it will recreate it. Oh ok. Link to comment Share on other sites More sharing options...
weaponx Posted January 2, 2008 Share Posted January 2, 2008 If you absolutely need to retain the section name I think you can do... $var = IniReadSection("test.ini", "section2") If @error Then MsgBox(4096, "", "Error occurred, probably no INI file.") Else For $i = 1 To $var[0][0] IniDelete( "test.ini", "section2", $var[$i][0]) Next EndIf Link to comment Share on other sites More sharing options...
GEOSoft Posted January 2, 2008 Share Posted January 2, 2008 Also if you search example scripts you will find a couple of INI Udfs. One by myself and 1 by Smoke_N. I think one of us might have been smart enough to add in an _INI_DeleteKey() function. On the other hand I don't remember for sure. It wouldn't be difficult to do though. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" 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