
 ۻ   ۻ  ۻ      Installation SFX Manual
 ۻ ۻ ۻ     ~~~~~~~~~~~~~~~~~~~~~~~
 ɼ ۺ ɼ     RAR 2.00 for Windows
 ۻ ۺ ۻ     ~~~~~~~~~~~~~~~~~~~~
 ۺ  ۺ ۺ  ۺ ۺ  ۺ     Multifunctional Integrated Archive Manager
 ͼ  ͼ ͼ  ͼ ͼ  ͼ     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


  1. Where the installation SFX script should be placed

  Initially the installation SFX refers to a user data resource called
  "SCRIPT". If there is no resource with that name, the archive comment
  will be processed as the script.


  2. Script resources

  Prepare dialogs, icons and other resources needed for your script with
  help of your resource editor. You should then compile the resources and
  add them to the SFX module with a resource compiler.


  3. Script language

  The script strings starting with a semicolon ';' character are
  comments and are ignored when processing.


  3.1. Operations

  Assignment:   <Lvalue>=<Rvalue>

  where <Lvalue> is a variable or control (checkbox or radio button). Set
  1 to control to place the check mark and 0 to remove the check mark.

  <Rvalue> is a number, variable or control (checkbox or radio button).
  Control value is 1, if control is checked, or 0, if it is not checked.

  Logical negation:   !<value>

  where <Value> is a variable or control (checkbox or radio button). The
  result of the operation is 0 when <value> is nonzero and 1 when value is
  zero.


  3.2. Variables

  Variable names are case sensitive.

  Variable name length          up to 31 bytes
  Variable type                 integer

  Due to the fact that supported operations are assignment and logical
  negation only, the main purpose of variables is to maintain the state
  of controls in order to restore their value at a later time and for
  usage in the IF operator.


  3.3. Controls

  The controls only in the currently active dialog may be accessed.

  To access a control use the following syntax:

  $<control ID>

  Examples:

  "Check control with ID 101":

    $101=1

  "Save state of control with ID 102 to the variable Custom":

    Custom=$102


  3.4. Macros

  There are four macros: %%D, %%A, %%F and %%".  In a string of
  script they will be expanded as follows:

    %%D   destination path for extraction
    %%A   current archive name (changes when volume are processing)
    %%F   current file being extracted (destination path is omitted)
    %%"   quote mark

  These macros are mainly to be used in the SetText operator.


  3.5. Operators

  Syntax notes:

  1) Operator names are case insensitive.

  2) If a parameter is a text string containing spaces, it must be in
  quotation marks. When there are no spaces in the string, the quotation
  marks are optional.  The sole exception to this rule is text strings in
  the second form of the SetText operator, which must be quoted.

  Operators:

  EXIT                 Cancel script execution.


  DIALOG <DlgName>     Create dialog using resource <DlgName>. If
                       there is an active dialog, the newly creating
                       dialog will be it's child.
  Example:

    Dialog SETUP


  ENDDIALOG            Close active dialog.


  SETTEXT <c>,<t>      Set text <t> to control <c>.

  Example:

    SetText $107,"extracting"

  Alternate SetText form, used to set controls with several lines:


  SETTEXT <control>
  {
    "line 1"
     ...
    "line N"
  }

  Example:

    SetText $108
    {
      "         This is a beta version"
      ""
      "         Please be very careful"
    }


  IF..ELSE             Conditional execution.

  Syntax:

  IF <value>
  {
    <operators>
  }
  ELSE
  {
    <operators>
  }

  where <Value> is a variable or control (checkbox or radio button).
  Logical negation operation is applicable here as well.

  The ELSE part of the IF operator is optional.

  Example:

  If control with ID 106 is not checked, set text "Enabled" to the
  control with ID 111:

    If !$106
    {
      SetText $111,"Enabled"
    }


  CREATEGROUP <Group>  Create program manager group named <Group>.

  If the group already exists it will be activated.

  Example:

    CreateGroup "WinRAR 2.0"


  DELETEGROUP <Group>  Delete program manager group named <Group>.

  Example:

    DeleteGroup "Applications"


  ADDITEM <path> [,<item>]

  Add item to just created or activated group (using CREATEGROUP
  operator). First parameter is the path of the file to be added and
  second optional parameter is the item name in the group.

  Example:

    AddItem  "%%Dwinrar.hlp","WinRAR help"

    NOTE: %%D will be replaced with the destination path.


  SETKEY <key>,<key value>

  Set key value in the registry; <key> is a subkey of the
  HKEY_CLASSES_ROOT key.

  Example:

  Associate .rar extension with WinRAR:

    SetKey .rar,RAR.Archive
    SetKey RAR.Archive,"RAR archive"
    SetKey RAR.Archive\shell\open\command,"%%Dwinrar.exe %%"%1%%""


  MASK [<Mask>]        Set file mask to extract.

  Wildcards and multiple mask operators are allowed. Set "*.*" mask to
  extract all files. If no <mask> is specified, current mask list is
  discarded.

  Example:

  Preparing to extract EXE and COM files:

    Mask *.exe
    Mask *.com


  EXCLUDE [<Mask>]        Set exclude from extract file mask

  Wildcards and multiple exclude operators are allowed.
  If no <mask> is specified, the current exclude mask list is discarded.

  Example:

  Exclude from extract, DLL files:

    Exclude *.dll


  EXTRACT [<control>]  Start extraction of files from the archive (using
                       masks defined with MASK operators).
                       Optional parameter is a control where to show the
                       name of the extracted file.
  Example:

    Extract $107


  EXEC <name>          Execute a program. Script processing is not
                       suspended, continued simultaneously with
                       execution of a program.
  Example:

    Exec "%%Dwinrar.exe"


  SETPATH <path>       Set path to extract. <Path> is a text string or a
                       control with text.

  Examples:

    SetPath "C:\WinRAR"

    SetPath $102


  SETPASSWORD <passwd> Set password to decrypt files during extraction.
                       The password <passwd> may be a text string or a
                       control with text.
  Example:

    SetPassword $104


  SETARCNAME <name>    Set archive name. <Name> may be a text string or
                       a control with text. This operator is to be used
                       only to specify the next volume name in the ASKVOLUME
                       function.
  Example:

    SetArcName $103


  BKCOLOR <Red>,<Green>,<Blue>

  Set dialogs background color.

  Example:

    BkColor 255,255,255


  DISABLE <control>    Disable a control.

  Example:

    Disable $105


  ENABLE <control>     Enable a control.

  Example:

    Enable $105


  3.6. Functions

  Syntax notes:

  1) Function MAIN. Starts the script execution and must be the first
  function in the script:

   MAIN
   {
     <operators>
   }

  Example:

   MAIN
   {
     Dialog SETUP
   }

  2) Function "<Dialog>:INIT". The function is executed before a, just
  created, dialog is displayed:

   <DialogName>:INIT
   {
     <operators>
   }

  Example:

   SETUP:INIT
   {
     $104=InitValue
   }


  3) Function "<Dialog:Control>". The function is executed when the
  button control with the corresponding ID is pushed.

   <DialogName>:<control>
   {
     <operators>
   }

  Example:

   SETUP:$101
   {
     InitValue=$104
     EndDialog
     Dialog NEXT
   }


  3.7. Special dialogs

  There are special dialogs called by SFX under certain conditions.
  These dialogs should be defined in the script, if processing of the
  corresponding events is desired.

  Dialog name       Description
  --------------------------------------------------------

  ASKVOLUME         Called when SFX cannot find the next volume.
                    The %%A macros could be used to obtain the required
                    volume name.

                    Possible actions:

                    - exit with EXIT operator;

                    - prompt the user to insert the volume and close the
                      dialog with EndDialog. Then SFX will try opening
                      the volume again;

                    - prompt the user to enter a new volume name, then
                      set it with SetArcName and close the dialog with
                      EndDialog. SFX will try opening the volume again.

  ERRARCHIVE        Called when the archive structure appears to be
                    damaged. The %%A macros could be used to obtain the
                    corresponding archive name.

                    Possible actions:

                    - exit with EXIT operator;

                    - close the dialog with EndDialog. Then SFX will try
                      to continue execution.

  ERRCREATE         Called when SFX cannot create a file.
                    The %%F macros could be used to obtain the
                    corresponding file name.

                    Possible actions:

                    - exit with EXIT operator;

                    - close the dialog with EndDialog. Then SFX will
                      continue execution.

  ERRCRC            Called when the file CRC is corrupted.
                    The %%F macros could be used to obtain the
                    corresponding file name.

                    Possible actions:

                    - exit with EXIT operator;

                    - close the dialog with EndDialog. Then SFX will
                      continue execution.

  ERRWRITE          Called in case of a write error.

                    Possible actions:

                    - exit with EXIT operator;

                    - close the dialog with EndDialog. Then SFX will retry
                      write operation.

  ERRMEMORY         Called when there is not enough memory.

                    Possible actions:

                    - exit via EXIT operator

  4. The SFX icon

  The SFX icon could be placed as a resource named "SFX_ICON". It will be
  assigned to the main SFX window.

