Archive: Custom page fields count


Custom page fields count
How to get the number of fields in a custom page.


Not sure if there is a better way, but this should do as long as every Field has a State:

StrCpy $0 1
ClearErrors
Read:
ReadINIStr $1 "<ini_path>\<ini_file>" "Field $0" "State"
IfErrors Stop
IntOp $0 $0 + 1
Goto Read

Stop:
IntOp $0 $0 - 1
DetailPrint "Number of fields: $0"


CF

As long as the INI file is srt up correctly, just read Settings > NumFields!

-Stu


I thought that InstallOptionsEx doesn't need to have the NumFields parameter in the INI file ...
CF


The the original question did not refer specifically to InstallOptionsEX, so it should be assumed that we're talking about the normal InstallOptions. (InstallOptionsEX is actually it's own project now on SourceForce whereas InstallOptions is part of the NSIS install.)

But, it is a correct to say that in IOEX treats the NumFields setting as optional.

(On the plus side, if you use either the Exclipse InstallOptions plugin or HN NIS Edit program for creating your custom page, then you'll get the NumFields value set properly, so I think just reading the value is still a good way to go.)


Fair enough.
I mainly use InstallOptionsEx so it makes sense, since I do not have a NumFields value, to read the number of fields in another way :)
CF