Jump to content
eltorro

Zip plugin

Recommended Posts

The plugin code is using a recursive dir search to get the file names, so I would expect some loading. How many files are you talking about? It's probably possible to throw some sleep into the function without to much effort. As for pausing the action, right now it is not possible as there is not any mouse or keyboard support in the plugin. I'll look into adding some kind of handler.

Thanks.

I am using your plugin to automate archiving of our design files. There are a 100+ directories that are archived to individual zip files regularly as they are modified, updated, add to, etc. Some of these directories may contain as many 200+ files in numerous sub-directories. The recursive search and depth of directory tree would explain the load I guess. Not a big deal really, I just have it run and the end of the day instead of having the other engineers update the archive themselves when they make changes. Was just wondering if there was an easy solution I could do on my end.

Regards,

Mike

Share this post


Link to post
Share on other sites

I added some sleep in the recursive search. I tested it on my python folder and after an initial peak, it drops in cpu usage ( according to task manager).

Share this post


Link to post
Share on other sites

Hmm, looks like the first download link still returns a corrupt zipfile. Winzip failed to unpack it with:

Cannot open file: it does not appear to be a valid archive.

The second (mytempdir) link downloaded a valid archive but failed to build the test script PluginZip.au3 with:

C:\Au3Zip\bin\PluginZip.au3(98,46) : ERROR: _ZipList2Array(): undefined function.

C:\Au3Zip\bin\PluginZip.au3(175,140) : ERROR: _ZipGetRatio(): undefined function.

C:\Au3Zip\bin\PluginZip.au3(198,54) : ERROR: _ZipItemInfo2Array(): undefined function.

Am I missing the appropriate download link somewhere? Thanks.

Share this post


Link to post
Share on other sites

Hmm, looks like the first download link still returns a corrupt zipfile. Winzip failed to unpack it with:

Cannot open file: it does not appear to be a valid archive.

The second (mytempdir) link downloaded a valid archive but failed to build the test script PluginZip.au3 with:

C:\Au3Zip\bin\PluginZip.au3(98,46) : ERROR: _ZipList2Array(): undefined function.

C:\Au3Zip\bin\PluginZip.au3(175,140) : ERROR: _ZipGetRatio(): undefined function.

C:\Au3Zip\bin\PluginZip.au3(198,54) : ERROR: _ZipItemInfo2Array(): undefined function.

Am I missing the appropriate download link somewhere? Thanks.

The main link is now working correctly again. I have an random problem with the download manager corrupting the file when it transfers it.

Barring any problems ($$), I can get a new server and have it setup by the fall.

The link on "mytempdir" contained the old include file. I have uploaded the correct zip to another file sharing service "www.bestsharing.com". "mytempdir" has too much stuff (polite word) popping up.

Share this post


Link to post
Share on other sites

Allowing for the possiblity that I'm just plain dumb...

The PlugInZip you included in the zip file seems to work properly (adds and extracts files properly) in all ways except for one:

When it attempts to pull the information from the zip file, I get nothing but zeroes:

_ZipGetList("test.zip")

_ZipGetList:return code>0

_ZipGetCount("test.zip")

_ZipGetCount:return code>4

File List

Index:0

Name :0

Atime:0

Ctime:0

Mtime:0

CSize:0

USize:0

Index:0

Name :0

Atime:0

Ctime:0

Mtime:0

CSize:0

USize:0

I'm running as it came out of the archive, except for pointing it at the paths of files on my drive. I made sure I downloaded it from both links and got the same results from both... Please help, this is exactly what I need for my current project :whistle:

Share this post


Link to post
Share on other sites

Allowing for the possiblity that I'm just plain dumb...

The PlugInZip you included in the zip file seems to work properly (adds and extracts files properly) in all ways except for one:

When it attempts to pull the information from the zip file, I get nothing but zeroes:

_ZipGetList("test.zip")

_ZipGetList:return code>0

_ZipGetCount("test.zip")

_ZipGetCount:return code>4

File List

Index:0

Name :0

Atime:0

Ctime:0

Mtime:0

CSize:0

USize:0

Index:0

Name :0

Atime:0

Ctime:0

Mtime:0

CSize:0

USize:0

I'm running as it came out of the archive, except for pointing it at the paths of files on my drive. I made sure I downloaded it from both links and got the same results from both... Please help, this is exactly what I need for my current project :whistle:

