Jump to content

ZIP.au3 UDF in pure AutoIt


torels
 Share

Recommended Posts

Correct me if i'm wrong, but didn't ElTorro already do this?

I didn't read accurately the post eltorro made.... but looking at the scripts... doesn't it use an external dll ?

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

Well Done torels and thank you for sharing.

The add file or folder function isn't working for me even though.

C:\AutoIt Stuff\zip.au3 (23) : ==> The requested action with this object has failed.: 
$oApp.NameSpace($ZipFile).CopyHere($File2Add) 
$oApp.NameSpace($ZipFile)^ ERROR

You need a Com Error Handler function added so we can debug whats wrong..

Cheers

Link to comment
Share on other sites

Yes

I saw it XD

The problem is that as the script quits the copying process stops... I'm working on a "Pause" kind of thing until the file is added :)

I should be done in 5 minutes :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

Don't know

Anyway... the Path passed as a parameter has to be a full path... even if the zip file is in the same directory of the script

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

Ok now it shoul be working...

I get no errors... and I'm using Win XP SP3... if you have different operating systems and the script does strange things please tell me :)

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 didn't read accurately the post eltorro made.... but looking at the scripts... doesn't it use an external dll ?

Fair enough :)

This looks really good, keep up the good work :P

My scripts:AppLauncherTRAY - Awesome app launcher that runs from the system tray NEW VERSION! | Run Length Encoding - VERY simple compression in pure autoit | Simple Minesweeper Game - Fun little game :)My website

Link to comment
Share on other sites

Fair enough :)

This looks really good, keep up the good work :P

Thanks :D

I'm Working on a single file extraction rather than getting them all extracted now :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

Hi torels,

I have not had chance to try out your script but wanted to say thanks for sharing it with others. I have looked at the source and it looks very professional. Assuming it all works !! it would be great to see this kind of UDF included in a future build of autoit.

All I need to do now is convert some of my scripts to use your code

thanks

My Scripts[topic="73325"]_ReverseDNS()[/topic]Favourite scripts by other members[topic="81687"]SNMP udf[/topic][topic="70759"]Using SNMP - MIB protocol[/topic][topic="39050"]_SplitMon:Section off your monitor!, split your monitor into sections for easy management[/topic][topic="73425"]ZIP.au3 UDF in pure AutoIt[/topic][topic="10534"]WMI ScriptOMatic tool for AutoIt[/topic][topic="51103"]Resources UDF embed/use any data/files into/from AutoIt compiled EXE files[/topic]
Link to comment
Share on other sites

Zip.au3 (63) : ==> ????? "With" ????.:

$on = $oApp.NameSpace($ZipFile).Items.Count

$on = $oApp.NameSpace($ZipFile)^ ERROR

system:winxp sp2

autoitscript:3.2.12.0

You have to provide the full file path for both _ZipCreate and _ZipAddfile, you can't use relative paths.

Link to comment
Share on other sites

Hi torels,

I have not had chance to try out your script but wanted to say thanks for sharing it with others. I have looked at the source and it looks very professional. Assuming it all works !! it would be great to see this kind of UDF included in a future build of autoit.

All I need to do now is convert some of my scripts to use your code

thanks

Agreed. Congrats.

Please consider to propose your UDF to be included to the AutoIt package (http://www.autoitscript.com/autoit3/udfs/UDF_Standards.htm)

Ciao

Peppe

Link to comment
Share on other sites

Looks very good. Just one question. The header for _ZipAddFile() states

$ZipFile - Complete path to zip file that will be created (or handle if existant)

Am I correct in assuming that if I use

;
$zFile = _ZipCreate("C:\My Folder\My_File.zip")
;

That I can then use

;
_ZipAddFile($zFile, "C:\Some Folder\Text_File.txt")
;

As the others have stated these functions could be worthy of inclusion in the standard UDFs but I would see it more as renaming your functions to _File_Zip*() and adding them to the existing File.au3 UDF. You may also have to add more error checking.

With your permission (after I finish testing), I will add them to my Filex.au3 file.

Thanks for the functions.

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

You are indeed!

anyway... I an working on the security and bringing it to standard form of UDF's

I will propose it as soon as I get home this evening as an UDF to come with the installation of autoit :)

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

The Compression is so so.. a bit less than Winrap Compression can you possibly make the compression more even? like same as BEst Winrar compression?

Tested with: AutoIt Version: 3.2.12.0

Works

