2003-07-15 21:26:07 +00:00
|
|
|
; UserVars.nsi
|
2003-06-12 00:06:23 +00:00
|
|
|
;
|
2003-07-15 21:26:07 +00:00
|
|
|
; This script shows you how to declare and user variables.
|
2003-06-12 00:06:23 +00:00
|
|
|
|
|
|
|
;--------------------------------
|
|
|
|
|
2003-07-15 21:26:07 +00:00
|
|
|
Name "User Variables Text"
|
2003-06-12 00:06:23 +00:00
|
|
|
OutFile "UserVars.exe"
|
2003-07-15 21:26:07 +00:00
|
|
|
|
|
|
|
InstallDir "$PROGRAMFILES\User Variables Test"
|
2003-09-05 15:16:15 +00:00
|
|
|
|
2008-02-04 01:09:03 +00:00
|
|
|
RequestExecutionLevel admin
|
2008-01-27 17:44:55 +00:00
|
|
|
|
2003-09-05 15:16:15 +00:00
|
|
|
;--------------------------------
|
|
|
|
|
|
|
|
;Pages
|
|
|
|
Page directory
|
|
|
|
Page instfiles
|
|
|
|
|
|
|
|
UninstPage uninstConfirm
|
|
|
|
UninstPage instfiles
|
2003-06-12 00:06:23 +00:00
|
|
|
|
|
|
|
;--------------------------------
|
2003-07-15 21:26:07 +00:00
|
|
|
; Declaration of user variables (Var command), allowed charaters for variables names : [a-z][A-Z][0-9] and '_'
|
2003-06-12 00:06:23 +00:00
|
|
|
|
2003-07-08 23:18:47 +00:00
|
|
|
Var "Name"
|
|
|
|
Var "Serial"
|
2003-07-15 23:40:34 +00:00
|
|
|
Var "Info"
|
2003-06-12 00:06:23 +00:00
|
|
|
|
|
|
|
;--------------------------------
|
2003-07-15 21:26:07 +00:00
|
|
|
; Installer
|
2003-06-12 00:06:23 +00:00
|
|
|
|
2003-07-15 21:26:07 +00:00
|
|
|
Section "Dummy Section" SecDummy
|
2003-06-12 00:06:23 +00:00
|
|
|
|
|
|
|
StrCpy $0 "Admin"
|
|
|
|
StrCpy "$Name" $0
|
|
|
|
StrCpy "$Serial" "12345"
|
2004-01-04 13:15:42 +00:00
|
|
|
MessageBox MB_OK "User Name: $Name $\n$\nSerial Number: $Serial"
|
2003-06-12 00:06:23 +00:00
|
|
|
|
2003-06-17 23:59:13 +00:00
|
|
|
CreateDirectory $INSTDIR
|
|
|
|
WriteUninstaller "$INSTDIR\Uninst.exe"
|
2003-07-15 21:26:07 +00:00
|
|
|
|
2003-06-12 00:06:23 +00:00
|
|
|
SectionEnd
|
|
|
|
|
2005-08-06 16:04:17 +00:00
|
|
|
Section "Another Section"
|
|
|
|
|
|
|
|
Var /GLOBAL "AnotherVar"
|
|
|
|
|
|
|
|
StrCpy $AnotherVar "test"
|
|
|
|
|
|
|
|
SectionEnd
|
|
|
|
|
2003-07-15 21:26:07 +00:00
|
|
|
;--------------------------------
|
|
|
|
; Uninstaller
|
2003-06-17 23:59:13 +00:00
|
|
|
|
|
|
|
Section "Uninstall"
|
|
|
|
|
2003-07-15 23:40:34 +00:00
|
|
|
StrCpy $Info "User variables test uninstalled successfully."
|
2003-06-17 23:59:13 +00:00
|
|
|
Delete "$INSTDIR\Uninst.exe"
|
|
|
|
RmDir $INSTDIR
|
|
|
|
|
|
|
|
SectionEnd
|
2003-07-15 21:26:07 +00:00
|
|
|
|
|
|
|
Function un.OnUninstSuccess
|
|
|
|
|
|
|
|
HideWindow
|
2003-07-15 23:40:34 +00:00
|
|
|
MessageBox MB_OK "$Info"
|
2003-07-15 21:26:07 +00:00
|
|
|
|
2003-07-15 23:40:34 +00:00
|
|
|
FunctionEnd
|