Project

General

Profile

$zip » History » Version 10

Per Amundsen, 01/10/2023 12:51 AM

1 1 Per Amundsen
_Added in 2.9_
2
3
*$zip*
4
5
Returns the name of the zip operation during a [[on ZIP]] or [[on UNZIP]] event.
6 3 Per Amundsen
7
----------------
8 1 Per Amundsen
9
*$zip(name, [N])*
10
11
Returns information about a zip/unzip item during a [[on ZIP]] or [[on UNZIP]] event.
12
13
_See also [[/zip]], [[$ziperr]], [[on ZIP]], [[on UNZIP]]._
14
15
*Parameters*
16
17 4 Per Amundsen
name - Name of the zip/unzip operation. (can be a [[Scripting_Wildcards|wildcard]])
18 1 Per Amundsen
[N] - The Nth matches name.
19
20
*Properties*
21
22
.name - Returns the name of zip/unzip operation.
23
.src - Returns the source file or folder.
24
.dest - Returns the destination file or folder.
25
.ratio - Returns 0, 1 or 2 where 0 = no compression, 1 = fastest compression, 2 = optimal compression.
26
.unzip - Returns [[$true]] if this is a unzip operation, otherwise [[$false]].
27
28
*Example*
29
30
<pre>
31
; Zip the entire adiirc folder into 'adiirc.zip'
32
//zip name $qt($adiircdir) adiirc.zip
33
34
; Print the zip result when then zip operation is finished.
35 5 Per Amundsen
on *:ZIP:name:echo -ag zipped $zip($zip).src into $zip($zip).dest status: $iif($ziperr,fail,ok)
36 1 Per Amundsen
</pre>
37 6 Per Amundsen
38
-----------------------------
39
40 7 Per Amundsen
*$zip(file.zip,cetlpo,file|dir,password,N)*
41 6 Per Amundsen
42
Create or extract zip files.
43
44
Returns "1" if the operation was successful, otherwise "0".
45
46
*Parameters*
47
48
file.zip - The zip file to list/test/create or extract.
49
cetlpo:
50
c - Create a new zip file.
51
e - Extract a zip file.
52
t - Test a zip file.
53
l - List number of files in a zip file or the Nth file.
54 8 Per Amundsen
p - *TODO*
55 6 Per Amundsen
o - Overwrite existing zip file or extract folder.
56
file|dir - File or directory to zip or directory to extract to.
57 8 Per Amundsen
password - *TODO*
58 6 Per Amundsen
N - Used with the "l", if N = 0, number of zipped files in the zip file, otherwise the Nth zipped file.
59
60 9 Per Amundsen
*Properties*
61
62 10 Per Amundsen
.csize - Returns the compressed size of the file. *(AdiIRC Only)*
63
.size - Returns the size of the file.
64
.mtime - Returns the last modification time of the file.
65 9 Per Amundsen
66 6 Per Amundsen
*Example*
67
68
<pre>
69
; Creates a new zip file called 'file.zip' and adds the file 'file,txt'.
70
//echo -ag $zip(file.zip, c, file.txt)
71
72
; Creates a new zip file called 'file.zip' and adds the folder 'folder'.
73
//echo -ag $zip(file.zip, c, folder)
74
75
; Extracts the zip file 'file.zip' to the folder 'extracted'.
76
//echo -ag $zip(file.zip, e, extracted)
77
78
; Prints number of zipped files in the zip file 'file.zip'.
79
//echo -ag $zip(file.zip, l, 0)
80
81
; Prints the file name of the first zipped file in the zip file 'file.zip'.
82
//echo -ag $zip(file.zip, l, 1)
83
</pre>