$ZipFile = @ScriptDir & '\test.zip'
$ZipFile = _ZipCreate($ZipFile)
_ZipAddFile($ZipFile, @ScriptDir & '\101_Jokes_And_Comix.au3')oÝ÷ Ø:²z-Âä6«®æzËë ºË­æ­zǦ¦Ü³â殶­sbb33cµ¦fÆRÒ67&DF"fײb33²b3#·FW7Bç¦b33°¢b33cµ¦fÆRÒõ¦7&VFRb33cµ¦fÆR¥õ¦FDföÆFW"b33cµ¦fÆRÂ67&DF"fײb33²b3#¶b33²·&WGW&ç2F÷FÂçVÖ&W"öbfÆW2÷"fÇ6Râ66RöbfÇW&PoÝ÷ ØDQ9b¥Ió%éÝyø§y×îËb¢tÇU
    ¶b¥Ió%3HÓrLÖß}÷ß}÷ß}÷ý¶®¶­seõ¦Vç¦ÆÂb33cµ¦fÆRÂ67&DF"fײb33²b3#²b33²oÝ÷ ØDQ9D×x­è}©R|â¦åwµÛ§Î*Z»v®¶­sbb33cµ¦fÆRÒ67&DF"fײb33²b3#·FW7Bç¦b33°¥õ¦Vç¦b33cµ¦fÆRÂb33·FW7FfÆRæ§rb33²Â67&DF"
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 again and thank you again :)

Suggestions for some things could be cleaned up and added.

maybe add an optional param to the zip functions for the progress, prompt for overwrite ..etc to be enabled or disabled.

Check that the zipfldr.dll is on the pc and registered before firing the function.

(for some people like myself I had unregistered windows built in zip functionality and realized why my errors were happening, but the error handling in this script didn't help to deduct what was wrong.)

Simple checks that return an error at the start of each function before even creating an object would save a lot of effort in the long run.

Error handling needs a proper Com Error handler with option for console returned debug info of error.

1) So the script doesn't just crash out with object "AutoIt.Error" if com goes wrong.

2) So ppl can see what the com error is.

The returns on the functions would be nice as 0 or 1 for failed or successful

The error return would be nice with varying int for different errors, Example:

@error 1 = zipfldr.dll does not exist or not registered

@error 2 = Invalid Zip file path

@error 3 = Invalid directory/file path to add

@error 4 = Invalid Destination path

@error 5 = Com Error (see debug output for further info)

You could also just add a function for the count of files/folders in the zip and return the count.

A user can call this when they like to work things out.

In the current posted zip.au3 the _ZipCreate($filename) function theres a declared Const but it's not used.

Const $ForWriting = 17

In the current posted zip.au3 the _ZipUnzip($ZipFile, $DestPath) has redundant While loop and array add.

