File: UserVars.nsi

package info (click to toggle)
nsis 2.51-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 10,368 kB
  • ctags: 9,644
  • sloc: cpp: 32,346; ansic: 29,335; python: 1,148; asm: 532; xml: 487; pascal: 179; makefile: 178
file content (69 lines) | stat: -rwxr-xr-x 1,361 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
; UserVars.nsi
;
; This script shows you how to declare and user variables.

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

  Name "User Variables Text"
  OutFile "UserVars.exe"
  
  InstallDir "$PROGRAMFILES\User Variables Test"
  
  RequestExecutionLevel admin
  
;--------------------------------

  ;Pages
  Page directory
  Page instfiles
  
  UninstPage uninstConfirm
  UninstPage instfiles

;--------------------------------
; Declaration of user variables (Var command), allowed charaters for variables names : [a-z][A-Z][0-9] and '_'

  Var "Name"
  Var "Serial"
  Var "Info"

;--------------------------------
; Installer

Section "Dummy Section" SecDummy

     StrCpy $0 "Admin"
     StrCpy "$Name" $0
     StrCpy "$Serial" "12345"
     MessageBox MB_OK "User Name: $Name $\n$\nSerial Number: $Serial"

     CreateDirectory $INSTDIR
     WriteUninstaller "$INSTDIR\Uninst.exe"
     
SectionEnd

Section "Another Section"

     Var /GLOBAL "AnotherVar"

     StrCpy $AnotherVar "test"

SectionEnd

;--------------------------------
; Uninstaller

Section "Uninstall"

     StrCpy $Info "User variables test uninstalled successfully."
     Delete "$INSTDIR\Uninst.exe"
     RmDir $INSTDIR

SectionEnd

Function un.OnUninstSuccess

     HideWindow
     MessageBox MB_OK "$Info"
     
FunctionEnd