Jump to content

ZIP.au3 UDF in pure AutoIt


torels
 Share

Recommended Posts

.... ummm torels :)

It pays to do a search first - you would have then discovered that this has all been done back in January 2006 by Mozart90, eltorro, erifash, PsaltyDS & others.

SEE THIS POST

I haven't scrutinised your version to see if you've added or missed anything, but a lot of us have been using most of this for some time. :mad:

I'm not denigrating the work you've done - all work, experience & practice is beneficial. But maybe you could have spent your time on something else if you'd done a simple search? :D

I just wrote a ZIP udf in AutoIt (without external files) which lets you create archieves, fill them with files and folders and extract them to your computer :P

these are the functions

Edit: UPDATED

_ZipCreate($filename);returns the handle of the zip file (if function is assigned to a variable)
 _ZipAddFile($ZipFile, $File2Add, $flag);sets @error to 1-2-3 in case of failure
 _ZipAddFolder($ZipFile, $Folder, $flag);sets @error to 1-2-3 in case of failure
 _ZipUnzipAll($ZipFile, $DestPath, $flag);sets @error to 1-2-3 in case of failure
 _ZipUnzip($ZipFile,$FileName, $DestPath, $flag);sets @error to 1-2-3 in case of failure
 _Zip_Count($ZipFile);Count items in zip
 _Zip_List($ZipFile);list all files in the zip file

Any other suggestions ?

Comments are welcome :P

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

@TheSaint - A little late (see post 14)

I just think you are reinventing the wheel when PSaltyDS already made the same UDF:

#198585

Searching ZIP in the forum nothing of that came out!

Anyway... think I'll just drop the thing then...

Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

Link to comment
Share on other sites

I certainly would rather see you continue and build upon what others have done to create something even better. So long as you are improving on what what was already there and give credit where credit is due you'll get cheers instead of jabs.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

I certainly would rather see you continue and build upon what others have done to create something even better. So long as you are improving on what what was already there and give credit where credit is due you'll get cheers instead of jabs.

Dale

You're Right! :)

thanks

Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

Link to comment
Share on other sites

@TheSaint - A little late (see post 14)

I did see that, but it appeared to have been overlooked so I just added it again with more info. :P

@torels I agree with DaleHohm that if you are adding improvements then keep at it man - especially if you can add a password feature ... that would be nice! :P

:)

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

Another count functions you could add.

The total count of files and folders contained in the zip (including sub directories and their files).

Presently the count function you use only gives a count of files & folders in the root of the zip.

Here's an example that returns the total file & folder count including sub directories, (no error checks, leave it to you if your interested or not)

