.ini +1 Topic is solved
.ini +1
How can use a variable to write .ini file? like if previous Key value is 1, then make it 2 next time and increase by 1 everytime, Thanks!
Re: .ini +1
Hi HIAC,
You can force an expression:
You can force an expression:
Code: Select all
IniWrite, % var+1, %iniFilePath%, mySection, myKey
Code: Select all
iniFile := A_ScriptDir . "\test_ini.ini" ; use the colon-equal operator, which evaluates an expression and stores the result in a variable, everything that is not enclosed in quotes is supposed to be the name of a variable, a mathematical operation, a function call etc.; the dot is used to concatenate
if not (FileExist(iniFile)) {
FileAppend,
(
[mySection]
myKey=5
), % iniFile, utf-16 ; IniRead an IniWrite rely on functions which support Unicode only in UTF-16 files (if you intend to use cyrillic for example)
}
sleep, 1000
Loop, 5
{
IniRead, outputvar, % iniFile, mySection, myKey
IniWrite, % outputvar+5, % iniFile, mySection, myKey ; *100 for example
Run, notepad %iniFile%,,, PID ; runs notepad and stores its process ID in PID outputvar
WinWait, ahk_pid %PID%
WinWaitClose
}
Re: .ini +1
Thank you very much..
Now I have the problem when KEY contains "[ ]" value will become ERROR and it will write new key instead of overwriting it ( I use variable for key)
Now I have the problem when KEY contains "[ ]" value will become ERROR and it will write new key instead of overwriting it ( I use variable for key)
Code: Select all
[ABV]
[AA]BB[CC]=1
[AA]BB[CC]=1
Re: .ini +1 Topic is solved
Actually, brackets are meaningfull using the ini format; you'll have to escape them:
[EDIT] Escaping only the first one should work too.
Code: Select all
[ABV]
\[AA\]BB\[CC\]=1
\[AA\]BB\[CC\]=1
; ...
IniRead, outputvar, % iniFile, ABV, \[AA\]BB\[CC\], ERROR
Re: .ini +1
Solved, thank you
Who is online
Users browsing this forum: rc76 and 217 guests