Jump to content

Using Windows Xp Zip Built-in Features


Recommended Posts

  • 1 month later...

Following the same pattern as in http://www.autoitscript.com/forum/index.ph...pic=21004&st=0#, you could use something similar to:

Local $zipFile      = "C:\test.zip"
    Local $Destination  = "C:\test"
    
    Local $oShell = ObjCreate('Shell.Application')
    If @error or not IsObj($oShell) Then exit                   ;something went @#{[[~&^ç!
    Local $oFolder = $oShell.NameSpace($Destination)
    If @error or not IsObj($oFolder) Then exit                  ;something went @#{[[~&^ç!
    
    Local $zback = RegRead("HKLM\SOFTWARE\Classes\.zip", "")    ;Backup the .zip file handler
    If @error = 1 Then $zback = -1
    RegWrite("HKLM\SOFTWARE\Classes\.zip", "", "REG_SZ", "CompressedFolder");Let's recall to windows that zips are just zips
        Local $oZip = $oShell.NameSpace($zipFile)
        If @error or not IsObj($oZip) Then exit                 ;something went @#{[[~&^ç!
        Local $oItems = $oZip.Items()
        If @error or not IsObj($oItems) Then exit               ;something went @#{[[~&^ç! or .zip is empty
        For $o in $oItems                                       ;copy all the files 
            If Not IsObj($oFolder.ParseName($o.Name)) Then $oFolder.CopyHere($o); only the files not already existing
        Next
    If $zback = -1 Then     
        RegDelete("HKLM\SOFTWARE\Classes\.zip")
    Else
        RegWrite("HKLM\SOFTWARE\Classes\.zip", "", "REG_SZ", $zback); restore the .zip file handler
    EndIf
Edited by Djé
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...