Jump to content

ZIP UDF (zipfldr.dll library)


Recommended Posts

  • Replies 221
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

Here is the rewritten version of this UDF. See my comments HERE. Please test the shit out of this thing. It was a major headache, and I want to make sure I didn't miss something. Thanks! Update 20

Replace the _IsFullPath() function in ZIP.au3 with this one Func _IsFullPath($sPath) If StringRegExp($sPath, '^([a-zA-Z]\:|\\\\[^\/\\:*?"<>|]+\\[^\/\\:*?"<>|]+)(\\[^\/\\:*?"<>

Posted Images

Still dosen't work here's the code.

The only thing i want is to show me the name of the file (inside the zip is a .xml file for example test.xml) and i want to have acces to read some data from the .xml file

Thank you (The problem is i have some problems with array's and i don't understand them to well)

#include <Zip.au3>
#include <Array.au3>
Local $Array[2]

$array = _Zip_List("c:\logs\Test.zip")
$array[0] = MsgBox(0,"work",$Array)
$array[1] = Msgbox(0,"Work",$Array)
Link to post
Share on other sites

Off topic

Thank you for the tutorial but usually im using the help file that's included with the autoit. And i understand that Array it's a big variable that differs only the numbers.

But usually im getting stuck cause it's hard for me for now.. to understand what goes were

But thank you for the link

Example:

Edit on topic;

Seems like it's working but it dosen't show me the name only the count 1

#include <array.au3>

Local $Me[9]
$me[0] = "Hello"
$Me[1] = "Can"
$me[2] = "you"
$Me[3] = "help"
$Me[4] = "me"
$Me[5] = "With"
$me[6] = "The"
$me[7] = "zip"
$me[8] = "file"

_ArrayDisplay($me, "$me set manually 1D")
Edited by mircea
Link to post
Share on other sites

_Zip_List works for me. Is your XML file in the root of the zip file? _Zip_List only lists files in the root of the zip. This behavior is documented in the function header. If you want read access, you need to extract the file. Also, please don't make this thread about teaching you how to use arrays. Post that kind of question in the General forum.

Link to post
Share on other sites

#include <Zip.au3>
#include <Array.au3>
Local $Array[2]

$array = _Zip_List("c:\logs\Test.zip")
$array[0] = MsgBox(0,"work",$Array)
$array[1] = Msgbox(0,"Work",$Array)

This is entirely ridiculous and your problem has nothing to do with my UDF. Read the help file and learn to use arrays. Post any further questions in the General forum. Edited by wraithdu
Link to post
Share on other sites
  • 2 weeks later...

First let me say thank you for this script, it is very helpful. :unsure:

I have tried digging around to find out how to use some of the features but as of yet have not found any. For example, in the _Zip_Additem function one of the flags indicates it will show a progress box with no file name, however I can't seem to get it to show up. Is there any further help anywhere or examples of how to use the functions?

I also have a compatibility issue with this UDF and the IE UDF. When both are included in a script, I get warnings for the two functions; _IEAttach and __IEIsObjType. The warnings read like:

IE.au3 V2.4-0 Warning from function _IEAttach, Cannot register internal error handler, cannot trap COM errors (Use _IEErrorHandlerRegister() to register a user error handler)

Everything still seems to work, but thought I would mention it.

Link to post
Share on other sites

1) The flags are general flags for the Shell.Application object's CopyHere method. Not all of these flags seem to be supported by the zipfldr.dll library and I can't find any clear documentation describing the library's specific behavior. You'll just have to experiment, YMMV.

2) My UDF also registers a COM error handler like the IE UDF. I guess the IE UDF isn't very graceful when there's already a COM error handler registered. Try #include 'ing the IE UDF before mine, and mine should handle it better. Or, as you said, ignore the IE warnings, unless there's some special functionality in the IE UDF error handler that you need to retain.

Link to post
Share on other sites
  • 1 month later...

I want to start by saying thanks for the great UDF. It is going to make my life easier.

I do have a problem with _Zip_UzipAll function when using flags. The problem seems for me is when the directory and files already exist. The pop-up message for me is to over write "yes" or "yes for all" keeps coming up. I am using the flag of 16+256=272.

RUN . . . Slide . . . TAG . . . Your out . . . PAINTBALL !!!

Link to post
Share on other sites
  • 2 weeks later...

Hi All,

I am trying to add entire folder and files and sub-folder into zip but its not happen the zip is created but stays empty , must be somthing i did worng.

please advise

#Include <Zip.au3>
$Zip = _Zip_Create(@ScriptDir & "\LOGS_.ZIP")
 _Zip_AddItem($Zip, "C:\pspad\licence_cz (2).txt")
Link to post
Share on other sites

I advise you read the UDF header. Then carefully read the function headers to understand how to add a file to a specific subfolder inside the zip.

However your code snippet is not adding a folder, just a text file. Are you getting some other error there?

Edited by wraithdu
Link to post
Share on other sites
  • 4 weeks later...

I am using the zip UDF dated 2010-08-07 and found that on XP computers all folders are getting some type of file that looks like a GUID {EF9FD7B5-94C9-41BE-BE69-FF72B330B5A1} any ideas why these are being created? This does not occur on a windows 7 computer.

Any help would be appreciated.

Thanks,

Rob

Link to post
Share on other sites

Hmm. I remember now why those files are created, but they should be deleted as well. This means that a call to _Zip_InternalDelete() is failing. As it works here, we'll have to do some troubleshooting. The function lives on line 786, and is called in the _Zip_AddItem() function from line 132.

Can you change line 132 to:

If $sTempFile <> "" Then
        Local $debug = _Zip_InternalDelete($sZipFile, $sTempFile)
        ConsoleWrite("debug: " & $debug & " : " & @error & @CRLF)
    EndIf

and paste the output? It should show an error, just have to figure out why.

Also, can you post some simple code that is causing the problem?

Edited by wraithdu
Link to post
Share on other sites

I wrote a quick routine to try and delete the files but that fails to successfully delete on the XP machines too (works on Win7).

#cs
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++ Search for GUID type of files and remove from zip (XP OS issue)   +++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#ce

$ZSearchGUID = _Zip_Search($LZPOSPath & "\LogArchive\" & $Datefn & "\" & $Datefn & ".zip", "{")
if @error or $ZSearchGUID = 0 Then
    msgbox(0,"Error",$ZSearchGUID)
    ;on error or no files do nothing.
Else
    _ArrayDisplay($ZSearchGUID,"Files in Zip")
    ;process files found and remove from zip
    for $i = 1 to $ZSearchGUID[0]
                         $ZDelete = _Zip_InternalDelete($LZPOSPath & "\LogArchive\" & $Datefn & "\" & $Datefn & ".zip", $ZSearchGUID[$i])   ;delete without confirmation
                         If @error Then
                             msgbox(0,"Delete error",$ZSearchGUID[$i] & " " & $ZDelete)
                         EndIf
                     next
EndIf

In this case it is returning a zero (0) and from the @error condition 7 - Destination ZIP file does not exist.

Edited by RobK
Link to post
Share on other sites

The error returned from _Zip_InternalDelete is different than the other functions (hence marked as internal). In this case, it means that the file was not deleted. I'll look into this further tomorrow on some older XP machines here at work (all my main machines are Win7 now, as well as my home computers), and try and find out where exactly it is failing. Truthfully I need to add a bit more error checking in that function.

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...