summaryrefslogtreecommitdiff
path: root/Docs/src/misc.but
blob: da449c214885a485f9b5d4c3e9645d7242a8194b (plain)
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
\S1{miscinst} Miscellaneous Instructions

\S2{geterrorlevel} GetErrorLevel

\c user_var(error level output)

Returns the last error level set by \R{seterrorlevel}{SetErrorLevel} or -1 if it has never been set.

\c GetErrorLevel $0
\c IntOp $0 $0 + 1
\c SetErrorLevel $0

\S2{getinstdirerror} GetInstDirError

\c user_var(error output)

Use in the leave function of a directory page. Reads the flag set if '\R{adirverify}{DirVerify leave}' is used. Possible values:

0: No error

1: Invalid installation directory

2: Not enough space on installation drive

\c !include LogicLib.nsh
\c PageEx directory
\c   DirVerify leave
\c   PageCallbacks "" "" dirLeave
\c PageExEnd
\c
\c Function dirLeave
\c   GetInstDirError $0
\c   ${Switch} $0
\c     ${Case} 0
\c       MessageBox MB_OK "valid installation directory"
\c       ${Break}
\c     ${Case} 1
\c       MessageBox MB_OK "invalid installation directory!"
\c       Abort
\c       ${Break}
\c     ${Case} 2
\c       MessageBox MB_OK "not enough free space!"
\c       Abort
\c       ${Break}
\c   ${EndSwitch}
\c FunctionEnd

\S2{initpluginsdir} InitPluginsDir

Initializes the plug-ins dir (\R{varconstant}{$PLUGINSDIR}) if not already initialized.

\c InitPluginsDir
\c File /oname=$PLUGINSDIR\image.bmp image.bmp

\S2{nop} Nop

Does nothing.

\S2{seterrorlevel} SetErrorLevel

\c error_level

Sets the error level of the installer or uninstaller to \e{error_level}. See \R{errorlevels}{Error Levels} for more information.

\c IfRebootFlag 0 +2
\c   SetErrorLevel 4

\S2{setshellvarcontext} SetShellVarContext

\c \\<b\\>current\\</b\\>|all

Sets the context of $SMPROGRAMS and other \R{varconstant}{shell folders}. If set to 'current' (the default), the current user's shell folders are used. If set to 'all', the 'all users' shell folder is used. The all users folder may not be supported on all OSes. If the all users folder is not found, the current user folder will be used. Please take into consideration that a "normal user" has no rights to write in the all users area. Only admins have full access rights to the all users area. You can check this by using the UserInfo plug-in. See Contrib\\UserInfo\\UserInfo.nsi for an example.

Note that, if used in installer code, this will only affect the installer, and if used in uninstaller code, this will only affect the uninstaller. To affect both, it needs to be used in both.

\c SetShellVarContext current
\c StrCpy $0 $DESKTOP
\c SetShellVarContext all
\c StrCpy $1 $DESKTOP
\c MessageBox MB_OK $0$\n$1

\S2{sleep} Sleep

\c sleeptime_in_ms

Pauses execution in the installer for sleeptime_in_ms milliseconds. sleeptime_in_ms can be a variable, e.g. "$0" or a number, i.e. "666".

\c DetailPrint "sleeping..."
\c Sleep 3000
\c DetailPrint "back to work"