Skip to content
⌘ NSIS Forum Archive

Test on .oninit and change section flag

5 posts

ricky03#

Test on .oninit and change section flag

Hello,

I read a lot of topics, but i don't found a solution at my problem.

I want to do a test in the Function .onInit dependind the result, I want to unselect an put the flag readonly in one or more section and/or sectiongroup. How can I do that?

Thanks in advance
Regards
CrushBug#
Here is a section of an installer I use.
Section "WoW Mod #1 v0.7" WM1_id
    SetOutPath "$0Interface\AddOns"
    RMDir /r "$0Interface\AddOns\WoWMod1"
    File /r "WoWMod1"
SectionEnd
Function .onInit
    ;find the registry entry for WoW
    ReadRegStr $0 HKLM "SOFTWARE\Blizzard Entertainment\World of Warcraft" "InstallPath"
    ; check for which mods exist
    ;WoWMod1
    ${DirState} "$0Interface\AddOns\WoWMod1" $R0
    ${If} $R0 != -1
        IntOp $R1 ${SF_SELECTED} | ${SF_RO}
        SectionSetFlags "${WM1_id}" $R1
    ${EndIf}
FunctionEnd  ;onInit 
If the directory exists then the section checkbox would be checked and set to Read Only.