home *** CD-ROM | disk | FTP | other *** search
/ Freelog 117 / FreelogNo117-OctobreNovembre2013.iso / Theme / 8GadgetPack / 8GadgetPackSetup.msi / Gadgets.7z / Gadgets / Denk-Daran.gadget / update.vbs < prev   
Text File  |  2012-10-27  |  1KB  |  44 lines

  1. ∩╗┐Sub binaryfilewriter(inhalt)
  2.     'code teilweise aus: http://www.paulsadowski.com/wsh/GetRemoteBinaryFile.htm
  3.     
  4.     set oStream = createobject("Adodb.Stream")
  5.     
  6.     oStream.type = 1 '1 = binary, 2 = text
  7.     oStream.open
  8.     oStream.write inhalt
  9.     
  10.     'datei schreiben
  11.     oStream.savetofile ZipName, 2 '2 = ueberschreiben, 1 = nicht ueberschreiben
  12.     
  13.     oStream.close
  14.     
  15. End Sub
  16.  
  17. Sub entpacker()
  18.     'Code teilweise aus: http://forum.chip.de/programmieren/vbs-einzelne-datei-zip-entpacken-1552295.html
  19.  
  20.     Set objFSO = CreateObject("Scripting.FileSystemObject")
  21.     
  22.     
  23.     strExpandTo = objFSO.GetAbsolutePathName(ExpandTo)
  24.     
  25.     'update-ordner l├╢schen, falls er f├ñlschlicherweise schon da sein sollte
  26.     If objFSO.FolderExists(ExpandTo) Then
  27.         objFSO.DeleteFolder(ExpandTo)
  28.     End If
  29.     
  30.     'update-ordner erstellen
  31.     objFSO.CreateFolder(strExpandTo)
  32.     
  33.     'Ueber "shell.application" auf die Zip-Datei und den Zielordner zugreifen
  34.     Set objShellApp = CreateObject("Shell.Application")
  35.     Set objZip = objShellApp.NameSpace(ZipName)
  36.     Set objExpand = objShellApp.NameSpace(ExpandTo)
  37.     
  38.     'ZIP-Inhalt in den Ziel-Ordner kopieren
  39.     objExpand.CopyHere(objZip.Items)
  40.     
  41.     'ZIP-Datei l├╢schen
  42.     strZipName = objFSO.GetAbsolutePathName(ZipName)
  43.     objFSO.DeleteFile(strZipName)
  44. End Sub