PageRenderTime 25ms CodeModel.GetById 19ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/V2.2/trunk/CAL/Silverlight/Composite.Tests/Mocks/Modules/addToZip.vbs

#
Visual Basic | 29 lines | 19 code | 6 blank | 4 comment | 1 complexity | f9ddbb8fd3ded130a30cb8e9279343dd MD5 | raw file
 1Option Explicit
 2Dim fso, winShell, MyTarget, MySource, file, zipFile
 3Set fso = CreateObject("Scripting.FileSystemObject")
 4Set winShell = createObject("Shell.Application")
 5
 6MyTarget = Wscript.Arguments.Item(0)
 7MySource = Wscript.Arguments.Item(1)
 8
 9Wscript.Echo "Adding " & MySource & " to " & MyTarget
10
11'create a new clean zip archive
12Set zipFile = winShell.NameSpace(MyTarget)
13if zipFile is Nothing Then
14    Set file = fso.CreateTextFile(MyTarget, True)
15    file.write("PK" & chr(5) & chr(6) & string(18,chr(0)))
16    file.close
17    Set file = Nothing
18End If
19
20Set zipFile = winShell.NameSpace(MyTarget)
21zipFile.CopyHere MySource, &H10& 'winShell.NameSpace(MySource).Items if it's a folder
22wscript.sleep 500
23
24'do until zipFile.items.count = 1 'winShell.namespace(MySource).items.count
25'    wscript.sleep 500
26'loop
27
28Set winShell = Nothing
29Set fso = Nothing