KMyers
19th July 2010 21:20 UTC
Simple NSIS Question
Hello All,
I am trying to build an installer to automate several installation packages. One of the packages needs an ini file to be placed at c:\config\aconfig.ini . I need to prompt the user to enter a specific value to add to this file. I have spent 6 hours trying to figure this out but everything I try seems to fail.
Can anyone code up a simple example on the best way to do this?
Animaether
19th July 2010 22:22 UTC
You could use one of the user input plugins that generate a pop-up:
http://nsis.sourceforge.net/Dialogs_plug-in
http://nsis.sourceforge.net/PassDialog_plug-in
Or you can create a field on a custom page.. e.g.
!include "nsDialogs.nsh"
OutFile "test.exe"
Section
SectionEnd
Var dialog
Var hwnd
Var null
Var ui_ini_keyvalue
Page Custom page.custom.create page.custom.leave
Function page.custom.create
nsDialogs::Create 1018
Pop $dialog
${NSD_CreateGroupBox} 0 0 100% 20% "Please enter the INI key value"
Pop $null
${NSD_CreateText} 5% 8% 90% 8% "Default Value"
; Default values should be handled differently.
; http://forums.winamp.com/showthread.php?t=305165
Pop $ui_ini_keyvalue
${NSD_OnChange} $ui_ini_keyvalue cb_ini_keyvalue.onchange
nsDialogs::Show
FunctionEnd
Function cb_ini_keyvalue.onchange
Pop $hwnd
${NSD_GetText} $hwnd $0
MessageBox MB_OK "User changed: [$0]"
FunctionEnd
Function page.custom.leave
${NSD_GetText} $ui_ini_keyvalue $0
MessageBox MB_OK "User entered: [$0]"
FunctionEnd
MSG
20th July 2010 07:58 UTC
Hah. ini-key shoes, only $40 a pair. Get them while they're hot! :)