|
|
|
|
|
- Use condition
- Error codes
- Stored path of archive files
- Self-extracting archive
- Closing the archive
- Translating the interface of the self-extractor ( parameter)
- The executable file is located on a media from which the archive files cannot be extracted
- The self-extracting archive contains executable files
- Command line parameters of a self-extracting archive
<zipArchive variable>.CreateExe (Function) In french: <Variable zipArchive>.CréeExe Creates a self-extracting archive (.exe file). When the executable file is run, the archive files are automatically extracted to the current computer.
MyArchive is zipArchive
ResOpenArchive = MyArchive.Open("D:\Backups\Backup.WDZ")
IF ResOpenArchive = 0 THEN
ResArchiveExe = MyArchive.CreateExe("C:\Directories\Archive.EXE")
...
END
New in SaaS
Archive is zipArchive
IF MyArchive.Open("D:\Backups\Backup.zip") = 0 THEN
ParamExe is zipExeCreationParameter
ParamExe.ExeFilePath = "C:\Directories\Archive.exe"
ParamExe.DirectoryOption = zipCurrentDirectory
ParamExe.Icon = "Icon.ico"
MyArchive.CreateExe(ParamExe)
...
END
Syntax
Creating a self-extracting executable by specifying all parameters Hide the details
<Result> = <Archive>.CreateExe(<Executable path> [, <Options> [, <Executable icon> [, <Default extraction directory> [, <Self-extractor translation> [, <Version number>]]]]])
<Result>: Integer - 0 if the executable was created,
- An error code (value greater than 0) otherwise. For more details on these error codes, see the Remarks.
<Archive>: zipArchive variable Name of a variable of type zipArchive corresponding to the archive to be used. <Executable path>: Character string Path of the executable file to be created (up to 260 characters). This path can be a path relative to the current directory or a full path. The .EXE extension is mandatory. <Options>: Optional constant Executable creation and extraction options: | | zipAdministrator | Forces the created executable file to run as administrator. This mode avoids file virtualization from Windows Vista. | zipCurrentDirectory | All files in the archive will be extracted to the current directory. | zipDefaultDir | Uses the default directory (<Default extraction directory>). | New in SaaSzipExe64 | Creates a 64-bit executable. If this constant is not specified, a 32-bit executable will be created. | zipSelectRestorePath | A "Preserve structure" option will appear in the extraction dialog box. | zipTempDirectory (Default value) | The archive files will be extracted to the temporary directory of the computer where the executable file is run. All files are extracted to the same location. | zipTree | The files will be extracted while preserving the archive's directory structure. | zipWithUI | The self-extractor will display a dialog box allowing users to chose the destination directory. |
<Executable icon>: Optional character string Path of the icon file representing the created executable. This path can be relative to the current path or a full path. If this parameter is not specified, a default icon will be used for the executable. <Default extraction directory>: Optional character string Directory suggested by default in the extraction window (if the zipWithUI constant is used). If there is no extraction window, this directory will be used by default to extract files from the archive. <Self-extractor translation>: Optional character string Full path of the INI file containing the translations of the self-extractor. The file format details are presented in the Remarks. If this parameter is not specified or is an empty string (""), the default translation file will be used. <Version number>: Optional character string New in SaaSVersion number of the new executable. This number must have the following format: <Major version>.<Minor version>.<Compilation number>.<Revision number> Example "30.12.15.3". This version number can then be retrieved using the ExeInfo function with the exeVersionWindowsFormat constant. If this parameter is not specified, a default version number will be defined based on the version used to create the self-extracting archive.
New in SaaS
Creating a self-extracting executable by specifying the parameters with a zipExeCreationParameter variable Hide the details
<Result> = <Archive>.zipCreateExe(<Parameters>)
<Result>: Integer - 0 if the executable was created,
- An error code (value greater than 0) otherwise. For more details on these error codes, see the Remarks.
<Archive>: zipArchive variable Name of a variable of type zipArchive corresponding to the archive to be used. <Parameters>: zipExeCreationParameter variable Name of the zipExeCreationParameter variable corresponding to the various parameters of the archive to be created. Remarks Use condition A self-extracting archive can be created only if: - The archive exists (archives are created using <zipArchive variable>.Create).
- The archive is accessible in read/write mode.
- The archive is a single-part archive.
Caution: - CAB archives: This function is not available.
- RAR archives: This function is not available.
- 7z archives: This function is not available.
- TAR and TARGZ archives: This function is not available.
Error codes The following error codes are returned: - 10: Not enough space to create the executable, or the user does not have write access to the original archive (.WDZ).
- 11: Error converting archive to self-extracting archive
- 12: Not enough space to create the executable, or the user does not have read access to the original archive (.WDZ).
The message corresponding to the error code is returned by zipMsgError. Stored path of archive files When the files are extracted from a self-extracting archive, the stored path of the files is not kept. Only the name and the extension of the files are stored. Self-extracting archive The source archive (.WDZ or .ZIP) cannot be rebuilt from a self-extracting archive. No password can be defined for a self-extracting archive. Caution: - A self-extracting ZIP file cannot be opened with <zipArchive variable>.Open.
- If the self-extracting archive contains empty and non-empty subdirectories, when the archive is decompressed, only the directories containing files are recreated.
Closing the archive Once <zipArchive variable>.CreateExe has been used on an archive, this archive is not closed. You must call <zipArchive variable>.Close to close the source archive. Translating the interface of the self-extractor (<Self-extractor translation> parameter) By default, the self-extractor is available in three languages: English, Spanish and French. The self-extractor will use the language of the executable or the language specified by Nation. The interface of the self-extractor can use a language other than the default language (English).
To do so, create a .INI file containing the following information: [GENERAL] NATIONDEFAUT=1 [WDAUTOEX01] R000=Self-extracting PC SOFT archive R001=Extract the content of the archive in the directory: R002=Preserve tree structure R003=Extract R004=Close For example, to get an interface in French: [GENERAL] NATIONDEFAUT=1 [WDAUTOEX01] R000=Archive Autoextractible PC SOFT R001=Extraire le contenu de l'archive dans le repertoire: R002=Conserver l'arborescence R003=Extraire R004=Fermer Caution: The first three lines of this file must not be modified. In the following lines, specify the desired translation. The <Self-extractor translation> parameter must correspond to the path of the .INI file containing the translation of the interface. The executable file is located on a media from which the archive files cannot be extracted The executable file may be located on a media (e.g. a CD) from which the archived files cannot be extracted. In this case, run the executable and specify the following command line: The <Directory> parameter specifies the location from which the archive files must be extracted. If <Directory> contains spaces, the character string must be enclosed in quotes. This parameter takes precedence over the <Extraction directory> parameter. The self-extracting archive contains executable files If the last archived file is an executable (.EXE), this file will be automatically run once all the archive files have been extracted. Command line parameters of a self-extracting archive The following parameters are used to launch a self-extracting archive from the command line: | | /DIR=<Directory> | Specifies the location from which the archived files should be extracted. If <Directory> contains spaces, the character string must be enclosed in quotes. Caution: This parameter takes precedence over the <Extraction directory> specified with <zipArchive variable>.CreateExe. | /TIT=<Title> | <Title> corresponds to the title of the self-extracting window. | /PID=<Num PID> | Waits for the end of the <PID Num> process before starting the extraction. | /SILENT | Starts the extraction without a progress bar or dialogue box. | /WAIT | If the self-extracting archive launches an executable, the self-extractor will keep running until the executable is terminated. | /RELANCE | Extraction with administrator rights. |
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|