Prev Previous Post   Next Post Next
Old 6th June 2008, 16:04   #5
glenncarr
Junior Member
 
Join Date: Feb 2002
Location: Tulsa, OK, US
Posts: 26
Send a message via AIM to glenncarr Send a message via Yahoo to glenncarr
Take a look at the GetOptions macro defined in FileFunc.nsh. It allows command line options like /RESPONSE=responsefile.ini. If you format it as an .ini file, you can use the ReadINIStr commands to pull information out of it, such as usernames and passwords.

In our case we simply supply a sample response.ini file, so that our user can create their own to do silent installs like this:

OurSetup.exe /S /RESPONSE=responses.ini

...where responses.ini might contain:

code:
; Global installation options
[Options]
InstallDir=C:\Program Files\MyApp
Password=password


Here's some sample script for getting the values:
code:

!include FileFunc.nsh

...

!insertmacro GetOptions

...

StrCpy $1 ""
${GetOptions} $0 "/RESPONSE=" $1

IfErrors 0 RespExists
DetailsLogSet on
DetailPrint "*** No response file was specified for silent installation, setup will abort."
Abort

RespExists:
IfFileExists $1 RespFile
DetailsLogSet on
DetailPrint "*** Response file specified was not found for silent installation, setup will abort."
Abort

RespFile:
StrCpy $RespFile $1

ReadINIStr $0 $RespFile "Options" "InstallDir"
StrCmp $0 "" NoDir
StrCpy $INSTDIR $0

NoDir:
DetailsLogSet on
DetailPrint "Using response file $RespFile"



(You'll need to remove or replace the DetailsLogSet unless you use the build I posted about earlier, or replace it with LogSet and use LogText instead of DetailPrint.)
glenncarr is offline   Reply With Quote
 
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