ARozanski Posted October 20, 2008 Posted October 20, 2008 I have built an .ini with a certain amount of variables under a certain Section. The order of the keys in the section is essential to the program...is there any way i can change the value of the keys without having to delete the key and adding a new one which will go to the end of the section??
komalo Posted October 20, 2008 Posted October 20, 2008 i don't understand your problem well but you can use IniWrite [font="Palatino Linotype"][size="3"]AutoIt Script Examples :[/size][/font][font="Palatino Linotype"][size="3"]_CaptureBehindWindowGlass CMD for Windows Vista/Seven[/size][/font][left][/left][font="Palatino Linotype"][size="3"]Non AutoIt Script programs : Border Skin - Aero Glass On XP[/size][/font]
ARozanski Posted October 20, 2008 Author Posted October 20, 2008 IniWrite writes a NEW KEY with a NEW VALUE - which is ok - but it puts it at the END of the SECTION...like i said - the order of the keys in the section is essential for the program - ie. i cant start moving keys to the end...
komalo Posted October 20, 2008 Posted October 20, 2008 (edited) well if you used it with an existing key with existing value & existing section it will just replace it example : you have this ini [Section] 1=1 2=2 3=3 use this code IniWrite("New Text document.txt","Section","2","Changed") and it will change the calue of key 2 to Changed with the same order Edited October 20, 2008 by komalo [font="Palatino Linotype"][size="3"]AutoIt Script Examples :[/size][/font][font="Palatino Linotype"][size="3"]_CaptureBehindWindowGlass CMD for Windows Vista/Seven[/size][/font][left][/left][font="Palatino Linotype"][size="3"]Non AutoIt Script programs : Border Skin - Aero Glass On XP[/size][/font]
BrettF Posted October 20, 2008 Posted October 20, 2008 Nothing stopping you from using normal FileWrite... Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
rasim Posted October 20, 2008 Posted October 20, 2008 ARozanskiTry this:$sResult = _IniWriteEx(@ScriptDir & "\test.ini", "Section", "NewValue", "NewKey", 2) Func _IniWriteEx($sPath, $sSection, $sVal, $sKey, $sPos) Local $aSection, $iRead, $i $aSection = IniReadSection($sPath, $sSection) For $i = 1 To $aSection[0][0] If $i = $sPos Then $iRead &= $sVal & "=" & $sKey & @LF $iRead &= $aSection[$i][0] & "=" & $aSection[$i][1] & @LF Next Return IniWriteSection($sPath, $sSection, $iRead) EndFunc
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