Skip to content
⌘ NSIS Forum Archive

Counf keys in ini section

5 posts

bukox#

Counf keys in ini section

Hello.
How can I count keys in section or check if any key exists in section in ini file? I can use EnumINI plugin but that is very uncomfortable way.

bye...
Afrow UK#
You could use this function:


Stu
Comperio#
There are no built-in functions for this if that's what you're asking.

For counting, Afrow's is probably the best you're going to get (aside from writing your own function/macro).

For checking the existence of a key, you could use:
!include logiclib.nsh
...
ReadIniStr $0 "C:\myfile.ini" "Section" "Key"
${if} ${Errors}
MessageBoz MB_OK "key does not exist"
${Else}
MessageBox MB_OK "Key was found"
${endIf}
bukox#
Yes, but I want to know if any key exists in section (count of keys is gross than 0) becouse I don't know name of keys and I don't need it.

bye...