Eru Posted February 28, 2007 Share Posted February 28, 2007 My inifile looks like this: [ColorSet] Color=XXX|YYY|ZZZ XXX=111 YYY=222 ZZZ=333 I'm trying to use IniDelete to remove a specific saved set from the array, but all I'm getting it to do is remove the lower portion. CSDel(YYY) yields: [ColorSet] Color=XXX|YYY|ZZZ XXX=111 ZZZ=333 How can I get rid of the YYY in the variable list? I'm using a script to append to the end of it when I write, but can't seem to figure out how to search for what I want, then remove it. Thank you for putting up with my newbie questions. m()m Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 28, 2007 Moderators Share Posted February 28, 2007 You'll have to re-write the value with IniWrite(.ini, colorset, color, xxx|zzz). Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Creative Posted March 1, 2007 Share Posted March 1, 2007 (edited) Func IniDeleteSet($iniFilename, $sectionName, $keyName) $temp_string = StringReplace(FileRead($iniFilename, FileGetSize($iniFilename)), ($keyName & "=" & IniRead($iniFilename, $sectionName, $keyName, "") & @CRLF), "", 0, 1) FileOpen($iniFilename, 2) Local $temp_fileHandle = FileWrite($iniFilename, $temp_string) FileClose($temp_fileHandle) EndFuncoÝ÷ Ø@ÈMay++y§H¶§*.Á©í¶¢YhÂ)àjëh×6$colorValue = IniRead("test.ini", "ColorSet", "Color", "") $colorValue = StringReplace($colorValue, "YYY", "") $colorValue = StringReplace($colorValue, "||", "|") IniWrite("test.ini", "ColorSet", "Color", $colorValue) Edited March 1, 2007 by Creative "Everything is vague to a degree you do not realize till you have tried to make it precise." - Bertrand Russell [The Philosophy of Logical Atomism] Link to comment Share on other sites More sharing options...
Eru Posted March 2, 2007 Author Share Posted March 2, 2007 Thanks guys. It always seems so easy when someone points it out. 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