-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathzip.vbs
More file actions
58 lines (50 loc) · 1.21 KB
/
zip.vbs
File metadata and controls
58 lines (50 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
Dim objFSO
Dim objFile
Dim objShell
Dim objSource
Dim objZip
Dim strVer
Dim strZip
'
' initialize objects
'
Set objShell = CreateObject("Shell.Application")
Set objScriptShell = CreateObject("Wscript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
'
' read version file
'
Set objFile = objFSO.OpenTextFile("VERSION.TXT", 1)
strVer = objFile.ReadLine()
Set objFile = Nothing
'
' create zip file name with version
'
strZip = Replace(WScript.Arguments(1), "{VERSION}", Trim(strVer))
'
' create zip file
'
Set objFile = objFSO.CreateTextFile(strZip, True)
objFile.Write("PK" & Chr(5) & Chr(6) & String(18, vbNullChar))
Set objFile = Nothing
'
' copy files to zip folder
'
Set objSource = objShell.NameSpace(objFSO.GetAbsolutePathName(WScript.Arguments(0))).Items
Set objZip = objShell.NameSpace(objFSO.GetAbsolutePathName(strZip))
Set objFSO = Nothing
objZip.CopyHere(objSource)
'
' Wait for zip window to open
'
Do
WScript.Sleep(1)
Loop While Not objScriptShell.AppActivate("Compressing...")
'
' Wait for window to close
'
Do
WScript.Sleep(1)
Loop While objScriptShell.AppActivate("Compressing...")
Set objScriptShell = Nothing
Set objShell = Nothing