I'm not clear if your running the test script included with the download or your own script on the test archive inside the download.

I download it to a computer here that had no previous installation of the plugin and it works for me here. (changed the relevant paths of course) .

Can you give me a little more info?

Share this post


Link to post
Share on other sites

I'm not clear if your running the test script included with the download or your own script on the test archive inside the download.

I download it to a computer here that had no previous installation of the plugin and it works for me here. (changed the relevant paths of course) .

Can you give me a little more info?

I'm running exactly the test script that came with the program. And I followed it's progress, it makes a .zip file, puts files into it, and later extracts them, all correctly. But the part of the test script that reads the content of the .zip file to display it returns all zeroes...

But, nevermind, because I just moved to the newest version of autoit beta and now everything IS working correctly. Sorry for posting before checking that.

Share this post


Link to post
Share on other sites

The moment you've all been waiting for [drum roll...] (yeah, right)

Zip Plugin for AutoIt V3.

It adds the following functions:

  • _Zip...
Based on ZLib and Info-Zip code condensed by Lucian Wischik. See this CodeProject.

I don't have enough space left to upload it to the forum so the file is hosted here. downloads:Posted Image

I also uploaded a copy to a free file hosting service: Au3ZipPlugin.

Enjoy,

eltorro

Hello -

I tried to use for Unzip and after reading a lot in the forum it works.

When calling

$Ret = _ZipUnZip($ZipFile,"f:\tmp")

in $Ret I get back 0, OK.

If the destination-directory is not existing, it cames back with 1280, if a file cannot be overwritten, it comes back wit 512 ... seems working properly.

Iif $ZipFile or it's path is not existing, I also get back 0 - I can make a workaround with FileExists.

