Old 18th September 2006, 08:09   #1
ginther
Junior Member
 
Join Date: Sep 2006
Posts: 5
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
ginther is offline   Reply With Quote
Old 18th September 2006, 08:11   #2
Comm@nder21
Major Dude
 
Join Date: Jul 2003
Location: germany, b-w
Posts: 734
Send a message via ICQ to Comm@nder21
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.
Comm@nder21 is offline   Reply With Quote
Old 18th September 2006, 08:20   #3
ginther
Junior Member
 
Join Date: Sep 2006
Posts: 5
Thx Comm@nder21 for the fast reply.

ginther
ginther is offline   Reply With Quote
Old 18th September 2006, 14:22   #4
ginther
Junior Member
 
Join Date: Sep 2006
Posts: 5
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
ginther is offline   Reply With Quote
Old 22nd September 2006, 09:10   #5
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
To hide a section, set its name to nothing at runtime using SectionSetText. The hyphen is only checked on compile time.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 22nd September 2006, 11:44   #6
ginther
Junior Member
 
Join Date: Sep 2006
Posts: 5
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.
ginther is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump