Statistiques
| Révision :

root / tmp / org.txm.setups / nsis / Examples / UserVars.nsi @ 2956

Historique | Voir | Annoter | Télécharger (1,33 ko)

1
; UserVars.nsi
2
;
3
; This script shows you how to declare and user variables.
4

    
5
;--------------------------------
6

    
7
  Name "User Variables Text"
8
  OutFile "UserVars.exe"
9
  
10
  InstallDir "$PROGRAMFILES\User Variables Test"
11
  
12
  RequestExecutionLevel admin
13
  
14
;--------------------------------
15

    
16
  ;Pages
17
  Page directory
18
  Page instfiles
19
  
20
  UninstPage uninstConfirm
21
  UninstPage instfiles
22

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

    
26
  Var "Name"
27
  Var "Serial"
28
  Var "Info"
29

    
30
;--------------------------------
31
; Installer
32

    
33
Section "Dummy Section" SecDummy
34

    
35
     StrCpy $0 "Admin"
36
     StrCpy "$Name" $0
37
     StrCpy "$Serial" "12345"
38
     MessageBox MB_OK "User Name: $Name $\n$\nSerial Number: $Serial"
39

    
40
     CreateDirectory $INSTDIR
41
     WriteUninstaller "$INSTDIR\Uninst.exe"
42
     
43
SectionEnd
44

    
45
Section "Another Section"
46

    
47
     Var /GLOBAL "AnotherVar"
48

    
49
     StrCpy $AnotherVar "test"
50

    
51
SectionEnd
52

    
53
;--------------------------------
54
; Uninstaller
55

    
56
Section "Uninstall"
57

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

    
62
SectionEnd
63

    
64
Function un.OnUninstSuccess
65

    
66
     HideWindow
67
     MessageBox MB_OK "$Info"
68
     
69
FunctionEnd