added small usage examples
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3703 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
07eb9b6425
commit
38b693f19a
24 changed files with 618 additions and 23 deletions
|
@ -70,6 +70,8 @@ Replaces dialog (\e{IDD_LICENSE}, \e{IDD_DIR}, \e{IDD_SELCOM}, \e{IDD_INST}, \e{
|
|||
|
||||
\b \e{IDD_VERIFY} must contain \e{IDC_STR} (static).
|
||||
|
||||
\c ChangeUI all "${NSISDIR}\Contrib\UIs\sdbarker_tiny.exe"
|
||||
|
||||
\S2{acheckbitmap} CheckBitmap
|
||||
|
||||
\c bitmap.bmp
|
||||
|
@ -132,11 +134,28 @@ The default string will be used if a string is empty ("").
|
|||
|
||||
Specifies which variable is to be used to contain the directory selected. This variable should contain the default value too. This allows to easily create two different directory pages that will not require you to move values in and out of $INSTDIR. The default variable is $INSTDIR. This can only be used in \R{pageex}{PageEx} and for directory and uninstConfirm pages.
|
||||
|
||||
\c Var ANOTHER_DIR
|
||||
\c PageEx directory
|
||||
\c DirVar $ANOTHER_DIR
|
||||
\c PageExEnd
|
||||
\c
|
||||
\c Section
|
||||
\c SetOutPath $INSTDIR
|
||||
\c File "a file.dat"
|
||||
\c SetOutPath $ANOTHER_DIR
|
||||
\c File "another file.dat"
|
||||
\c SectionEnd
|
||||
|
||||
\S2{adirverify} DirVerify
|
||||
|
||||
\c \\<b\\>auto\\</b\\>|leave
|
||||
|
||||
If `DirVerify leave' is used, the Next button will not be disabled if the installation directory is not valid or there is not enough space and a flag that you can read in the leave function using \R{getinstdirerror}{GetInstDirError} will be set instead.
|
||||
If `DirVerify leave' is used, the Next button will not be disabled if the installation directory is not valid or there is not enough space. A flag that you can read in the leave function using \R{getinstdirerror}{GetInstDirError} will be set instead.
|
||||
|
||||
\c PageEx directory
|
||||
\c DirVerify leave
|
||||
\c PageCallbacks "" "" dirLeave
|
||||
\c PageExEnd
|
||||
|
||||
\S2{a} FileErrorText
|
||||
|
||||
|
@ -207,6 +226,14 @@ If you make your license file a RTF file it is recommended you edit it with Word
|
|||
|
||||
Specifies if the displayed license must be accept explicit or not. This can be done either by a checkbox or by radiobuttons. By default the "next button" is disabled and will only be enabled if the checkbox is enabled or the right radio button is selected. If off is specified the "next button" is enabled by default.
|
||||
|
||||
\c LicenseForceSelection checkbox
|
||||
\c LicenseForceSelection checkbox "i accept"
|
||||
\c LicenseForceSelection radiobuttons
|
||||
\c LicenseForceSelection radiobuttons "i accept"
|
||||
\c LicenseForceSelection radiobuttons "i accept" "i decline"
|
||||
\c LicenseForceSelection radiobuttons "" "i decline"
|
||||
\c LicenseForceSelection off
|
||||
|
||||
\S2{alicensetext} LicenseText
|
||||
|
||||
\c [text [button_text]]
|
||||
|
@ -343,4 +370,3 @@ Sets whether or not the installer's icon is being displayed.
|
|||
\c on|\\<b\\>off\\</b\\>
|
||||
|
||||
Sets whether or not an XP manifest will be added to the installer. An XP manifest makes the installer controls use the new XP style when running on Windows XP. This affects the uninstaller too.
|
||||
|
||||
|
|
|
@ -10,24 +10,36 @@ The instructions that NSIS uses for scripting are sort of a cross between PHP an
|
|||
|
||||
Delete file (which can be a file or wildcard, but should be specified with a full path) from the target system. If /REBOOTOK is specified and the file cannot be deleted then the file is deleted when the system reboots -- if the file will be deleted on a reboot, the reboot flag will be set. The error flag is set if files are found and cannot be deleted. The error flag is not set from trying to delete a file that does not exist.
|
||||
|
||||
\c Delete $INSTDIR\somefile.dat
|
||||
|
||||
\S2{exec} Exec
|
||||
|
||||
\c command
|
||||
|
||||
Execute the specified program and continue immediately. Note that the file specified must exist on the target system, not the compiling system. $OUTDIR is used for the working directory. The error flag is set if the process could not be launched. Note, if the command could have spaces, you should put it in quotes to delimit it from parameters. e.g.: Exec '"$INSTDIR\\command.exe" parameters'. If you don't put it in quotes it will \e{not} work on Windows 9x with or without parameters.
|
||||
|
||||
\c Exec '"$INSTDIR\someprogram.exe"'
|
||||
\c Exec '"$INSTDIR\someprogram.exe" some parameters'
|
||||
|
||||
\S2{execshell} ExecShell
|
||||
|
||||
\c action command [parameters] [SW_SHOWNORMAL | SW_SHOWMAXIMIZED | SW_SHOWMINIMIZED | SW_HIDE]
|
||||
|
||||
Execute the specified program using ShellExecute. Note that action is usually "open", "print", etc, but can be an empty string to use the default action. Parameters and the show type are optional. $OUTDIR is used for the working directory. The error flag is set if the process could not be launched.
|
||||
|
||||
\c ExecShell "open" "http://nsis.sf.net/"
|
||||
\c ExecShell "open" "$INSTDIR\readme.txt"
|
||||
|
||||
\S2{execwait} ExecWait
|
||||
|
||||
\c command [user_var(exit code)]
|
||||
|
||||
Execute the specified program and wait for the executed process to quit. See Exec for more information. If no output variable is specified ExecWait sets the error flag if the program executed returns a nonzero error code, or if there is an error. If an output variable is specified, ExecWait sets the variable with the exit code (and only sets the error flag if an error occurs; if an error occurs the contents of the user variable are undefined). Note, if the command could have spaces, you should put it in quotes to delimit it from parameters. e.g.: ExecWait '"$INSTDIR\\command.exe" parameters'. If you don't put it in quotes it will \e{not} work on Windows 9x with or without parameters.
|
||||
|
||||
\c ExecWait '"$INSTDIR\someprogram.exe"'
|
||||
\c ExecWait '"$INSTDIR\someprogram.exe"' $0
|
||||
\c DetailPrint "some program returned $0"
|
||||
|
||||
\S2{file} File
|
||||
|
||||
\c [/nonfatal] [/a] ([/r] (file|wildcard) [...] | /oname=file.dat infile.dat)
|
||||
|
@ -48,6 +60,14 @@ Adds file(s) to be extracted to the current output path ($OUTDIR).
|
|||
|
||||
\b If the /nonfatal switch is used, a warning will be issued if no files found instead of an error.
|
||||
|
||||
\c File something.exe
|
||||
\c File /a something.exe
|
||||
\c File *.exe
|
||||
\c File /r *.dat
|
||||
\c File /r data
|
||||
\c File /oname=$TEMP\temp.dat somefile.ext
|
||||
\c File /nonfatal "a file that might not exist"
|
||||
|
||||
\S2{rename} Rename
|
||||
|
||||
\c [/REBOOTOK] source_file dest_file
|
||||
|
@ -56,6 +76,8 @@ Rename source_file to dest_file. You can use it to move a file from anywhere on
|
|||
|
||||
If no absolute path is specified the current folder will be used. The current folder is the folder set using the last \R{setoutpath}{SetOutPath} instruction. If you have not used \R{setoutpath}{SetOutPath} the current folder is \R{varother}{$EXEDIR}.
|
||||
|
||||
\c Rename $INSTDIR\file.ext $INSTDIR\file.dat
|
||||
|
||||
\S2{reservefile} ReserveFile
|
||||
|
||||
\c [/nonfatal] [/r] file [file...]
|
||||
|
@ -70,8 +92,16 @@ See \R{file}{File} for more information about the parameters.
|
|||
|
||||
Remove the specified directory (which should be a full path). Without /r, the directory will only be removed if it is completely empty. If /r is specified, the directory will be removed recursively, so all directories and files in the specified directory will be removed. If /REBOOTOK is specified, any file or directory which could not have been removed during the process will be removed on reboot -- if any file or directory will be removed on a reboot, the reboot flag will be set. The error flag is set if any file or directory cannot be removed.
|
||||
|
||||
\c RMDir $INSTDIR
|
||||
\c RMDir $INSTDIR\data
|
||||
\c RMDir /r /REBOOTOK $INSTIDR
|
||||
\c RMDir /REBOOTOK $INSTDIR\DLLs
|
||||
|
||||
\S2{setoutpath} SetOutPath
|
||||
|
||||
\c outpath
|
||||
|
||||
Sets the output path ($OUTDIR) and creates it (recursively if necessary), if it does not exist. Must be a full pathname, usually is just $INSTDIR (you can specify $INSTDIR if you are lazy with a single "-").
|
||||
Sets the output path ($OUTDIR) and creates it (recursively if necessary), if it does not exist. Must be a full pathname, usually is just $INSTDIR (you can specify $INSTDIR if you are lazy with a single "-").
|
||||
|
||||
\c SetOutPath $INSTDIR
|
||||
\c File program.exe
|
||||
|
|
|
@ -10,36 +10,55 @@ These commands are similar to the C preprocessor in terms of purpose and functio
|
|||
|
||||
This command will include 'file' as if it was part of the original script. Note that if a file is included in another directory, the current directory is still where the script was compiled from (not where the included file resides). If the compiler can't find the file it will look for it in every include directory. See !addincludedir for more information.
|
||||
|
||||
\c !include WinMessages.nsh
|
||||
\c !include Library.nsh
|
||||
\c !include MyConfig.nsh
|
||||
\c !include ..\MyConfig.nsh
|
||||
|
||||
\S1{addincludedir} !addincludedir
|
||||
|
||||
\c directory
|
||||
|
||||
Adds another include directory to the include directories list. This list is searched when !include is used. This list's initial value is $\{NSISDIR\}\\Include alone.
|
||||
|
||||
\c !addincludedir ..\include
|
||||
\c !include something.nsh
|
||||
|
||||
\S1{addplugindir} !addplugindir
|
||||
|
||||
\c directory
|
||||
|
||||
Causes the NSIS compiler to scan the given directory for Plugin DLLs.
|
||||
|
||||
\c !addplugindir myplugin
|
||||
\c MyPlugin::SomeFunction
|
||||
|
||||
\S1{cd} !cd
|
||||
|
||||
\c new_path
|
||||
|
||||
This command will change the compiler to the new directory, new_path. new_path can be relative or absolute.
|
||||
|
||||
\c !cd ..\more-scripts\new
|
||||
|
||||
\S1{echo} !echo
|
||||
|
||||
\c message
|
||||
|
||||
This command will echo a message to the user compiling the script.
|
||||
|
||||
\c !echo "hello world"
|
||||
|
||||
\S1{error} !error
|
||||
|
||||
\c [message]
|
||||
|
||||
This command will issue an error to the script compiler and will stop execution of the script. You can also add a message to this error.
|
||||
|
||||
\c !ifdef VERSION & NOVERSION
|
||||
\c !error "both VERSION and NOVERSION are defined"
|
||||
\c !endif
|
||||
|
||||
\S1{execute} !execute
|
||||
|
||||
\c command
|
||||
|
@ -48,24 +67,39 @@ This command will execute 'command' using a call to CreateProcess(). Unlike \R{s
|
|||
|
||||
On POSIX platforms, !execute will use system() just like \R{system}{!system}.
|
||||
|
||||
\c !execute '"%WINDIR%\notepad.exe" "${NSISDIR}\license.txt"'
|
||||
|
||||
\S1{packhdr} !packhdr
|
||||
|
||||
\c tempfile command
|
||||
|
||||
This option makes the compiler use an external EXE packer (such as \W{http://www.un4seen.com/petite/}{Petite} or \W{http://upx.sourceforge.net/}{UPX}) to compress the executable header. Specify a temporary file name (such as "temp.dat") and a command line (such as "C:\\program files\\upx\\upx -9 temp.dat") to compress the header.
|
||||
|
||||
\c !packhdr "%TEMP%\exehead.tmp" '"C:\Program Files\UPX\upx.exe" "%TEMP%\exehead.tmp"'
|
||||
|
||||
\S1{system} !system
|
||||
|
||||
\c command [compare comparevalue]
|
||||
|
||||
This command will execute 'command' using a call to system(), and if the return value compared (using 'compare') to 'comparevalue' is false, execution will halt. 'compare' can be '<' or '>' or '<>' or '='.
|
||||
|
||||
\c !system '"%WINDIR%\notepad.exe" "${NSISDIR}\license.txt"'
|
||||
\c !system 'echo !define something > newinclude.nsh'
|
||||
\c !include newinclude.nsh
|
||||
\c !ifdef something
|
||||
\c !echo "something is defined"
|
||||
\c !endif
|
||||
|
||||
\S1{warning} !warning
|
||||
|
||||
\c [message]
|
||||
|
||||
This command will issue a warning to the script compiler. You can also add a message to this warning.
|
||||
|
||||
\c !ifdef USE_DANGEROUS_STUFF
|
||||
\c !warning "using dangerous stuff"
|
||||
\c !endif
|
||||
|
||||
\S1{verbose} !verbose
|
||||
|
||||
\c level | push | pop
|
||||
|
@ -74,6 +108,11 @@ This command will set the level of verbosity. 4=all, 3=no script, 2=no info, 1=n
|
|||
|
||||
Passing push will cause !verbose to push the current verbosity level on a special stack. Passing pop will cause !verbose to pop the current verbosity level from the same stack and use it.
|
||||
|
||||
\c !verbose push
|
||||
\c !verbose 1
|
||||
\c !include WinMessages.nsh
|
||||
\c !verbose pop
|
||||
|
||||
\S0{comppredefines} Predefines
|
||||
|
||||
You can use these standard predefines to automatically add the build time to the title of development versions, add the date to the version number, etc.
|
||||
|
|
|
@ -60,6 +60,10 @@ This command sets the file date/time saving flag which is used by the File comma
|
|||
|
||||
This command sets the overwrite flag which is used by the File command to determine whether or not the file should overwrite any existing files that are present. If overwriteflag is 'on', files are overwritten (this is the default). If overwriteflag is 'off', files that are already present are not overwritten. If overwriteflag is 'try', files are overwritten if possible (meaning that if the file is not able to be written to, it is skipped without any user interaction). If overwriteflag is 'ifnewer', then files are only overwritten if the existing file is older than the new file. If overwriteflag is 'ifdiff', then files are only overwritten if the existing file is older or newer than the new file. Note that when in 'ifnewer' or 'ifdiff' mode, the destination file's date is set, regardless of what SetDateSave is set to.
|
||||
|
||||
\c SetOverwrite off
|
||||
\c File program.cfg # config file we don't want to overwrite
|
||||
\c SetOverwrite on
|
||||
|
||||
\S2{setpluginunload} SetPluginUnload
|
||||
|
||||
\c \\<b\\>manual\\</b\\>|alwaysoff
|
||||
|
@ -101,8 +105,18 @@ The following fields are provided by the System:
|
|||
|
||||
The name of these fields are translated on the target system, whereas user defined fields remain untranslated.
|
||||
|
||||
\c VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "Test Application"
|
||||
\c VIAddVersionKey /LANG=${LANG_ENGLISH} "Comments" "A test comment"
|
||||
\c VIAddVersionKey /LANG=${LANG_ENGLISH} "CompanyName" "Fake company"
|
||||
\c VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalTrademarks" "Test Application is a trademark of Fake company"
|
||||
\c VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "© Fake company"
|
||||
\c VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "Test Application"
|
||||
\c VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "1.2.3"
|
||||
|
||||
\S2{viproductversion} VIProductVersion
|
||||
|
||||
\c [version_string_X.X.X.X]
|
||||
|
||||
Adds the Product Version on top of the Version Tab in the Properties of the file.
|
||||
Adds the Product Version on top of the Version Tab in the Properties of the file.
|
||||
|
||||
\c VIProductVersion "1.2.3.4"
|
||||
|
|
|
@ -14,18 +14,32 @@ Define/conditional compilation related commands:
|
|||
|
||||
This command will add 'gflag' to the global define list. This will have a similar effect as using the /D switch on the command line (only the define only becomes effective after the !define command).
|
||||
|
||||
\c !define VERSION 1.2
|
||||
|
||||
\S1{undef} !undef
|
||||
|
||||
\c gflag
|
||||
|
||||
Removes an item from the global define list. Note that $\{SYMBOL\} where SYMBOL is undefined will be translated to "$\{SYMBOL\}".
|
||||
|
||||
\c !define SOMETHING
|
||||
\c !undef SOMETHING
|
||||
|
||||
\S1{ifdef} !ifdef
|
||||
|
||||
\c gflag [bcheck [gflag [...]]]
|
||||
|
||||
This command, when paired with an !endif command, will tell the compiler whether or not to compile the lines in between the two lines. If gflag is globally defined (using !define or the /D switch), then the contained lines will be compiled. Otherwise, they will be skipped. 'bcheck' can be specified as & (boolean and) or | (boolean or) along with more gflags -- precedence is simple, left to right.
|
||||
|
||||
\c !define SOMETHING
|
||||
\c !ifdef SOMETHING
|
||||
\c !echo "SOMETHING is defined"
|
||||
\c !endif
|
||||
\c !undef SOMETHING
|
||||
\c !ifdef SOMETHING
|
||||
\c !echo "SOMETHING is defined" # will never be printed
|
||||
\c !endif
|
||||
|
||||
\S1{ifndef} !ifndef
|
||||
|
||||
\c gflag [bcheck [gflag [...]]]
|
||||
|
@ -38,6 +52,12 @@ The opposite of !ifdef. The lines will be compiled when the gflag has not been d
|
|||
|
||||
This command, when paired with an !endif command, will tell the compiler whether or not to compile the lines in between the two lines. If the macro gflag exists, then the contained lines will be compiled. Otherwise, they will be skipped. 'bcheck' can be specified as & (boolean and) or | (boolean or) along with more gflags -- precedence is simple, left to right.
|
||||
|
||||
\c !macro SomeMacro
|
||||
\c !macroend
|
||||
\c !ifmacrodef SomeMacro
|
||||
\c !echo "SomeMacro is defined"
|
||||
\c !endif
|
||||
|
||||
\S1{ifmacrondef} !ifmacrondef
|
||||
|
||||
\c gflag [bcheck [gflag [...]]]
|
||||
|
@ -50,6 +70,12 @@ The opposite of !ifmacrodef. The lines will be compiled when the macro gflag doe
|
|||
|
||||
This command allows to easily insert different code when different defines or macros are set. You can create blocks like !ifdef/!else/!endif, !ifdef/!else ifdef/!else/!endif etc.
|
||||
|
||||
\c !ifdef VERSION
|
||||
\c OutFile installer-${VERSION}.exe
|
||||
\c !else
|
||||
\c OutFile installer.exe
|
||||
\c !endif
|
||||
|
||||
\S1{endif} !endif
|
||||
|
||||
This command closes a block started with !ifdef, !ifndef, !ifmacrodef or !ifmacrondef.
|
||||
|
@ -60,12 +86,24 @@ This command closes a block started with !ifdef, !ifndef, !ifmacrodef or !ifmacr
|
|||
|
||||
Inserts the contents of a macro that was created with !macro. If the macro was created with parameters, then you must pass as many parameters to the macro as it requires.
|
||||
|
||||
\c !macro Print text
|
||||
\c DetailPrint "${text}"
|
||||
\c !macroend
|
||||
\c !insertmacro Print "some text"
|
||||
\c !insertmacro Print "some more text"
|
||||
|
||||
\S1{macro} !macro
|
||||
|
||||
\c macro_name [parameter][...]
|
||||
|
||||
Creates a macro named 'macro_name'. All lines between the !macro and the !macroend will be saved. To insert the macro later on, use !insertmacro. !macro definitions can have one or more parameters defined. The parameters may be accessed the same way a !define would (e.g. $\{PARMNAME\}) from inside the macro.
|
||||
|
||||
\c !macro SomeMacro parm1 parm2 parm3
|
||||
\c DetailPrint "${parm1}"
|
||||
\c MessageBox MB_OK "${parm2}"
|
||||
\c File "${parm3}"
|
||||
\c !macroend
|
||||
|
||||
\S1{macroend} !macroend
|
||||
|
||||
Ends a macro that was started with !macro.
|
||||
|
|
|
@ -14,30 +14,66 @@ Opens a file named "filename", and sets the handle output variable with the hand
|
|||
|
||||
If no absolute path is specified the current folder will be used. The current folder is the folder set using the last \R{setoutpath}{SetOutPath} instruction. If you have not used \R{setoutpath}{SetOutPath} the current folder is \R{varother}{$EXEDIR}.
|
||||
|
||||
\c FileOpen $0 $INSTDIR\file.dat r
|
||||
\c FileClose $0
|
||||
|
||||
\S2{FileRead} FileRead
|
||||
|
||||
\c handle user_var(output) [maxlen]
|
||||
|
||||
Reads a string from a file opened with FileOpen. The string is read until either a newline (or carriage return newline pair) occurs, or until a null byte is read, or until maxlen is met (if specified). Strings are limited to 1024 characters. If the end of file is read and no more data is available, the output string will be empty, and the error flag will be set.
|
||||
|
||||
\c ClearErrors
|
||||
\c FileOpen $0 $INSTDIR\file.dat r
|
||||
\c IfErrors done
|
||||
\c FileRead $0 $1
|
||||
\c DetailPrint $1
|
||||
\c FileClose $0
|
||||
\c done:
|
||||
|
||||
\S2{FileReadByte} FileReadByte
|
||||
|
||||
\c handle user_var(output)
|
||||
|
||||
Reads a byte from a file opened with FileOpen. The byte is stored in the output as an integer (0-255). If the end of file is read and no more data is available, the output will be empty, and the error flag will be set.
|
||||
|
||||
\c ClearErrors
|
||||
\c FileOpen $0 $INSTDIR\file.dat r
|
||||
\c IfErrors done
|
||||
\c FileReadByte $0 $1
|
||||
\c FileReadByte $0 $2
|
||||
\c DetailPrint "$1 $2"
|
||||
\c FileClose $0
|
||||
\c done:
|
||||
|
||||
\S2{FileSeek} FileSeek
|
||||
|
||||
\c handle offset [mode] [user_var(new position)]
|
||||
|
||||
Seeks a file opened with FileOpen. If mode is omitted or specified as SET, the file is positioned to "offset". If mode is specified as CUR, then the file pointer is moved by offset. If mode is specified as END, the file pointer is set to a position relative to EOF. If the final parameter "new position" is specified, the new file position will be stored to that variable.
|
||||
|
||||
\c ClearErrors
|
||||
\c FileOpen $0 $INSTDIR\file.dat r
|
||||
\c IfErrors done
|
||||
\c FileSeek $0 -5 END
|
||||
\c FileRead $0 $1
|
||||
\c DetailPrint $1
|
||||
\c FileClose $0
|
||||
\c done:
|
||||
|
||||
\S2{FileWrite} FileWrite
|
||||
|
||||
\c handle string
|
||||
|
||||
Writes a string to a file opened with FileOpen. If an error occurs writing, the error flag will be set.
|
||||
|
||||
\c ClearErrors
|
||||
\c FileOpen $0 $INSTDIR\file.dat w
|
||||
\c IfErrors done
|
||||
\c FileWrite $0 "some text"
|
||||
\c FileClose $0
|
||||
\c done:
|
||||
|
||||
\S2{FileWriteByte} FileWriteByte
|
||||
|
||||
\c handle string
|
||||
|
@ -61,8 +97,16 @@ Closes a search opened with FindFirst.
|
|||
|
||||
Performs a search for 'filespec', placing the first file found in filename_output (a user variable). It also puts the handle of the search into handle_output (also a user variable). If no files are found, both outputs are set to empty, and the error flag is set. Best used with FindNext and FindClose. Note that the filename output is without path.
|
||||
|
||||
\c FindFirst $0 $1 $INSTDIR\*.txt
|
||||
\c loop:
|
||||
\c StrCmp $1 "" done
|
||||
\c DetailPrint $1
|
||||
\c FindNext $0 $1
|
||||
\c Goto loop
|
||||
\c done:
|
||||
|
||||
\S2{FindNext} FindNext
|
||||
|
||||
\c handle user_var(filename_output)
|
||||
|
||||
Continues a search began with FindFirst. handle should be the handle_output_variable returned by FindFirst. If the search is completed (there are no more files), filename_output is set to empty, and the error flag is set. Note that the filename output is without path.
|
||||
Continues a search began with FindFirst. handle should be the handle_output_variable returned by FindFirst. If the search is completed (there are no more files), filename_output is set to empty, and the error flag is set. Note that the filename output is without path.
|
||||
|
|
|
@ -6,34 +6,85 @@
|
|||
|
||||
Cancels the install, stops execution of script, and displays user_message in the status display. Note: you can use this from \R{callbacks}{Callback functions} to do special things. \R{pages}{Page callbacks} also uses Abort for special purposes.
|
||||
|
||||
\c Abort
|
||||
\c Abort "can't install"
|
||||
|
||||
\S2{call} Call
|
||||
|
||||
\c function_name | :label_name
|
||||
|
||||
Calls the function named function_name. If in the Uninstall section, Call can only be used with function names beginning with "un.". If the parameter starts with a ':' it will be treated as a label (so you can call to a label in your function - this is probably not going to be used most of the time).
|
||||
|
||||
\c Function func
|
||||
\c DetailPrint "hello world from func"
|
||||
\c FunctionEnd
|
||||
\c Section
|
||||
\c Call func
|
||||
\c SectionEnd
|
||||
|
||||
\S2{clearerrors} ClearErrors
|
||||
|
||||
Clears the error flag.
|
||||
|
||||
\c ClearErrors
|
||||
\c IfErrors 0 +2
|
||||
\c MessageBox MB_OK "this message box will never show"
|
||||
|
||||
\S2{getcurrentaddress} GetCurrentAddress
|
||||
|
||||
\c user_var(output)
|
||||
|
||||
Gets the address of the current instruction (the GetCurrentAddress) and stores it in the output user variable. This user variable then can be passed to Call or Goto.
|
||||
|
||||
\c Function func
|
||||
\c DetailPrint "function"
|
||||
\c IntOp $0 $0 + 2
|
||||
\c Call $0
|
||||
\c DetailPrint "function end"
|
||||
\c FunctionEnd
|
||||
\c
|
||||
\c Section
|
||||
\c DetailPrint "section"
|
||||
\c DetailPrint "section"
|
||||
\c GetCurrentAddress $0
|
||||
\c Goto callFunc
|
||||
\c
|
||||
\c DetailPrint "back to section"
|
||||
\c Return
|
||||
\c
|
||||
\c callFunc:
|
||||
\c Call func
|
||||
\c DetailPrint "section end"
|
||||
\c SectionEnd
|
||||
|
||||
\S2{getfunctionaddress} GetFunctionAddress
|
||||
|
||||
\c user_var(output) function_name
|
||||
|
||||
Gets the address of the function and stores it in the output user variable. This user variable then can be passed to Call or Goto. Note that if you Goto an address which is the output of GetFunctionAddress, your function will never be returned to (when the function you Goto'd to returns, you return instantly).
|
||||
|
||||
\c Function func
|
||||
\c DetailPrint "function"
|
||||
\c FunctionEnd
|
||||
\c
|
||||
\c Section
|
||||
\c GetFunctionAddress $0 func
|
||||
\c Call $0
|
||||
\c SectionEnd
|
||||
|
||||
\S2{getlabeladdress} GetLabelAddress
|
||||
|
||||
\c user_var(output) label
|
||||
|
||||
Gets the address of the label and stores it in the output user variable. This user variable then can be passed to Call or Goto. Note that you may only call this with labels accessible from your function, but you can call it from anywhere (which is potentially dangerous). Note that if you Call the output of GetLabelAddress, code will be executed until it Return's (explicitly or implicitly at the end of a function), and then you will be returned to the statement after the Call.
|
||||
|
||||
\c label:
|
||||
\c DetailPrint "label"
|
||||
\c GetLabelAddress $0 label
|
||||
\c IntOp $0 $0 + 4
|
||||
\c Goto $0
|
||||
\c DetailPrint "done"
|
||||
|
||||
\S2{goto} Goto
|
||||
|
||||
\c label_to_jump_to | +offset| -offset| user_var(target)
|
||||
|
@ -44,12 +95,23 @@ If +offset or -offset is specified, jump is relative by offset instructions. Got
|
|||
|
||||
If a user variable is specified, jumps to absolute address (generally you will want to get this value from a function like GetLabelAddress). Compiler flag commands and SectionIn aren't instructions so jumping over them has no effect.
|
||||
|
||||
\c Goto label
|
||||
\c Goto +2
|
||||
\c Goto -2
|
||||
\c Goto $0
|
||||
|
||||
\S2{ifabort} IfAbort
|
||||
|
||||
\c label_to_goto_if_abort [label_to_goto_if_no_abort]
|
||||
|
||||
If abort is called it will "return" true. This can happen if the user choose abort on a file that failed to create (or overwrite) or if the user aborted by hand. This function can only be called from the leave function of the instfiles \R{page}{page}.
|
||||
If abort is called it will "return" true. This can happen if the user chose abort on a file that failed to create (or overwrite) or if the user aborted by hand. This function can only be called from the leave function of the instfiles \R{page}{page}.
|
||||
|
||||
\c Page instfiles "" "" instfilesLeave
|
||||
\c
|
||||
\c Function instfilesLeave
|
||||
\c IfAbort 0 +2
|
||||
\c MessageBox MB_OK "user aborted"
|
||||
\c FunctionEnd
|
||||
|
||||
\S2{iferrors} IfErrors
|
||||
|
||||
|
@ -57,17 +119,30 @@ If abort is called it will "return" true. This can happen if the user choose abo
|
|||
|
||||
Checks and clears the error flag, and if it is set, it will goto jumpto_iferror, otherwise it will goto jumpto_ifnoerror. The error flag is set by other instructions when a recoverable error (such as trying to delete a file that is in use) occurs.
|
||||
|
||||
\c ClearErrors
|
||||
\c File file.dat
|
||||
\c IfErrors 0 +2
|
||||
\c Call ErrorHandler
|
||||
|
||||
\S2{iffileexists} IfFileExists
|
||||
|
||||
\c file_to_check_for jump_if_present [jump_otherwise]
|
||||
|
||||
Checks for existence of file(s) file_to_check_for (which can be a wildcard, or a directory), and Gotos jump_if_present if the file exists, otherwise Gotos jump_otherwise. If you want to check to see if a file is a directory, use IfFileExists DIRECTORY\\*.*
|
||||
|
||||
\S2{IfRebootFlag} IfRebootFlag
|
||||
\c IfFileExists $WINDIR\notepad.exe 0 +2
|
||||
\c MessageBox MB_OK "notepad is installed"
|
||||
|
||||
\S2{ifrebootflag} IfRebootFlag
|
||||
|
||||
\c jump_if_set [jump_if_not_set]
|
||||
|
||||
Checks the reboot flag, and jumps to jump_if_set if the reboot flag is set, otherwise jumps to jump_if_not_set. The reboot flag can be set by Delete and Rename, or manually with SetRebootFlag.
|
||||
Checks the reboot flag, and jumps to jump_if_set if the reboot flag is set, otherwise jumps to jump_if_not_set. The reboot flag can be set by Delete and Rename, or manually with \R{setrebootflag}{SetRebootFlag}.
|
||||
|
||||
\c IfRebootFlag 0 noreboot
|
||||
\c MessageBox MB_YESNO "A reboot is required to finish the installation. Do you wish to reboot now?" IDNO noreboot
|
||||
\c Reboot
|
||||
\c noreboot:
|
||||
|
||||
\S2{ifsilent} IfSilent
|
||||
|
||||
|
@ -75,12 +150,27 @@ Checks the reboot flag, and jumps to jump_if_set if the reboot flag is set, othe
|
|||
|
||||
Checks the silent flag, and jumps to jump_if_silent if the installer is silent, otherwise jumps to jump_if_not. The silent flag can be set by \R{asilentinstall}{SilentInstall}, \R{asilentuninstall}{SilentUninstall}, \R{setsilent}{SetSilent} and by the user passing /S on the command line.
|
||||
|
||||
\c IfSilent +2
|
||||
\c ExecWait '"$INSTDIR\nonsilentprogram.exe"'
|
||||
|
||||
\S2{intcmp} IntCmp
|
||||
|
||||
\c val1 val2 jump_if_equal [jump_if_val1_less] [jump_if_val1_more]
|
||||
|
||||
Compares two integers val1 and val2. If val1 and val2 are equal, Gotos jump_if_equal, otherwise if val1 < val2, Gotos jump_if_val1_less, otherwise if val1 > val2, Gotos jump_if_val1_more.
|
||||
|
||||
\c IntCmp $0 5 is5 lessthan5 morethan5
|
||||
\c is5:
|
||||
\c DetailPrint "$$0 == 5"
|
||||
\c Goto done
|
||||
\c lessthan5:
|
||||
\c DetailPrint "$$0 < 5"
|
||||
\c Goto done
|
||||
\c morethan5:
|
||||
\c DetailPrint "$$0 > 5"
|
||||
\c Goto done
|
||||
\c done:
|
||||
|
||||
\S2{intcmpu} IntCmpU
|
||||
|
||||
\c val1 val2 jump_if_equal [jump_if_val1_less] [jump_if_val1_more]
|
||||
|
@ -147,10 +237,31 @@ If the return value of the MessageBox is return_check, the installer will Goto j
|
|||
|
||||
Use the /SD parameter with one of the return_check values above to specify the option that will be used when the installer is silent. See \k{silent} for more information.
|
||||
|
||||
\c MessageBox MB_OK "simple message box"
|
||||
\c MessageBox MB_YESNO "is it true?" IDYES true IDNO false
|
||||
\c true:
|
||||
\c DetailPrint "it's true!"
|
||||
\c Goto next
|
||||
\c false:
|
||||
\c DetailPrint "it's false"
|
||||
\c next:
|
||||
\c MessageBox MB_YESNO "is it true? (defaults to yes on silent installations)" /SD IDYES IDNO false2
|
||||
\c DetailPrint "it's true (or silent)!"
|
||||
\c Goto next2
|
||||
\c false2:
|
||||
\c DetailPrint "it's false"
|
||||
\c next2:
|
||||
|
||||
\S2{return} Return
|
||||
|
||||
Returns from a function or section.
|
||||
|
||||
\c Function func
|
||||
\c StrCmp $0 "return now" 0 +2
|
||||
\c Return
|
||||
\c # do stuff
|
||||
\c FunctionEnd
|
||||
|
||||
\S2{quit} Quit
|
||||
|
||||
Causes the installer to exit as soon as possible. After Quit is called, the installer will exit (no callback functions will get a chance to run).
|
||||
|
@ -159,8 +270,17 @@ Causes the installer to exit as soon as possible. After Quit is called, the inst
|
|||
|
||||
Sets the error flag.
|
||||
|
||||
\c SetErrors
|
||||
\c IfErrors 0 +2
|
||||
\c MessageBox MB_OK "this message box will always show"
|
||||
|
||||
\S2{strcmp} StrCmp
|
||||
|
||||
\c str1 str2 jump_if_equal [jump_if_not_equal]
|
||||
|
||||
Compares (case insensitively) str1 to str2. If str1 and str2 are equal, Gotos jump_if_equal, otherwise Gotos jump_if_not_equal.
|
||||
Compares (case insensitively) str1 to str2. If str1 and str2 are equal, Gotos jump_if_equal, otherwise Gotos jump_if_not_equal.
|
||||
|
||||
\c StrCmp $0 "a string" 0 +3
|
||||
\c DetailPrint '$$0 == "a string"'
|
||||
\c Goto +2
|
||||
\c DeteailPrint '$$0 != "a string"'
|
||||
|
|
|
@ -12,6 +12,14 @@ Functions must be declared outside of Sections or other Functions.
|
|||
|
||||
Begins and opens a new function. Function names beginning with "." (e.g. ".Whatever") are generally reserved for callback functions. Function names beginning with "un." are functions that will be generated in the Uninstaller. Hence, normal install Sections and functions cannot call uninstall functions, and the Uninstall Section and uninstall functions cannot call normal functions.
|
||||
|
||||
\c Function func
|
||||
\c # some commands
|
||||
\c FunctionEnd
|
||||
\c
|
||||
\c Section
|
||||
\c Call func
|
||||
\c SectionEnd
|
||||
|
||||
\S2{ffunctionend} FunctionEnd
|
||||
|
||||
This command closes the current open function.
|
|
@ -6,6 +6,10 @@
|
|||
|
||||
Calls a function_name inside a NSIS extension DLL. See Contrib\\ExDLL for an example of how to make one. Extension DLLs can access the stack and variables. Use /NOUNLOAD to force the installer to leave the DLL loaded. Note: To automatically extract and call plug-in DLLs, use a plug-in command instead of CallInstDLL.
|
||||
|
||||
\c Push "a parameter"
|
||||
\c Push "anoter parameter"
|
||||
\c CallInstDLL $INSTDIR\somedll.dll somefunction
|
||||
|
||||
\S2{copyfiles} CopyFiles
|
||||
|
||||
\c [/SILENT] [/FILESONLY] filespec_on_destsys destination_path [size_of_files_in_kb]
|
||||
|
@ -14,6 +18,9 @@ Copies files from the source to the destination on the installing system. Useful
|
|||
|
||||
If no absolute path is specified the current folder will be used. The current folder is the folder set using the last \R{setoutpath}{SetOutPath} instruction. If you have not used \R{setoutpath}{SetOutPath} the current folder is usually \R{varother}{$EXEDIR}.
|
||||
|
||||
\c CreateDirectory $INSTDIR\backup
|
||||
\c CopyFiles $INSTDIR\*.dat $INSTDIR\backup
|
||||
|
||||
\S2{createdirectory} CreateDirectory
|
||||
|
||||
\c path_to_create
|
||||
|
@ -22,6 +29,8 @@ Creates (recursively if necessary) the specified directory. The error flag is se
|
|||
|
||||
You should always specify an absolute path.
|
||||
|
||||
\c CreateDirectory $INSTDIR\some\directory
|
||||
|
||||
\S2{createshortcut} CreateShortCut
|
||||
|
||||
\c link.lnk target.file [parameters [icon.file [icon_index_number [start_options [keyboard_shortcut [description]]]]]]
|
||||
|
@ -33,6 +42,10 @@ keyboard_shortcut should be in the form of 'flag|c' where flag can be a combinat
|
|||
description should be the description of the shortcut, or comment as it is called under XP.
|
||||
The error flag is set if the shortcut cannot be created (i.e. either of the paths (link or target) does not exist, or some other error).
|
||||
|
||||
\c CreateDirectory "$SMPROGRAMS\My Company"
|
||||
\c CreateShortCut "$SMPROGRAMS\My Company\My Program.lnk" "$INSTDIR\My Program.exe" \
|
||||
\c "some command line parameters" "$INSTDIR\My Program.exe" 2 SW_SHOWNORMAL \
|
||||
\c ALT|CTRL|SHIFT|F5 "a description"
|
||||
|
||||
\S2{getdllversion} GetDLLVersion
|
||||
|
||||
|
@ -77,6 +90,11 @@ Assign to the user variable $x, the full path of the file specified. If the path
|
|||
|
||||
Assign to the user variable $x, the name of a temporary file. The file will have been created, so you can then overwrite it with what you please. The name of the temporary file is guaranteed to be unique. If to want the temporary file to be created in another directory than the Windows temp directory, specify a base_dir. Delete the file when done with it.
|
||||
|
||||
\c GetTempFileName $0
|
||||
\c File /oname=$0 something.dat
|
||||
\c # do something with something.dat
|
||||
\c Delete $0
|
||||
|
||||
\S2{searchpath} SearchPath
|
||||
|
||||
\c user_var(output) filename
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
|
||||
Formats the number in "numberstring" using the format "format", and sets the output to user variable $x. Example format strings include "%08X" "%u"
|
||||
|
||||
\c IntFmt $0 "0x%08X" 195948557
|
||||
\c IntFmt $0 "%c" 0x41
|
||||
|
||||
\S2{IntOp} IntOp
|
||||
|
||||
\c user_var(output) value1 OP [value2]
|
||||
|
@ -39,4 +42,9 @@ Combines value1 and (depending on OP) value2 into the user variable $x. OP is de
|
|||
\b \e{||} LOGICALLY ORs value1 and value2
|
||||
|
||||
\b \e{&&} LOGICALLY ANDs value1 and value2
|
||||
|
||||
|
||||
\c IntOp $0 1 + 1
|
||||
\c IntOp $0 $0 + 1
|
||||
\c IntOp $0 $0 << 2
|
||||
\c IntOp $0 $0 ~
|
||||
\c IntOp $0 $0 & 0xF
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
\S0{labels} Labels
|
||||
|
||||
Labels are the targets of Goto instructions, or of the various branching instructions (such as \R{iferrors}{IfErrors}, \R{messagebox}{MessageBox}, \R{iffileexists}{IfFileExists}, and \R{strcmp}{StrCmp}). Labels must be within a Section or a Function. Labels are local in scope, meaning they are only accessible from within the Section or Function that they reside in.
|
||||
To declare a label, simply do:
|
||||
To declare a label, simply use:
|
||||
|
||||
\e{MyLabel:}
|
||||
|
||||
|
|
|
@ -40,6 +40,12 @@ Each language string has a name that identifies it and a value for each language
|
|||
|
||||
Does the same as \R{langstring}{LangString} only it loads the string from a text/RTF file and defines a special LangString that can be used only by \R{alicensedata}{LicenseData}.
|
||||
|
||||
\c LicenseLangString license ${LANG_ENGLISH} license-english.txt
|
||||
\c LicenseLangString license ${LANG_FRENCH} license-french.txt
|
||||
\c LicenseLangString license ${LANG_GERMAN} license-german.txt
|
||||
|
||||
\c LicenseData $(license)
|
||||
|
||||
\S0{langs} Multiple Languages
|
||||
|
||||
As of version 2 NSIS fully supports multiple languages. The interface of one installer can support multiple languages.
|
||||
|
|
|
@ -33,7 +33,7 @@ Note that you can only compile scripts using this system on Windows systems. It
|
|||
|
||||
The InstallLib macro allows you to install a library.
|
||||
|
||||
To ask the user for a reboot if required, use the Modern UI with a Finish page or use \R{IfRebootFlag}{IfRebootFlag} and make your own page or message box.
|
||||
To ask the user for a reboot if required, use the Modern UI with a Finish page or use \R{ifrebootflag}{IfRebootFlag} and make your own page or message box.
|
||||
|
||||
\S1{} Parameters
|
||||
|
||||
|
@ -210,7 +210,7 @@ The correct version of the following files should be stored in your script folde
|
|||
|
||||
A \W{http://support.microsoft.com/default.aspx?scid=kb;en-us;290887}{Microsoft article} that explains how to obtain these files is available.
|
||||
|
||||
To ask the user for a reboot if required, use the Modern UI with a Finish page or use \R{IfRebootFlag}{IfRebootFlag} and make your own page or message box.
|
||||
To ask the user for a reboot if required, use the Modern UI with a Finish page or use \R{ifrebootflag}{IfRebootFlag} and make your own page or message box.
|
||||
|
||||
\c !include Library.nsh
|
||||
\c
|
||||
|
|
|
@ -10,4 +10,7 @@ Sets whether install logging to $INSTDIR\\install.log will happen. $INSTDIR must
|
|||
|
||||
\c text
|
||||
|
||||
If installer logging is enabled, inserts text "text" into the log file.
|
||||
If installer logging is enabled, inserts text "text" into the log file.
|
||||
|
||||
\c IfFileExists $WINDIR\notepad.exe 0 +2
|
||||
\c LogText "$$WINDIR\notepad.exe exists"
|
||||
|
|
|
@ -6,6 +6,10 @@
|
|||
|
||||
Returns the last error level set by \R{seterrorlevel}{SetErrorLevel} or -1 if it was never used.
|
||||
|
||||
\c GetErrorLevel $0
|
||||
\c IntOp $0 $0 + 1
|
||||
\c SetErrorLevel $0
|
||||
|
||||
\S2{getinstdirerror} GetInstDirError
|
||||
|
||||
\c user_var(error output)
|
||||
|
@ -18,24 +22,63 @@ Use in the leave function of a directory page. Reads the flag set if '\R{adirver
|
|||
|
||||
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 plugins dir (\R{varconstant}{$PLUGINSDIR}) if not already initialized.
|
||||
|
||||
\c InitPluginsDir
|
||||
\c File /oname=$PLUGINSDIR\image.bmp image.bmp
|
||||
|
||||
\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 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 Plugin. See Contrib\\UserInfo\\UserInfo.nsi for an example.
|
||||
|
||||
\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".
|
||||
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"
|
||||
|
|
|
@ -141,10 +141,14 @@ Example usage:
|
|||
|
||||
\S{pageexend} PageExEnd
|
||||
|
||||
Ends a PageEx block.
|
||||
Ends a \R{pageex}{PageEx} block.
|
||||
|
||||
\S{pagecallbacks} PageCallbacks
|
||||
|
||||
\c ([creator_function] [leave_function]) | ([pre_function] [show_function] [leave_function])
|
||||
|
||||
Sets the callback functions for a page defined using \R{pageex}{PageEx}. Can only be used inside a \R{pageex}{PageEx} block. See the above sections for more information about callback functions.
|
||||
|
||||
\c PageEx license
|
||||
\c PageCallbacks licensePre licenseShow licenseLeave
|
||||
\c PageExEnd
|
||||
|
|
|
@ -1,11 +1,18 @@
|
|||
\S{rebootinst} Reboot Instructions
|
||||
|
||||
\S2{Reboot} Reboot
|
||||
\S2{reboot} Reboot
|
||||
|
||||
Reboots the computer. Be careful with this one. If there is an error rebooting, this function sets the error flag and continues. If the reboot is successful, this instruction does not return.
|
||||
|
||||
\S2{SetRebootFlag} SetRebootFlag
|
||||
\c MessageBox MB_YESNO|MB_ICONQUESTION "Do you wish to reboot the system?" IDNO +2
|
||||
\c Reboot
|
||||
|
||||
\S2{setrebootflag} SetRebootFlag
|
||||
|
||||
\c true|false
|
||||
|
||||
Sets the reboot flag to either true or false.
|
||||
Sets the reboot flag to either true or false. The flag's value can be read using \R{ifrebootflag}{IfRebootFlag}.
|
||||
|
||||
\c SetRebootFlag true
|
||||
\c IfRebootFlag 0 +2
|
||||
\c MessageBox MB_OK "this message box will always show"
|
||||
|
|
|
@ -8,96 +8,153 @@ In all of the below registry instructions use an empty string (just two quotes w
|
|||
|
||||
Deletes the entire section [section_name] from ini_filename. If the section could not be removed from the ini file, the error flag is set. It does not set the error flag if the section could not be found.
|
||||
|
||||
\c WriteINIStr $TEMP\something.ini section1 something 123
|
||||
\c WriteINIStr $TEMP\something.ini section1 somethingelse 1234
|
||||
\c WriteINIStr $TEMP\something.ini section2 nsis true
|
||||
\c DeleteINISec $TEMP\something.ini section1
|
||||
|
||||
\S2{deleteinistr} DeleteINIStr
|
||||
|
||||
\c ini_filename section_name str_name
|
||||
|
||||
Deletes the string str_name from section [section_name] from ini_filename. If the string could not be removed from the ini file, the error flag is set. It does not set the error flag if the string could not be found.
|
||||
|
||||
\c WriteINIStr $TEMP\something.ini section1 something 123
|
||||
\c WriteINIStr $TEMP\something.ini section1 somethingelse 1234
|
||||
\c DeleteINIStr $TEMP\something.ini section1 somethingelse
|
||||
|
||||
\S2{deleteregkey} DeleteRegKey
|
||||
|
||||
\c [/ifempty] root_key subkey
|
||||
|
||||
Deletes a registry key. If /ifempty is specified, the registry key will only be deleted if it has no subkeys (otherwise, the whole registry tree will be removed). Valid values for root_key are listed under \R{writeregstr}{WriteRegStr}. The error flag is set if the key could not be removed from the registry (or if it didn't exist to begin with).
|
||||
|
||||
\c DeleteRegKey HKLM "Software\My Company\My Software"
|
||||
\c DeleteRegKey /ifempty HKLM "Software\A key that might have subkeys"
|
||||
|
||||
\S2{deleteregvalue} DeleteRegValue
|
||||
|
||||
\c root_key subkey key_name
|
||||
|
||||
Deletes a registry value. Valid values for root_key are listed under WriteRegStr. The error flag is set if the value could not be removed from the registry (or if it didn't exist to begin with).
|
||||
|
||||
\c DeleteRegValue HKLM "Software\My Company\My Software" "some value"
|
||||
|
||||
\S2{enumregkey} EnumRegKey
|
||||
|
||||
\c user_var(output) root_key subkey index
|
||||
|
||||
Set user variable $x with the name of the 'index'th registry key in root_key\\Subkey. Valid values for root_key are listed under WriteRegStr. Returns an empty string if there are no more keys, and returns an empty string and sets the error flag if there is an error.
|
||||
|
||||
\c StrCpy $0 0
|
||||
\c loop:
|
||||
\c EnumRegKey $1 HKLM Software $0
|
||||
\c StrCmp $1 "" done
|
||||
\c IntOp $0 $0 + 1
|
||||
\c MessageBox MB_YESNO|MB_ICONQUESTION "$1$\n$\nMore?" IDYES loop
|
||||
\c done:
|
||||
|
||||
\S2{enumregvalue} EnumRegValue
|
||||
|
||||
\c user_var(output) root_key subkey index
|
||||
|
||||
Set user variable $x with the name of the 'index'th registry value in root_key\\Subkey. Valid values for root_key are listed under WriteRegStr. Returns an empty string if there are no more values, and returns an empty string and sets the error flag if there is an error.
|
||||
|
||||
\c StrCpy $0 0
|
||||
\c loop:
|
||||
\c EnumRegValue $1 HKLM Software\Microsoft\Windows\CurrentVersion $0
|
||||
\c StrCmp $1 "" done
|
||||
\c IntOp $0 $0 + 1
|
||||
\c ReadRegStr $2 HKLM Software\Microsoft\Windows\CurrentVersion $1
|
||||
\c MessageBox MB_YESNO|MB_ICONQUESTION "$1 = $2$\n$\nMore?" IDYES loop
|
||||
\c done:
|
||||
|
||||
\S2{expandenvstrings} ExpandEnvStrings
|
||||
|
||||
\c user_var(output) string
|
||||
|
||||
Expands environment variables in "string" into the user variable $x. If error, the variable is set to empty, and the error flag is set.
|
||||
|
||||
\c ExpandEnvStrings $0 "WINDIR=%WINDIR%$\nTEMP=%TEMP%"
|
||||
|
||||
\S2{flushini} FlushINI
|
||||
|
||||
\c ini_filename
|
||||
|
||||
Flushes the INI file's buffers. Windows 9x keeps all changes to the INI file in memory. This command causes the changes to be written to the disk immediately. Use it if you edit the INI manually, delete it, move it or copy it right after you change it with \R{writeinistr}{WriteINIStr}, \R{deleteinisec}{DeleteINISec} or \R{deleteinistr}{DeleteINStr}.
|
||||
|
||||
\c WriteINIStr $TEMP\something.ini test test test
|
||||
\c FlushINI $TEMP\something.ini
|
||||
\c Delete $TEMP\something.ini
|
||||
|
||||
\S2{readenvstr} ReadEnvStr
|
||||
|
||||
\c user_var(output) name
|
||||
|
||||
Reads from the environment string "name" and sets the value into the user variable $x. If there is an error reading the string, the user variable is set to empty, and the error flag is set.
|
||||
|
||||
\c ReadEnvStr $0 WINDIR
|
||||
\c ReadEnvStr $1 TEMP
|
||||
|
||||
\S2{readinistr} ReadINIStr
|
||||
|
||||
\c user_var(output) ini_filename section_name entry_name
|
||||
|
||||
Reads from entry_name in [section_name] of ini_filename and stores the value into user variable $x. The error flag will be set and $x will be assigned to an empty string if the entry is not found.
|
||||
|
||||
\c ReadINIStr $0 $INSTDIR\winamp.ini winamp outname
|
||||
|
||||
\S2{readregdword} ReadRegDWORD
|
||||
|
||||
\c user_var(output) root_key sub_key name
|
||||
|
||||
Reads a 32 bit DWORD from the registry into the user variable $x. Valid values for root_key are listed under WriteRegStr. The error flag will be set and $x will be set to an empty string ("" which is 0) if the DWORD is not present. If the value is present, but is not a DWORD, it will be read as a string and the error flag will be set.
|
||||
|
||||
\c ReadRegDWORD $0 HKLM Software\NSIS VersionBuild
|
||||
|
||||
\S2{readregstr} ReadRegStr
|
||||
|
||||
\c user_var(output) root_key sub_key name
|
||||
|
||||
Reads from the registry into the user variable $x. Valid values for root_key are listed under WriteRegStr. The error flag will be set and $x will be set to an empty string ("") if the string is not present. If the value is present, but is of type REG_DWORD, it will be read and converted to a string and the error flag will be set.
|
||||
|
||||
\c ReadRegStr $0 HKLM Software\NSIS ""
|
||||
\c DetailPrint "NSIS is installed at: $0"
|
||||
|
||||
\S2{writeinistr} WriteINIStr
|
||||
|
||||
\c ini_filename section_name entry_name value
|
||||
|
||||
Writes entry_name=value into [section_name] of ini_filename. The error flag is set if the string could not be written to the ini file.
|
||||
|
||||
\c WriteINIStr $TEMP\something.ini section1 something 123
|
||||
\c WriteINIStr $TEMP\something.ini section1 somethingelse 1234
|
||||
\c WriteINIStr $TEMP\something.ini section2 nsis true
|
||||
|
||||
\S2{writeregbin} WriteRegBin
|
||||
|
||||
\c root_key subkey key_name valuedata
|
||||
|
||||
This command writes a block of binary data to the registry. Valid values for root_key are listed under WriteRegStr. Valuedata is in hexadecimal (e.g. DEADBEEF01223211151). The error flag is set if the binary data could not be written to the registry. If the registry key doesn't exist it will be created.
|
||||
|
||||
\c WriteRegBin HKLM "Software\My Company\My Software" "Binary Value" DEADBEEF01223211151
|
||||
|
||||
\S2{writeregdword} WriteRegDWORD
|
||||
|
||||
\c root_key subkey key_name value
|
||||
|
||||
This command writes a dword (32 bit integer) to the registry (a user variable can be specified). Valid values for root_key are listed under WriteRegStr. The error flag is set if the dword could not be written to the registry. If the registry key doesn't exist it will be created.
|
||||
|
||||
\c WriteRegDWORD HKLM "Software\My Company\My Software" "DWORD Value" 0xDEADBEEF
|
||||
|
||||
\S2{writeregstr} WriteRegStr
|
||||
|
||||
\c root_key subkey key_name value
|
||||
|
||||
Write a string to the registry. See \R{writeregexpandstr}{WriteRegExpandStr} for more details.
|
||||
|
||||
\c WriteRegStr HKLM "Software\My Company\My Software" "String Value" "dead beef"
|
||||
|
||||
\S2{writeregexpandstr} WriteRegExpandStr
|
||||
|
||||
\c root_key subkey key_name value
|
||||
|
@ -119,3 +176,5 @@ Write a string to the registry. root_key must be one of:
|
|||
\b \e{HKPD} or \e{HKEY_PERFORMANCE_DATA}
|
||||
|
||||
The error flag is set if the string could not be written to the registry. The type of the string will be REG_SZ for WriteRegStr, or REG_EXPAND_STR for WriteRegExpandStr. If the registry key doesn't exist it will be created.
|
||||
|
||||
\c WriteRegExpandStr HKLM "Software\My Company\My Software" "Expand String Value" "%WINDIR%\notepad.exe"
|
||||
|
|
|
@ -16,12 +16,31 @@ Each NSIS installer contains one or more Sections. Each These sections are creat
|
|||
|
||||
Tells the installer that the current section needs an additional "size_kb" kilobytes of disk space. Only valid within a section (will have no effect outside of a section or in a function).
|
||||
|
||||
\c Section
|
||||
\c AddSize 500
|
||||
\c SectionEnd
|
||||
|
||||
\S2{ssection} Section
|
||||
|
||||
\c [/o] [([!]|[-])section_name] [section index output]
|
||||
|
||||
Begins and opens a new section. If section_name is empty, omitted, or begins with a -, then it is a hidden section and the user will not have the option of disabling it. If the section name is 'Uninstall' or is prefixed with 'un.', then it is a an uninstaller section. If section index output is specified, the parameter will be !defined with the section index (that can be used for \R{sectionsettext}{SectionSetText} etc). If the section name begins with a !, the section will be displayed as bold. If the /o switch is specified, the section will be unselected by default.
|
||||
|
||||
\c Section "-hidden section"
|
||||
\c SectionEnd
|
||||
\c
|
||||
\c Section # hidden section
|
||||
\c SectionEnd
|
||||
\c
|
||||
\c Section "!bold section"
|
||||
\c SectionEnd
|
||||
\c
|
||||
\c Section /o "optional"
|
||||
\c SectionEnd
|
||||
\c
|
||||
\c Section "install something" SEC_IDX
|
||||
\c SectionEnd
|
||||
|
||||
\S2{ssectionend} SectionEnd
|
||||
|
||||
This command closes the current open section.
|
||||
|
@ -32,12 +51,30 @@ This command closes the current open section.
|
|||
|
||||
This command specifies which install types (see \R{ainsttype}{InstType}) the current section defaults to the enabled state in. Multiple SectionIn commands can be specified (they are combined). If you specify RO as a parameter, then the section will be read-only, meaning the user won't be able to change its state. The first install type defined using \R{ainsttype}{InstType} is indexed 1, the next 2 and so on.
|
||||
|
||||
\c InstType "full"
|
||||
\c InstType "minimal"
|
||||
\c
|
||||
\c Section "a section"
|
||||
\c SectionIn 1 2
|
||||
\c SectionEnd
|
||||
\c
|
||||
\c Section "another section"
|
||||
\c SectionIn 1
|
||||
\c SectionEnd
|
||||
|
||||
\S2{ssubsection} SubSection
|
||||
|
||||
\c [/e] Caption [subsection_name index output]
|
||||
|
||||
This command inserts a subsection. The subsection must be closed with SubSectionEnd, and should contain 1 or more Sections. If the subsection name begins with a !, the subsection will be displayed as bold. If /e is present, the sub sections of the sub section will be expanded by default. If section index output is specified, the parameter will be !defined with the section index (that can be used for SectionSetText etc). If the name is prefixed with 'un.' the subsection is an uninstaller subsection.
|
||||
|
||||
\c SubSection "some stuff"
|
||||
\c Section "a section"
|
||||
\c SectionEnd
|
||||
\c Section "another section"
|
||||
\c SectionEnd
|
||||
\c SubSectionEnd
|
||||
|
||||
\S2{ssubsectionend} SubSectionEnd
|
||||
|
||||
Closes a subsection opened with SubSection.
|
||||
|
|
|
@ -6,14 +6,35 @@
|
|||
|
||||
When no parameter is specified, exchanges the top two elements of the stack. When a parameter is specified and is a user variable, exchanges the top element of the stack with the parameter. When a parameter is specified and is a positive integer, Exch will swap the item on the top of the stack with the item that is specified by the offset from the top of the stack in the parameter. If there are not enough items on the stack to accomplish the exchange, a fatal error will occur (to help you debug your code :).
|
||||
|
||||
\c Push 1
|
||||
\c Push 2
|
||||
\c Exch
|
||||
\c Pop $0 # = 1
|
||||
|
||||
\c Push 1
|
||||
\c Push 2
|
||||
\c Push 3
|
||||
\c Exch 2
|
||||
\c Pop $0 # = 1
|
||||
|
||||
\c StrCpy $0 1
|
||||
\c Push 2
|
||||
\c Exch $0 # = 2
|
||||
\c Pop $1 # = 1
|
||||
|
||||
\S2{Pop} Pop
|
||||
|
||||
\c user_var(out)
|
||||
|
||||
Pops a string off of the stack into user variable $x. If the stack is empty, the error flag will be set.
|
||||
|
||||
\c Push 1
|
||||
\c Pop $0 # = 1
|
||||
|
||||
\S2{Push} Push
|
||||
|
||||
\c string
|
||||
|
||||
Pushes a string onto the stack. The string can then be Popped off of the stack.
|
||||
|
||||
\c Push "a string"
|
||||
|
|
|
@ -6,8 +6,17 @@
|
|||
|
||||
Sets the user variable $x with str. Note that str can contain other variables, or the user variable being set (concatenating strings this way is possible, etc). If maxlen is specified, the string will be a maximum of maxlen characters (if maxlen is negative, the string will be truncated abs(maxlen) characters from the end). If start_offset is specified, the source is offset by it (if start_offset is negative, it will start abs(start_offset) from the end of the string).
|
||||
|
||||
\c StrCpy $0 "a string" # = "a string"
|
||||
\c StrCpy $0 "a string" 3 # = "a s"
|
||||
\c StrCpy $0 "a string" -1 # = "a strin"
|
||||
\c StrCpy $0 "a string" "" 2 # = "string"
|
||||
\c StrCpy $0 "a string" "" -3 # = "ing"
|
||||
\c StrCpy $0 "a string" 3 -4 # = "rin"
|
||||
|
||||
\S2{StrLen} StrLen
|
||||
|
||||
\c user_var(length output) str
|
||||
|
||||
Sets user variable $x with the length of str.
|
||||
|
||||
\c StrLen $0 "123456" # = 6
|
||||
|
|
|
@ -14,30 +14,47 @@ Creates a font and puts its handle into user_var. For more information about the
|
|||
|
||||
You can get the current font used by NSIS using the ^Font and ^FontSize \R{langstring}{LangString}s.
|
||||
|
||||
\c !include WinMessages.nsh
|
||||
\c GetDlgItem $$0 $HWNDPARENT 1
|
||||
\c CreateFont $1 "Times New Roman" "7" "700" /UNDERLINE
|
||||
\c SendMessage $0 ${WM_SETFONT} $1 1
|
||||
|
||||
\S2{detailprint} DetailPrint
|
||||
|
||||
\c user_message
|
||||
|
||||
Adds the string "user_message" to the details view of the installer.
|
||||
|
||||
\c DeteailPrint "this message will show on the installation window"
|
||||
|
||||
\S2{enablewindow} EnableWindow
|
||||
|
||||
\c hwnd (1|0)
|
||||
|
||||
Enables or disables mouse and keyboard input to the specified window or control. Possible states are 0 (disabled) or 1 (enabled).
|
||||
|
||||
\c GetDlgItem $0 $HWNDPARENT 1
|
||||
\c EnableWindow $0 0
|
||||
\c Sleep 1000
|
||||
\c EnableWindow $0 1
|
||||
|
||||
\S2{findwindow} FindWindow
|
||||
|
||||
\c user_var(hwnd output) windowclass [windowtitle] [windowparent] [childafter]
|
||||
|
||||
Searches for a window. Behaves like the win32 FindWindowEx(). Searches by windowclass (and/or windowtitle if specified). If windowparent or childafter are specified, the search will be restricted as such. If windowclass or windowtitle is specified as "", they will not be used for the search. If the window is not found, the user variable returned is 0. To accomplish old-style FindWindow behavior, use FindWindow with SendMessage.
|
||||
|
||||
\c FindWindow $0 "#32770" "" $HWNDPARENT
|
||||
\c FIndWindow $0 "my window class" "my window title"
|
||||
|
||||
\S2{getdlgitem} GetDlgItem
|
||||
|
||||
\c user_var(output) dialog item_id
|
||||
|
||||
Retrieves the handle of a control identified by item_id in the specified dialog box dialog. If you want to get the handle of a control on the inner dialog, first use FindWindow user_var(output) "#32770" "" $HWNDPARENT to get the handle of the inner dialog.
|
||||
|
||||
\c GetDlgItem $0 $HWNDPARENT 1 # next/install button
|
||||
|
||||
\S2{hidewindow} HideWindow
|
||||
|
||||
Hides the installer.
|
||||
|
@ -48,6 +65,12 @@ Hides the installer.
|
|||
|
||||
If HWND is a window, Gotos jump_if_window, otherwise, Gotos jump_if_not_window (if specified).
|
||||
|
||||
\c GetDlgItem $0 $HWNDPARENT 1
|
||||
\c IsWindow 0 +3
|
||||
\c MessageBox MB_OK "found a window"
|
||||
\c Goto +2
|
||||
\c MessageBox MB_OK "no window"
|
||||
|
||||
\S2{sendmessage} SendMessage
|
||||
|
||||
\c HWND msg wparam lparam [user_var(return value)] [/TIMEOUT=time_in_ms]
|
||||
|
@ -66,6 +89,10 @@ To send a string param, put STR: before the parameter, for example: "STR:Some st
|
|||
|
||||
Use /TIMEOUT=time_in_ms to specify the duration, in milliseconds, of the time-out period.
|
||||
|
||||
\c !include WinMessages.nsh
|
||||
\c FindWindow $0 "Winamp v1.x"
|
||||
\c SendMessage $0 ${WM_CLOSE} 0 0
|
||||
|
||||
\S2{setautoclose} SetAutoClose
|
||||
|
||||
\c true|false
|
||||
|
@ -90,22 +117,34 @@ Shows or hides the details, depending on which parameter you pass. Overrides the
|
|||
|
||||
Sets mode at which commands print their status. None has commands be quiet, listonly has status text only added to the listbox, textonly has status text only printed to the status bar, and both enables both (the default). For extracting many small files, textonly is recommended (especially on win9x with smooth scrolling enabled).
|
||||
|
||||
\c SetDetailsPrint none
|
||||
\c File "secret file.dat"
|
||||
\c SetDetailsPrint both
|
||||
|
||||
\S2{setctlcolors} SetCtlColors
|
||||
|
||||
\c hwnd [/BRANDING] [text_color] [transparent|bg_color]
|
||||
|
||||
Sets a background color and the text color for a static control, edit control, button or a dialog. Use GetDlgItem to get the handle (HWND) of the control. To make the control transparent specify "transparent" as the background color value. You can also specify /BRANDING with or without text color and background color to make the control completely gray (or any other color you choose). This is used by the branding text control in the MUI.
|
||||
|
||||
\c FindWindow $0 "#32770" "" $HWNDPARENT
|
||||
\c GetDlgItem $0 $0 1006
|
||||
\c SetCtlColors $0 0xFF0000 0x00FF00
|
||||
|
||||
\S2{setsilent} SetSilent
|
||||
|
||||
\c silent | normal
|
||||
|
||||
Sets the installer to silent mode or normal mode. See \R{asilentinstall}{SilentInstall} for more information about silent installations. Can only be used in \R{oninit}{.onInit}.
|
||||
|
||||
Sets the installer
|
||||
|
||||
\S2{showwindow} ShowWindow
|
||||
|
||||
\c hwnd show_state
|
||||
|
||||
Sets the visability of a window. Possible show_states are the same as \W{http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowfunctions/showwindow.asp}{Windows ShowWindow} function. SW_* constants are defined in \L{../Include/WinMessages.nsh}{Include\\WinMessages.nsh}.
|
||||
|
||||
\c !include WinMessages.nsh
|
||||
\c GetDlgItem $0 $HWNDPARENT 1
|
||||
\c ShowWindow $0 ${SW_HIDE}
|
||||
\c Sleep 1000
|
||||
\c ShowWindow $0 ${SW_SHOW}
|
||||
|
|
|
@ -4,4 +4,6 @@
|
|||
|
||||
\c [Path\]exename.exe
|
||||
|
||||
Writes the uninstaller to the filename (and optionally path) specified. Only valid from within an install section or function, and requires that you have an uninstall section in your script. See also Uninstall configuration. You can call this one or more times to write out one or more copies of the uninstaller.
|
||||
Writes the uninstaller to the filename (and optionally path) specified. Only valid from within an install section or function, and requires that you have an uninstall section in your script. See also Uninstall configuration. You can call this one or more times to write out one or more copies of the uninstaller.
|
||||
|
||||
\c WriteUninstaller $INSTDIR\uninstaller.exe
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
\C{usage} MakeNSIS Usage
|
||||
|
||||
\H{usagereference} Reference
|
||||
|
||||
NSIS installers are generated by using the 'MakeNSIS' program to compile a NSIS script (.NSI) into an installer executable.
|
||||
The NSIS development kit installer sets up your computer so that you can compile a .nsi file by simply right-clicking on it in explorer, and selecting 'compile'.
|
||||
|
||||
|
@ -30,4 +32,22 @@ If you want to use MakeNSIS on the command line, the syntax of the makensis comm
|
|||
|
||||
\b Specifying a dash (-) for the script name will tell Makensis to use the standard input as a source.
|
||||
|
||||
\b If multiple scripts are specified, they are treated as one concatenated script.
|
||||
\b If multiple scripts are specified, they are treated as one concatenated script.
|
||||
|
||||
\H{usageexamples} Usage Examples
|
||||
|
||||
Basic usage:
|
||||
|
||||
\c makensis.exe myscript.nsi
|
||||
|
||||
Quiet mode:
|
||||
|
||||
\c makensis.exe /V1 myscript.nsi
|
||||
|
||||
Force compressor:
|
||||
|
||||
\c makensis.exe /X"SetCompressor /FINAL lzma" myscript.nsi
|
||||
|
||||
Change script behavior:
|
||||
|
||||
\c makensis.exe /DUSE_UPX /DVERSION=1.337 /DNO_IMAGES myscript.nsi
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue