ginther
18th September 2006 09:09 UTC
Network check
Hello @all,
i have two install options. Local and Network. I want to check at the begin of setup.exe, if the network resource is reachable. If the network isn't reachable (e.g. setup.exe is on a CD) the option should not be available.
Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
StrCpy $1 ${LocInstHint}
IfFileExists "$EXEDIR\fileexists.txt" NetworkExists NetworkUnreachable
NetworkUnreachable:
MessageBox MB_OK "file isn't installed"
' code to disable the network install option ???
NetworkExists:
MessageBox MB_OK "file is installed"
FunctionEnd
Function .onSelChange
!insertmacro StartRadioButtons $1
!insertmacro RadioButton ${LocInstHint2}
!insertmacro RadioButton ${LocInstHint}
!insertmacro EndRadioButtons
FunctionEnd
Is .onInit the right place for this check?
How can I check/uncheck the RadioButton with code?
Thx ginther
Comm@nder21
18th September 2006 09:11 UTC
i'd do the check in the init function of the components page.
there you need to use SectionGetFlags and SectionSetFlags to set/unset the selected flag on the sections.
ginther
18th September 2006 09:20 UTC
Thx Comm@nder21 for the fast reply.
ginther
ginther
18th September 2006 15:22 UTC
The NSIS helpfile show an example for an hidden Section:
Section "-hidden section"
SectionEnd
Isn't it possible to use a variable for "-hidden section"?
In my project the variable $InstallNetwork isn't able to hide the Section (see Code). There are always the specified section called -Installation (network) available. Is there a possibility to solve this problem?
Thx
Section /o $InstallNetwork LocInstHint2
...
SectionEnd
Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
StrCpy $1 ${LocInstHint} ; Group 1 - Option 1 is selected by default
IfFileExists "$EXEDIR\fileexists.txt" NetworkExists NetworkUnreachable
NetworkUnreachable:
MessageBox MB_OK "file isn't installed"
StrCpy $InstallNetwork "-Installation (network)"
GoTo Label
NetworkExists:
MessageBox MB_OK "file is installed"
StrCpy $InstallNetwork "Installation (network)"
Label:
FunctionEnd
kichik
22nd September 2006 10:10 UTC
To hide a section, set its name to nothing at runtime using SectionSetText. The hyphen is only checked on compile time.
ginther
22nd September 2006 12:44 UTC
Hello kichik,
i solved the problem by using a similar method.
...
NetworkUnreachable:
MessageBox MB_OK "file isn't installed"
StrCpy $InstallNetwork ""
...
But i think using SectionSetText section_index "" is the prefered method. :)
Thx for your hint.