PageRenderTime 40ms CodeModel.GetById 12ms RepoModel.GetById 0ms 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
  1. Option Explicit
  2. Dim fso, winShell, MyTarget, MySource, file, zipFile
  3. Set fso = CreateObject("Scripting.FileSystemObject")
  4. Set winShell = createObject("Shell.Application")
  5. MyTarget = Wscript.Arguments.Item(0)
  6. MySource = Wscript.Arguments.Item(1)
  7. Wscript.Echo "Adding " & MySource & " to " & MyTarget
  8. 'create a new clean zip archive
  9. Set zipFile = winShell.NameSpace(MyTarget)
  10. if zipFile is Nothing Then
  11. Set file = fso.CreateTextFile(MyTarget, True)
  12. file.write("PK" & chr(5) & chr(6) & string(18,chr(0)))
  13. file.close
  14. Set file = Nothing
  15. End If
  16. Set zipFile = winShell.NameSpace(MyTarget)
  17. zipFile.CopyHere MySource, &H10& 'winShell.NameSpace(MySource).Items if it's a folder
  18. wscript.sleep 500
  19. 'do until zipFile.items.count = 1 'winShell.namespace(MySource).items.count
  20. ' wscript.sleep 500
  21. 'loop
  22. Set winShell = Nothing
  23. Set fso = Nothing