Func _Zip_TotalCount($sZip)
    Local $oShell, $oDir, $sZipInf
    $oShell = ObjCreate("Shell.Application")
    $oDir = $oShell.NameSpace(StringLeft($sZip, StringInStr($sZip, "\", 0, -1)))
    $sZipInf = $oDir.GetDetailsOf($oDir.ParseName(StringTrimLeft($sZip, StringInStr($sZip, "\", 0, -1))), -1)
    Return StringMid($sZipInf, 28, StringInStr($sZipInf, @LF, 0, 1) - 28)
EndFunc

Cheers

Link to comment
Share on other sites

Any other suggestions ?

Comments are welcome :)

Great! I was looking for this for a long time. Could you please add a function for searching a string inside zipped files? I need that to make a frontend of a simple backupprogram. TIA!

Katrijn.

Link to comment
Share on other sites

Great! I was looking for this for a long time. Could you please add a function for searching a string inside zipped files? I need that to make a frontend of a simple backupprogram. TIA!

Katrijn.

excuse me... what do you mean exactly ?

like extracting a file and searching a string in it or searching for a file matching with the string you pass to the function ??

Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

Link to comment
Share on other sites

Yes, I meant your first option:

like extracting a file and searching a string in it

So to search certain sentences in TXT-files that are archived. But aren't there algorithms that sort of 'extract as they search'? I think WinRAR uses this because its searching is so incredibly fast or is it extracting the data first? It's a pity 7-Zip doesn't have a searchfunction at all.

Link to comment
Share on other sites

Yes, I meant your first option:

So to search certain sentences in TXT-files that are archived. But aren't there algorithms that sort of 'extract as they search'? I think WinRAR uses this because its searching is so incredibly fast or is it extracting the data first? It's a pity 7-Zip doesn't have a searchfunction at all.

Here is a news flash for you. WinRAR uses the 7zip engine. The functionality you are asking for could be incredibly slow using the shell zip.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Yes, I meant your first option:

So to search certain sentences in TXT-files that are archived. But aren't there algorithms that sort of 'extract as they search'? I think WinRAR uses this because its searching is so incredibly fast or is it extracting the data first? It's a pity 7-Zip doesn't have a searchfunction at all.

With no need to write a whole function... you could simply get all files in the zip, extract one by one and search the file once it is extracted and move on to the next file :)

I think it's the only way anyway

Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

Link to comment
Share on other sites

by the way... 2 new updates arriving...

1) _Zip_Search

2) _Zip_SearchInFile (the func katinjn88 said)

to do list:
---------------------------------------------
- Find a way to delete a file... no such func in shell.application OBJ
- Try and add a password to zip files (think it is clear in the code :D)

Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

Link to comment
Share on other sites

Tested 2 functions with autoit 3.2.10.0

_Zip_Create - works but sometimes displays Adding files Gui, that looks similar to Windows moving files dialog if you add loads of files & if you click any keyboard button then cancel button on the GUI is pressed & i donno what happens then, adding file aborted?

_Zip_AddFolder - Has never worked, & nor it works now out of my folder with 50 files, first tile it added only 5 & on second attempt it added 10 files & created L1a02796 file in same dir as my New folder ( after I renamed it to .rar it turned out to be a compressed (& contained 11 files) but incomplete file. unexpected end of archive said winrar)

Edit: I forgot, you may want to add UTF-8 Support to do so create Zip.au3 with fileOpen (Flag =128) & paster your original Zip.au3 code there & for test.zip create it in a same way i guess.Just switching encoding mode in scite wont work, i tried, your au3 file must be in UTF-8 format already when opened in scite

Edited by goldenix
My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]
Link to comment
Share on other sites

Hi there!

I just wrote a ZIP udf in AutoIt (without external files) which lets you create archieves, fill them with files and folders and extract them to your computer muttley

these are the functions

Edit: UPDATED 30/6/2008

_ZipCreate($filename);returns the handle of the zip file (if function is assigned to a variable)
_ZipAddFile($ZipFile, $File2Add, $flag);sets @error to 1-2-3 in case of failure
_ZipAddFolder($ZipFile, $Folder, $flag);sets @error to 1-2-3 in case of failure
_ZipUnzipAll($ZipFile, $DestPath, $flag);sets @error to 1-2-3 in case of failure
_ZipUnzip($ZipFile,$FileName, $DestPath, $flag);sets @error to 1-2-3 in case of failure
_Zip_Count($ZipFile);Count items in zip
_Zip_List($ZipFile);list all files in the zip file
_Zip_Search($ZipFile, $SearchString);search for files matching with the given parameter (no wildcards yet)
_Zip_SearchInFile($ZipFile, $SearchString);search for words matching the given parameter in all of the zip archive's files

Comments are welcome :)

previous number of downloads: 187

w00t! great stuff!

I found a typo in your source files however - through me off for a sec. You have two _Zip_Count() descriptions - the second should be _Zip_List() - the function names are correct, but their description names are wrong :( nothing major.

Thanks sooo much for these!

Monkeh.

Link to comment
Share on other sites

Just had a go with _Zip_Search.

No matter what file I fed it to search for, it set @error=0. Always. I tried to debug a little but I ended up pulling my hair out. looks like the _ArrayAdd isn't doing anything in the code?

I can't tell, I'm not experienced enough. Either way, I couldn't get search to work muttley

Link to comment
Share on other sites

  • 3 weeks later...

This is really nice... Maybe you can add a _zipaddpassword...

:P

I've been searching for it but there's no such thing in the shell.application COM object.

Think I'll have to find an alternative... but Passwords aren't written clear in the zip's code :P

Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...