BUT, heavy: If the $ZipFile is *not* a ZipFile or is corrupt, my Test.exe crashes down immediatly and there is no chance for handling this situation :-(

Any idea about - some times my ZipFile coming automatcally with AutoITs 'InetGet' is wrong and I need to know.

Manfred

Share this post


Link to post
Share on other sites

If the $ZipFile is *not* a ZipFile or is corrupt, my Test.exe crashes down immediatly and there is no chance for handling this situation :-(

Manfred

I implemented a zip check function some time ago as someone was trying to open a rar archive and it was crashing. The return value is still zero but @error returns 1792.

Do you have an example (corrupt zip) I could test with?

Edit: I'm thinking of changing the return value to 1792 also. This would be in line with everything else.

Edited by eltorro

Share this post


Link to post
Share on other sites

I implemented a zip check function some time ago as someone was trying to open a rar archive and it was crashing. The return value is still zero but @error returns 1792.

Do you have an example (corrupt zip) I could test with?

Edit: I'm thinking of changing the return value to 1792 also. This would be in line with everything else.

Hello -

I pack it completely, teste-ZIP.au3 is my test I made, compiled it wit 3.2.4.9.

The original ZIP is tarife_20070721.zip-original, I split by using HJSplit, renamed and try to unpack the first part - may be the same as a broken download.

It's different, within XP-Sp2 it breaks down without anything, in Win2000 the exe goes down with DrWatson - see the log!

Ooops, to big (453 kB) for Attach, please download my Test there:

http://rapidshare.com/files/44623330/crash.zip.html

Share this post


Link to post
Share on other sites

Hello -

I pack it completely, teste-ZIP.au3 is my test I made, compiled it wit 3.2.4.9.

The original ZIP is tarife_20070721.zip-original, I split by using HJSplit, renamed and try to unpack the first part - may be the same as a broken download.

It's different, within XP-Sp2 it breaks down without anything, in Win2000 the exe goes down with DrWatson - see the log!

Ooops, to big (453 kB) for Attach, please download my Test there:

http://rapidshare.com/files/44623330/crash.zip.html

My initial thought after reading this post is that spanning a zip file this way will not work. Testing with WinZip and IzArc will not open it either. However neither crash. The corruption comes in the form of the missing header which is in one of the split files.

Re-assembling the file and then unzipping it works fine.

I have tried with a true spanned zip created by WinZip and as I suspected, it returned an error (no crash). The code does not support spanned archives.

A brief look at the unzip code shows that Lucian Wischik has some provision to handle a corrupt headers. I still need to track down whether the crash is from the unzip code or plugin wrapper functions.

Share this post


Link to post
Share on other sites

The crash is now fixed. Updated the uploads in the first post.

Any feedback is welcome.

p.s. This plugin will not open spanned archives. This is a limitation of the zip/unzip code.

Share this post


Link to post
Share on other sites

The crash is now fixed. Updated the uploads in the first post.

Any feedback is welcome.

p.s. This plugin will not open spanned archives. This is a limitation of the zip/unzip code.

Share this post


Link to post
Share on other sites

Any feedback is welcome.

p.s. This plugin will not open spanned archives. This is a limitation of the zip/unzip code.

Hello -

with spanned archives may be a missunderstanding. I have automatic-jobs for getting some files from http or ftp. Some times the download breaks down and so I get a broken / incomplete zip-file. In this case, my unzip-test crashes.

With splitting the file I tried to simulate this situation, I don' need to handle split--files. You have seen: With the chunk .001 it breaks down, with the other parts it comes back with an errorlevel so I can handle the job properly.

The crash is now fixed. Updated the uploads in the first post.

Many thanks, at the weekend I will try!

Regards

Manfred

Share this post


Link to post
Share on other sites

The crash is now fixed. Updated the uploads in the first post.

Since about two weeks it runs in my 'productive' environment and it works!

I only use

$handle = PluginOpen(@ScriptDir&"\Au3Zip.dll")

to unpack / see how much files are inside the zip, many thanks again!

Best regards

Manfred

Share this post


Link to post
Share on other sites

Works with .rar files?

Edit: " No. there is not rar or 7zip support. Just plain old zip."

Edited by walle

Share this post


Link to post
Share on other sites

Thanks for the good work! In XP, this runs fine.

But, when running the same compiled script that works perfectly fine on XP, in a win98 test box, I get the error:

Line -1

Error: unknown function name

When I # out the two _ZipUnZipItem commands that the script contains, it finishes with no error (but doesn't do what I need either :)).

Could it be that this dll plugin thing doesn't work with 98?


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites

Thanks for the good work! In XP, this runs fine.

But, when running the same compiled script that works perfectly fine on XP, in a win98 test box, I get the error:

Line -1

Error: unknown function name

When I # out the two _ZipUnZipItem commands that the script contains, it finishes with no error (but doesn't do what I need either :) ).

Could it be that this dll plugin thing doesn't work with 98?

I don't have a win98 machine to test on so I really don't know sure. I am assuming that your compiling your script as ANSI in order to run it on win98, yes.

Share this post


Link to post
Share on other sites

I don't have a win98 machine to test on so I really don't know sure. I am assuming that your compiling your script as ANSI in order to run it on win98, yes.

Thanks, but I had indeed ANSI compiled it. Otherwise it didn't run at all, as I quickly found out... :) We used a protozoic 98 machine and VPC to test but it failed to run (XP vpc worked fine though).

Is it stupid to suspect the C code behind the plugin uses the XP internal zip engine (or whatever it's called, and which 98 does not have)? Then it would be a logical consequence...

I am not anywhere near adept enough in C code to immediately know where to look for this, and the sources are LOADED with comments. Reading it all would take me MUCH time, which would make me go look for another, quicker solution which can also be done (scripting some zip program to do actions is also very feasible in AutoIt), but if anyone already knows this then I would be happy to hear.


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites

Thanks, but I had indeed ANSI compiled it. Otherwise it didn't run at all, as I quickly found out... :) We used a protozoic 98 machine and VPC to test but it failed to run (XP vpc worked fine though).

Is it stupid to suspect the C code behind the plugin uses the XP internal zip engine (or whatever it's called, and which 98 does not have)? Then it would be a logical consequence...

I am not anywhere near adept enough in C code to immediately know where to look for this, and the sources are LOADED with comments. Reading it all would take me MUCH time, which would make me go look for another, quicker solution which can also be done (scripting some zip program to do actions is also very feasible in AutoIt), but if anyone already knows this then I would be happy to hear.

It does not use xp internal zip engine. It uses an engine built on zlib. I suspect that it might be possible that there is an API call that is not backwards compliant to win98. I'll have to look at the the code very carefully, as I think I used a call from shlwapi.dll. This would only be a problem if IE explorer has not been updated (I'd have to look on MSDN for more info). This would not be a problem from 2k on up.

Ok, I rebuilt the dll to remove the call. Please try this dll and post back.

Au3Zip.dll

Edited by eltorro

Share this post


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

×
×
  • Create New...