For $item In $oApp.Namespace($ZipFile).Items
        _ArrayAdd($array, $item)
    Next
    
    While 1
        Sleep(500)
        If FileExists($DestPath & "\" & $array[UBound($array) - 1]) Then ExitLoop
    WEndoÝ÷ Ù8^ºÚÈ]Ó~®¶²Ó~¢µé¬¥u·®¶²×tߦ«­¬´ß¨­ziÚá/z{(Ýý²·§¢ÙÞy×[(¶»-¦-籫miÈfz{m¡·®¥Ö­yÛh«Ø^~éܶ*'²ØZ¶,µ×¬r¸zÄáË®*m¡ü¨º»!jÈ+y«i¢×§¶&¥
®ÁÑÞ­íý²Ê&zð«Hæ§iº.¶Þzjm÷®º+rȧiû§rبý½é赧]yÖ¢g«®ájwez¼µ»­Ýý²íìÉ«­¢+Øìôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôô(ìչѥ½¸9µ¸¸¸è}i¥Á}U¹é¥Á¥±(ìÍÉ¥ÁÑ¥½¸¸¸¸¸¸èáÑÉн±È½È¥±½¹Ñ¥¹¥¸i%@É¡¥Ù¸(ìIÅեɵ¹Ð¡Ì¤¸¸èé¥Á±È¹±°É¥ÍÑɽ¸Ñ¡½µÁÕÑÈ(ìMå¹Ñุ¸¸¸¸¸¸¸¸è}i¥Á}U¹é¥Á¥± ÀÌØíÍi¥À°ÀÌØíÍ¥±°ÀÌØíÍ̤(ìAɵÑȡ̤¸¸¸¸èÀÌØíÍi¥À´
½µÁ±ÑÁÑ Ñ¼¸á¥ÍÑ¥¹é¥À¥±Ñ¼áÑÉÐɽ´¸(ìÀÌØíÍ¥±´¥±½È½±È¹µÑ¼áÑÉС¹½ÐÁÑ °©ÕÍ鵤¸(ìÀÌØíÍÌ´
½µÁ±ÑÁÑ Ñ¼¸á¥ÍÑ¥¹½±È½ÈÀÌØíÍ¥±Ñ¼áÑÉÑѼ¸(ìIÑÕɸY±Õ¡Ì¤¸èMÕÍÌ´IÑÕɸĹÉɽÈÀ(쥱ÕÉ´IÑÕɸÀ¹ÍÐÉɽÈÅøÔ(ìÉɽÈÄô%¹Ù±¥i¥À¥±ÁÑ (ìÉɽÈÈô¥±½È½±È¹½Ð½Õ¹¥¸é¥À(ìÉɽÈÌô%¹Ù±¥ÍÑ¥¹Ñ¥½¸ÁÑ (ìÉɽÈÐôIÅÕ¥Éé¥Á±È¹±°½Ì¹½Ðá¥ÍÐ(ìÉɽÈÔôIÅÕ¥Éé¥Á±È¹±°á¥ÍÑÌÕХ̹½ÐÉ¥ÍÑÉ(ìÕÑ¡½È¡Ì¤¸¸¸¸¸¸¸è͵͡±ä(ì9½ÑÌè$$$(ì(ìôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôô)Õ¹}i¥Á}U¹é¥Á¥± ÀÌØíÍi¥À°ÀÌØíÍ¥±°ÀÌØíÍ̤(%1½°ÀÌØí11
¡¬ô}i¥Á}±±
¡¬ ¤(%%ÀÌØí11
¡¬±ÐìÐìÀQ¡¸IÑÕɸMÑÉÉ½È ÀÌØí11
¡¬°À°À¤ì¥±ÉÅեɵ¹Ð½é¥Á±È¹±°(%%9½Ð¥±á¥ÍÑÌ ÀÌØíÍi¥À¤Q¡¸IÑÕɸMÑÉÉ½È Ä°À°À¤ì%¹Ù±¥i¥ÀÁÑ (%%9½Ð¥±á¥ÍÑÌ ÀÌØíÍ̤Q¡¸IÑÕɸMÑÉÉ½È Ì°À°À¤ì%¹Ù±¥ÍÑ¥¹Ñ¥½¸ÁÑ ($(%1½°ÀÌØí½M¡±°°ÀÌØí½i±È(($ÀÌØí½M¡±°ô=©
ÉÑ ÅÕ½ÐíM¡±°¹ÁÁ±¥Ñ¥½¸ÅÕ½Ðì¤($ÀÌØí½i±ÈôÀÌØí½M¡±°¹9µÍÁ ÀÌØíÍi¥À¤(½ÈÀÌØí½%Ñ´%¸ÀÌØí½i±È¹%ѵÌ($%ÀÌØí½%Ñ´¹¹µôÀÌØíÍ¥±Q¡¸(ÀÌØí½M¡±°¹9µÍÁ ÀÌØíÍ̤¹
½Áå!É ÀÌØí½i±È¹AÉÍ9µ ÀÌØíÍ¥±¤¤($$%IÑÕɸMÑÉÉ½È À°À°Ä¤íMÕÍÌ($%¹%(%9áÐ((%IÑÕɸMÑÉÉ½È È°À°À¤ì¥±¹½Ð¥¸é¥À)¹Õ¹((ìôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôô(ì}i¥Á}±±
¡¬ ¤Õ¹Ñ¥½¸Ñ¼¡¬Ñ¡ÍåÍÑ´¡ÌÑ¡é¥Á±È¹±°¹¥ÐÌäíÌÉ¥ÍÑɸ(ìôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôô)Õ¹}i¥Á}±±
¡¬ ¤(%%9½Ð¥±á¥ÍÑÌ¡MåÍѵ¥ÈµÀìÅÕ½ÐìÀäÈíé¥Á±È¹±°ÅÕ½Ðì¤Q¡¸IÑÕɸÐ(%%9½ÐII ÅÕ½Ðí!-e}
1MMM}I==PÀäÈí
1M%ÀäÈííàá

ÀµÝÌ´ÄÅĵåÀ´ÀÁÀÀØÁÌÅôÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ðì¤Q¡¸IÑÕɸÔ(%IÑÕɸÀ)¹Õ¹
Edited by smashly
Link to comment
Share on other sites

Ok!

I fixed a few things (And also added smashly's error handler :)) and uploaded the new script...

It now has _Zip_Count() and _ZipList() functions, respectively counting and listing all the files in the zip archive :P

_Zip_List() returns an array obviously :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...