Old 7th May 2007, 18:34   #1
jackkoho
Member
 
Join Date: Oct 2006
Posts: 70
user selects silent vs normal install

I am trying to do what I stated in the subject. Currently, I am using an InstallOptions page for the user to select custom vs express install. However, I can't use Silent inside a function and I can't use conditionals outside a function. So I'm not quite sure how to approach this.

I have tried using InstType but it rewrites my SF_SELECTED flags to 0 when I have them set in .onInit.

Jack
jackkoho is offline   Reply With Quote
Old 7th May 2007, 21:51   #2
goldy1064
Senior Member
 
Join Date: Jun 2005
Posts: 211
According to the documentation here, you may only set the installer silent during .onInit.

To get around this, you would need a secondary installer that could wrap around your primary. The wrapper installer would just display the custom InstallOptions page you want and pass either a /S or not to the primary installer.
goldy1064 is offline   Reply With Quote
Old 7th May 2007, 22:49   #3
theblazingangel
Junior Member
 
Join Date: Mar 2006
Posts: 29
perhaps:

1) use the leave function for your install options page to set a global variable which will tell the rest of the script whether it's in normal/express mode
2) use the pre function for other pages to detect express mode, and if so just execute the code and use abort to skip the page (silent)
theblazingangel is offline   Reply With Quote
Old 8th May 2007, 20:53   #4
jackkoho
Member
 
Join Date: Oct 2006
Posts: 70
this wrapper installer idea is pretty crazy but I am going to give it a shot. Will let you know on any progress.
jackkoho is offline   Reply With Quote
Old 9th May 2007, 17:26   #5
jackkoho
Member
 
Join Date: Oct 2006
Posts: 70
The wrapper idea worked!

Here is my code from the wrapper:
code:


;--------------------------------

;Include Modern UI

!include "MUI.nsh"

!include "zipdll.nsh"

!include LogicLib.nsh



;--------------------------------

;General

Name "xxx - v0.9.12"

OutFile "xxxtest-wrapper.exe"







;--------------------------------

;Interface Settings

!define MUI_HEADERIMAGE

!define MUI_HEADERIMAGE_BITMAP "header.bmp" ; optional

!define MUI_ABORTWARNING





;--------------------------------

;Pages

!insertmacro MUI_PAGE_LICENSE "ct_license.txt"

Page custom customvsexpress

!insertmacro MUI_PAGE_INSTFILES

!insertmacro MUI_DEFAULT MUI_FINISHPAGE_TEXT "finishpage text"

!insertmacro MUI_DEFAULT MUI_FINISHPAGE_TITLE "finishpagetitle"

!insertmacro MUI_PAGE_FINISH





;--------------------------------

;Languages

!insertmacro MUI_LANGUAGE "English"





ReserveFile "iotest.ini"

!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS



;--------------------------------

;Variables



Var INI_EXPRESS

Var INI_CUSTOM



#--------------

;Installer Sections



Function customvsexpress

!insertmacro MUI_INSTALLOPTIONS_DISPLAY "iotest.ini"

!insertmacro MUI_HEADER_TEXT "$(TEXT_IO_TITLE)" "$(TEXT_IO_SUBTITLE)"

!insertmacro MUI_INSTALLOPTIONS_READ $INI_CUSTOM "iotest.ini" "Field 1" "State"

!insertmacro MUI_INSTALLOPTIONS_READ $INI_EXPRESS "iotest.ini" "Field 2" "State"

MessageBox MB_OK "$INI_CUSTOM $INI_EXPRESS"

FunctionEnd





Section "xxx" xxx

#call customvsexpress

File setupxxxjacktest.exe

StrCmp $INI_CUSTOM "1" custom silent

custom:

ExecWait "setupxxxjacktest.exe"

goto end

silent:

ExecWait "setupxxxjacktest.exe /S"

end:

SectionEnd




Function .onInit

System::Call 'kernel32::CreateMutexA(i 0, i 0, t "CamerTutorMutex") i .r1 ?e'

Pop $R0

StrCmp $R0 0 +3

MessageBox MB_OK|MB_ICONEXCLAMATION "The installer is already running."

Abort



Pop $0

ClearErrors



!insertmacro MUI_INSTALLOPTIONS_EXTRACT "iotest.ini"





FunctionEnd




LangString TEXT_IO_TITLE ${LANG_ENGLISH} "Express vs. Custom Install"

LangString TEXT_IO_SUBTITLE ${LANG_ENGLISH} "This page allows the user to choose between an express and custom install."






Notice how I left the license page and finish page in the wrapper.
jackkoho is offline   Reply With Quote
Old 9th May 2007, 17:27   #6
jackkoho
Member
 
Join Date: Oct 2006
Posts: 70
sorry for all the extra space, that was my first time posting code
jackkoho is offline   Reply With Quote
Old 9th May 2007, 17:28   #7
jackkoho
Member
 
Join Date: Oct 2006
Posts: 70
the one downside to this is that I have some execwaits in my wrapped program that have to install OTHER programs which somewhat ruins the silent experience.
jackkoho is offline   Reply With Quote
Old 4th December 2008, 13:44   #8
MarkA
Junior Member
 
Join Date: Dec 2008
Posts: 2
user selects silent vs normal install

Hi,
I have a similar problem in that I would like to be able to automatically decide whether to run a setup as silent or not.

I have a wrapper 'setup.exe' where the user selects which components they would like to install. This works perfectly well. However I would also like to be able to offer the components as separate install files and under this circumstance then the install file should not be silent.

In my wrapper I can add /S to the exec, but how do I make the setup file take notice and not show the welcome page, etc.

Scenario 1 (CD install)
Wrapper.exe (user select components)
run setup1.exe /S (No Welcome page, etc is displayed)
run setup2.exe /S (No Welcome page, etc is displayed)

Scenario 2 (Web install)
User downloads setup1.exe and runs setup1.exe
Welcome page, etc is displayed.

The idea is so that I don't have to keep in sync to separate versions of the same setup.


many thanks
Mark
MarkA is offline   Reply With Quote
Old 4th December 2008, 18:17   #9
chivalri
Junior Member
 
Join Date: Apr 2007
Location: Houston
Posts: 20
Non Interactive Installs

Here is what I have done to allow an installer to function in a not silent but not interactive manner.

I have my installer setup so that if I run without any command line variables, it runs as usual; however, if I add a /qb command line option then in onInit I set a variable NonInteractive to "1".

Then I use:
PHP Code:
# Installer pages
!define MUI_PAGE_CUSTOMFUNCTION_PRE dirPre
!insertmacro MUI_PAGE_WELCOME
!define MUI_PAGE_CUSTOMFUNCTION_PRE dirPre
!insertmacro MUI_PAGE_LICENSE VILicAgreement.txt
!define MUI_PAGE_CUSTOMFUNCTION_PRE dirPre
!insertmacro MUI_PAGE_DIRECTORY
!define MUI_PAGE_CUSTOMFUNCTION_PRE dirPre
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuGroup
!insertmacro MUI_PAGE_INSTFILES
!define MUI_PAGE_CUSTOMFUNCTION_PRE dirPre
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES

Function dirPre
    StrCmp $NonInteractive 
"1" 0 noskip
    Abort
noskip
:
FunctionEnd 
This causes the installer to run and display the status of what is going on but it does not interact with the user and closes automatically when done.
chivalri is offline   Reply With Quote
Old 5th December 2008, 08:36   #10
MarkA
Junior Member
 
Join Date: Dec 2008
Posts: 2
Hi,
thanks for the reply.
I will make some more tests a post the solution when I have it working.

regs
Mark
MarkA 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