I have this issue:
I use a ini section inside my script (didnt want to make a a separate file for this).
When i already have a key inside it, all goes right. I can read and overwrite it at will.
But i want to be able to add more entries during execution time (a user types something, and it's added to a section inside the script).
The problem is: when the key is not already present in the ini section, i use iniwrite, and the entries are inserted at the end of the script (sometimes not at the very end, i don't understand this behaviour, actually).
example: how my code is written before i execute script:
Code: Select all
/*
[inisection]
key1= black
key2= blue
key3 = green.
*/
::write::
newvalue= red ; (this would be set using some input box or GUI, but im setting here for testing purposes
newkey= key4
IniWrite, %newkey%, %A_ScriptFullPath%, inisection, %newvalue%
return
how i want my code to be, after i execute the script:
Code: Select all
/*
[inisection]
key1= black
key2= blue
key3 = green.
key4 = red ; <----------------------------------------------- new entry should have been added here
*/
::write::
newvalue= red
newkey= key4
IniWrite, %newkey%, %A_ScriptFullPath%, inisection, %newvalue%
return
Code: Select all
/*
[inisection]
key1= black
key2= blue
key3 = green.
*/
::write::
newvalue= red
newkey= key4
IniWrite, %newkey%, %A_ScriptFullPath%, inisection, %newvalue%
return
[inisection] ; <- --------------- *this line gives error : "this line does not contain recognized action"
key4=red ;<------------------------------------------ the entry was sent here instead.
What am i doing wrong?
Thanks!