Function to zip a file object using 7-Zip. This function is the equivalent of the method .zip().
In order to use this method, you need to have 7-Zip installed. The global variable v7Location must hold a valid path to the 7-Zip executable. When no path is specified, the function shows a dialog with which the user can point to the 7-Zip executable.
Instead of using this method, you can also use the default method RoboHelp.createZipFile()
. This method is available starting RoboHelp 11.
var file = new File("C:/test.txt"); file.zip("myarchive.zip");
Parameter | Data type | Required | Description |
---|---|---|---|
file | file object | Yes | The file to zip |
zipname | string | Yes | The name of the archive, including the extension |
method | string | The zip method to use. Default is tzip |
|
compression | string/number | The compression to use. Default is false |
|
archivecommand | string | The archive command to use. Default is a |
Value | Meaning |
---|---|
true | The file has been zipped. Note: This method uses the command line to zip the file. For the command line this method uses the function ExecuteBatchFile(). The return value of this function is limited to the return value of the function ExecuteBatchFile() |
false | The file could not be zipped |
This paragraph lists the values you can use for the parameters of the method .zip()
.
Method | Meaning |
---|---|
tz7b | 7z format |
tgzip | GZIP format |
tzip | ZIP format |
tbzip | 2 BZIP2 format |
tiso | ISO format |
tudf | UDF format |
Compression | Meaning |
---|---|
0 | No compression |
1 | Very low compression |
3 | Fast compression |
5 | Normal compression |
7 | High compression |
9 | Ultra compression |
false | Use default compression |
Command | Meaning |
---|---|
a | Add file to archive |
u | Update file in archive |