Jump to content

ZIP.au3 UDF in pure AutoIt


torels
 Share

Recommended Posts

I actually don't kow why...

It could depend on the shell version... but I don't have the faintest idea on how to retrieve it...

anyway... I meant 3.2.12.1 before... not 2.12.0.1 XD

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

Is there any possibility just to store a file or folder (without compression) to a ZIP archive?

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

nope

zip udf uses microsoft's shell extension... that has hardly any setting :P

cheers

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

  • 2 weeks later...

Zip UDF Updated!

ChangeLog:
New Function : _Zip_CountAll() that counts all elements in the archive. Including SubDirectories

ToDo List:
Add a virtual archive 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

I got a question about lines 144-146 (in function _Zip_AddFolderContents):

While 1
    If _Zip_Count($hZipFile) = ($files+$oFC) Then ExitLoop
WEnd

For what is this exactly? Can you explain me?

Thanks,

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

I got a question about lines 144-146 (in function _Zip_AddFolderContents):

While 1
    If _Zip_Count($hZipFile) = ($files+$oFC) Then ExitLoop
WEnd

For what is this exactly? Can you explain me?

Thanks,

UEZ

it is a way to let the script "pause" until everything isn't zipped

otherwise it fails zipping big files.

Think I'm gonna change that in a while, using the more appropriate function _Zip_CountAll()

