Skip to content
⌘ NSIS Forum Archive

condition sections based on target machine

3 posts

digitect#

condition sections based on target machine

Is it possible to display or omit a particular section based on the target environment? I'd like to diplay a component only if the user has a certain environmental variable and that variable is a directory.

Thanks.

--
Steve Hall [ digitect@mindspring.com ]
kichik#
Yes, set it's name to an empty string ("") using SectionSetText. For example:

Section "Only on XP" XPSection
  # ....
SectionEnd
Function .onInit
  # get OS into $0
  StrCmp $0 "XP" +3
    SectionSetText ${XPSection} ""
    SectionSetFlags ${XPSection} 0 # unselect section
FunctionEnd 
digitect#
Thanks for the reply, the short version is that it worked.

The long version involves me spending hours and hours to get it to do so, finally realizing that functions must follow sections. 😉