ÛÛÛÛÛÛ» ÛÛÛÛÛ» ÛÛÛÛÛÛ» 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: = where 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. 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: ! where is a variable or control (checkbox or radio button). The result of the operation is 0 when 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: $ 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 Create dialog using resource . If there is an active dialog, the newly creating dialog will be it's child. Example: Dialog SETUP ENDDIALOG Close active dialog. SETTEXT , Set text to control . Example: SetText $107,"extracting" Alternate SetText form, used to set controls with several lines: SETTEXT { "line 1" ... "line N" } Example: SetText $108 { " This is a beta version" "" " Please be very careful" } IF..ELSE Conditional execution. Syntax: IF { } ELSE { } where 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 Create program manager group named . If the group already exists it will be activated. Example: CreateGroup "WinRAR 2.0" DELETEGROUP Delete program manager group named . Example: DeleteGroup "Applications" ADDITEM [,] 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 , Set key value in the registry; 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 [] Set file mask to extract. Wildcards and multiple mask operators are allowed. Set "*.*" mask to extract all files. If no is specified, current mask list is discarded. Example: Preparing to extract EXE and COM files: Mask *.exe Mask *.com EXCLUDE [] Set exclude from extract file mask Wildcards and multiple exclude operators are allowed. If no is specified, the current exclude mask list is discarded. Example: Exclude from extract, DLL files: Exclude *.dll EXTRACT [] 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 Execute a program. Script processing is not suspended, continued simultaneously with execution of a program. Example: Exec "%%Dwinrar.exe" SETPATH Set path to extract. is a text string or a control with text. Examples: SetPath "C:\WinRAR" SetPath $102 SETPASSWORD Set password to decrypt files during extraction. The password may be a text string or a control with text. Example: SetPassword $104 SETARCNAME Set archive 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 ,, Set dialogs background color. Example: BkColor 255,255,255 DISABLE Disable a control. Example: Disable $105 ENABLE 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 { } Example: MAIN { Dialog SETUP } 2) Function ":INIT". The function is executed before a, just created, dialog is displayed: :INIT { } Example: SETUP:INIT { $104=InitValue } 3) Function "". The function is executed when the button control with the corresponding ID is pushed. : { } 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.