the $read variable... My fault! :(:mellow:

Anyway it's just a warning... the script works the same :)

Edited by torels

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

it is a way to let the script "pause" until everything isn't zipped

otherwise it fails zipping big files

the read variable... My fault! :mellow:

Why is this method not working properly?:

Do
 Sleep(100)
Until $oCopy.NameSpace($hFolder).Items.Count = $oCopy.NameSpace($hZipFile).Items.Count

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

I actually didn't try that :mellow:

anyway the while 1 method is working fine so I'll stick to that one :(

obviously you are free to make any change/experiment you want with the code...

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

@UEZ: In the former version of the "Zip.au3" you are absolutely right that an error occurs during the compilation process. You have to add only the line (in the beginning of the Zip.au3).

[...]

Global $read

[...]

After this simple change everything works like it should work...

:(

In the new version (2008.11.06) no change is required...

@torels: Really good idea to spend some time on the zip topic...

At the moment I'm trying to set a password on the zip file, but this aspect seems to be not easy... :mellow:

Any idea(s) ???

Link to comment
Share on other sites

yes

The password is written in the code some way... (dont' ask me how). I remember a program I saw which extracted passwords from the code...

I tried to work out a way to write/read a password but I got nothing :mellow:

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

#include "c:\.develope\AutoIT\.modules\Zip.au3"
dim $zip=@ScriptName&" at "&@YEAR&"-"&@MON&"-"&@MDAY&" "&@HOUR&"_"&@MIN&"_"&@SEC&".zip"
    dim $zf=_Zip_Create($zip) 
    _Zip_AddFile($zf,"C:\boot.ini")

>"c:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\.develope\AutoMate\.Bank\Balances.staff\test.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams

+>15:33:10 Starting AutoIt3Wrapper v.1.10.1.8 Environment(Language:0419 Keyboard:00000409 OS:WIN_XP/Service Pack 3 CPU:X86)

>Running AU3Check (1.54.13.0) from:C:\Program Files\AutoIt3

+>15:33:10 AU3Check ended.rc:0

>Running:(3.2.12.0):C:\Program Files\AutoIt3\autoit3.exe "C:\.develope\AutoMate\.Bank\Balances.staff\test.au3"

c:\.develope\AutoIT\.modules\Zip.au3 (302) : ==> Object referenced outside a "With" statement.:

$hList = $oApp.Namespace($hZipFile).items

$hList = $oApp.Namespace($hZipFile)^ ERROR

->15:33:10 AutoIT3.exe ended.rc:1

>Exit code: 1 Time: 1.896

it seems to me that problem is that code try to get files list from blank zip file

Link to comment
Share on other sites

#include "c:\.develope\AutoIT\.modules\Zip.au3"
     dim $zip=@ScriptName&" at "&@YEAR&"-"&@MON&"-"&@MDAY&" "&@HOUR&"_"&@MIN&"_"&@SEC&".zip"
         dim $zf=_Zip_Create($zip) 
         _Zip_AddFile($zf,"C:\boot.ini")

>"c:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\.develope\AutoMate\.Bank\Balances.staff\test.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams

+>15:33:10 Starting AutoIt3Wrapper v.1.10.1.8 Environment(Language:0419 Keyboard:00000409 OS:WIN_XP/Service Pack 3 CPU:X86)

>Running AU3Check (1.54.13.0) from:C:\Program Files\AutoIt3

+>15:33:10 AU3Check ended.rc:0

>Running:(3.2.12.0):C:\Program Files\AutoIt3\autoit3.exe "C:\.develope\AutoMate\.Bank\Balances.staff\test.au3"

c:\.develope\AutoIT\.modules\Zip.au3 (302) : ==> Object referenced outside a "With" statement.:

$hList = $oApp.Namespace($hZipFile).items

$hList = $oApp.Namespace($hZipFile)^ ERROR

->15:33:10 AutoIT3.exe ended.rc:1

>Exit code: 1 Time: 1.896

it seems to me that problem is that code try to get files list from blank zip file

As far as I understood this happens when the external ZIP process has finished and the code is still trying to get information from the object.

That's why I asked in on of the previous posts how the "wait for finishing" is working.

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

First of all... @scriptname isn't a path!

You need a full path to get the whole thing going :mellow:

cheers

I'll try and let you know anything I can learn on that while problem

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

First of all... @scriptname isn't a path!

You need a full path to get the whole thing going :mellow:

cheers

I'll try and let you know anything I can learn on that while problem

dim $zip=@ScriptName&" at "&@YEAR&"-"&@MON&"-"&@MDAY&" "&@HOUR&"_"&@MIN&"_"&@SEC&".zip"

makes $zip like "test.au3 at 2008-11-11 15_41_42.zip"

after that

dim $zf=_Zip_Create($zip)

succesfully creates such file as "test.au3 at 2008-11-11 15_41_42.zip" filesize 22 bytes

go on

Link to comment
Share on other sites

you need a FULL path to let anything else work.

Something like C:\somedirectory\SomeSubDirectory\ThisIsAFullPath\myfile.zip

And not just myfile.zip

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

full file path solve the problem

thx a lot

#include "c:\.develope\AutoIT\.modules\Zip.au3"

dim $zip=@ScriptDir&"\"&@ScriptName&" at "&@YEAR&"-"&@MON&"-"&@MDAY&" "&@HOUR&"_"&@MIN&"_"&@SEC&".zip"
dim $zf=_Zip_Create($zip) 
_Zip_AddFile($zf,"C:\boot.ini",0)
Edited by Dudka
Link to comment
Share on other sites

you're welcome! :mellow:

Anyway I'll add a Check function to see if the passed param is a file in the next release. I won't release it now because the last release was released few days ago. For Anyone interested here is the function I wrote:

Func _IsFullPath($path)
    if StringMid($path, 2, 2) = ":\" then
        Return True
    Else
        Return False
    EndIf
EndfuncoÝ÷ ÚØ^;¬µ§]¶¬jÛay· yâ
y§!f*_ºw-ÞÅÇ©µ©
·µæ®¶­sdbæ÷Bô4gVÆÅFb33c¶¦fÆRFVâ&WGW&â6WDW'&÷"BÃ

cheers

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

  • 3 weeks later...

Zip UDF updated on 28/11/2008

Added Virtual Zipping Functions... here is a brief explanation on what they are and how they work.

Virtual Zipping Functions create a directory containing a virtualized zip. These Directories are very small (1KB per file). The Files in them are Links to the zip udf which recieves the parameters and unzips the file for it to be seen by the user.

Now that I'm thinking of it... I don't know how it could become handy... but I'll include them in the zip udf, just in case someone needs them :)

Here is a small example:

#include <Zip.au3>

$VZ = _Zip_VirtualZipCreate("C:\SomeZipFile.zip", "C:\the virtual zips folder")
Shellexecute("C:\the virtual zips folder") ;go and take a look at the directory
msgbox(0,"","click OK when you are finished") ;this will pause the script so you can take a look at the directory :)
_Zip_VirtualZipDelete($VZ) ;delete the virtual zip

The more I think of it the more I find it Useless XD

oh... It could be used as a fancy way to show zips :)

Please report any bug/problem you find and I'll be happy to help you

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,

i'm makin a tool to backup firefox's password files (key3.db, signons*.txt). I'm using your UDF to zip them all, but during test an error occurred:

C:\Documents and Settings\*****\Desktop\Autoit\FirefoxPassBackup\ZIP.au3 (315) : ==> Object referenced outside a "With" statement.:
$hList = $oApp.Namespace($hZipFile).Items
$hList = $oApp.Namespace($hZipFile)^ ERROR

i think this happens becouse your UDF try to _Zip_List an empty zip-file, before i can add a file.

how to solve it?

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