NSIS/Docs/src/flowcontrol.but

166 lines
6.7 KiB
Text
Raw Normal View History

\S1{flowcontrol} Flow Control Instructions
\S2{abort} Abort
\c user_message
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.
\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).
\S2{clearerrors} ClearErrors
Clears the error flag.
\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.
\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).
\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.
\S2{goto} Goto
\c label_to_jump_to | +offset| -offset| user_var(target)
If label is specified, goto the label 'label_to_jump_to:'.
If +offset or -offset is specified, jump is relative by offset instructions. Goto +1 goes to the next instruction, Goto -1 goes to the previous instruction, etc.
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.
\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}.
\S2{iferrors} IfErrors
\c jumpto_iferror [jumpto_ifnoerror]
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.
\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 [jump_if_set] [jump_if_not_set]
Atleast one parameter is required. 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.
* PageEx - every page can be used everywhere and as many times as needed * DirVar - easy way to add another dir page * default strings in the language file (Page directory is enough, no need for DirText) * strings from the language file are now LangStrings that can be used in the script * no more /LANG - one string for all languages * any lang strings can be used everywhere, installer or uninstaller (no un.) * no more unprocessed strings - variables can be used almost everywhere (except in licenseData and InstallDirRegKey) * DirText parm for browse dialog text * SetBkColor -> SetCtlColors - can now set text color too * fixed SetOutPath and File /r bug * fixed File /a /oname bug * added $_CLICK for pages * added quotes support in lang files (patch #752620) * extraction progress * separate RTL dialogs for RTL langs (improved RTL too) * InstallOptions RTL * StartMenu RTL * fixed RegDLL? * added IfSilent and SetSilent (SetSilent only works from .onInit) * fixed verify window (it never showed) (bug #792494) * fixed ifnewer readonly file problem (patch #783782) * fixed wininit.ini manipulation when there is another section after [rename] * fixed some ClearType issues * fixed a minor bug in the resource editor * fixed !ifdef/!endif stuff, rewritten * lots of code and comments clean ups * got rid of some useless exceptions handling and STL classes (still much more to go) * lots of optimizations, of course ;) * updated system.dll with support for GUID, WCHAR, and fast VTable calling (i.e. COM ready) * minor bug fixes git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2823 212acab6-be3b-0410-9dea-997c60f758d6
2003-09-04 18:25:57 +00:00
\S2{ifsilent} IfSilent
\c [jump_if_silent] [jump_if_not]
Atleast one parameter is required. 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.
* PageEx - every page can be used everywhere and as many times as needed * DirVar - easy way to add another dir page * default strings in the language file (Page directory is enough, no need for DirText) * strings from the language file are now LangStrings that can be used in the script * no more /LANG - one string for all languages * any lang strings can be used everywhere, installer or uninstaller (no un.) * no more unprocessed strings - variables can be used almost everywhere (except in licenseData and InstallDirRegKey) * DirText parm for browse dialog text * SetBkColor -> SetCtlColors - can now set text color too * fixed SetOutPath and File /r bug * fixed File /a /oname bug * added $_CLICK for pages * added quotes support in lang files (patch #752620) * extraction progress * separate RTL dialogs for RTL langs (improved RTL too) * InstallOptions RTL * StartMenu RTL * fixed RegDLL? * added IfSilent and SetSilent (SetSilent only works from .onInit) * fixed verify window (it never showed) (bug #792494) * fixed ifnewer readonly file problem (patch #783782) * fixed wininit.ini manipulation when there is another section after [rename] * fixed some ClearType issues * fixed a minor bug in the resource editor * fixed !ifdef/!endif stuff, rewritten * lots of code and comments clean ups * got rid of some useless exceptions handling and STL classes (still much more to go) * lots of optimizations, of course ;) * updated system.dll with support for GUID, WCHAR, and fast VTable calling (i.e. COM ready) * minor bug fixes git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2823 212acab6-be3b-0410-9dea-997c60f758d6
2003-09-04 18:25:57 +00:00
\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.
\S2{intcmpu} IntCmpU
\c val1 val2 jump_if_equal [jump_if_val1_less] [jump_if_val1_more]
Compares two unsigned 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. Performs the comparison as unsigned integers.
\S2{messagebox} MessageBox
\c mb_option_list messagebox_text [/SD return] [return_check jumpto] [return_check_2 jumpto_2]
Displays a MessageBox containing the text "messagebox_text". mb_option_list must be one or more of the following, delimited by |s (e.g. MB_YESNO|MB_ICONSTOP).
\b \e{MB_OK} - Display with an OK button
\b \e{MB_OKCANCEL} - Display with an OK and a cancel button
\b \e{MB_ABORTRETRYIGNORE} - Display with abort, retry, ignore buttons
\b \e{MB_RETRYCANCEL} - Display with retry and cancel buttons
\b \e{MB_YESNO} - Display with yes and no buttons
\b \e{MB_YESNOCANCEL} - Display with yes, no, cancel buttons
\b \e{MB_ICONEXCLAMATION} - Display with exclamation icon
\b \e{MB_ICONINFORMATION} - Display with information icon
\b \e{MB_ICONQUESTION} - Display with question mark icon
\b \e{MB_ICONSTOP} - Display with stop icon
\b \e{MB_TOPMOST} - Make messagebox topmost
\b \e{MB_SETFOREGROUND} - Set foreground
\b \e{MB_RIGHT} - Right align text
\b \e{MB_DEFBUTTON1} - Button 1 is default
\b \e{MB_DEFBUTTON2} - Button 2 is default
\b \e{MB_DEFBUTTON3} - Button 3 is default
\b \e{MB_DEFBUTTON4} - Button 4 is default
Return_check can be 0 (or empty, or left off), or one of the following:
\b \e{IDABORT} - Abort button
\b \e{IDCANCEL} - Cancel button
\b \e{IDIGNORE} - Ignore button
\b \e{IDNO} - No button
\b \e{IDOK} - OK button
\b \e{IDRETRY} - Retry button
\b \e{IDYES} - Yes button
If the return value of the MessageBox is return_check, the installer will Goto jumpto.
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.
\S2{return} Return
Returns from a function or section.
\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).
\S2{seterrors} SetErrors
Sets the error flag.
\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.