Jump to content

7Zip


rasim
 Share

Recommended Posts

Hi everyone!

Ok, after searching for any solution about works with 7Zip archives I found this interesting topic with several examples. And within several days I have written this UDF :)

Main features:

Over 27 functions!

7z, zip, gzip, bzip2, tar archive types support.

Archive encrypt/decrypt support.

Archive include/exclude support.

Files include/exclude support.

SFX archives support.

Multivolume archives support.

Archive checking support.

Compressing method 0-9.

3 recursion method.

Deleting files from archive.

Updating archives files.

Searching in the archive.

DLL Call-back function (for using the 7-zip32.dll with your GUI)

Retrieve the archive files date/time.

Retrieve the archive files compressed/uncompressed size.

Retrieve archives compressing ratio.

Retrieve archives CRC.

Retrieve the archive file count.

And more...

7zip_udf.zip

Edited by rasim
Link to comment
Share on other sites

Really more interesting than my update of the original UDF.

It's look like more professional and complete.

Thank you very much rasim.

PS : If you have an idea to do the same thing with the 7za.dll, it will be a great addition. :)

Best Regards.Thierry

Link to comment
Share on other sites

Valuater

Thank you sir :)

Tlem

If you have an idea to do the same thing with the 7za.dll, it will be a great addition

From readme.txt

7za.dll and 7zxa.dll work via COM interfaces.

But these DLLs don't use standard COM interfaces for objects creating.

Some discussion about this dll.
Link to comment
Share on other sites

Valuater

Thank you sir :)

Some discussion about this dll.

I've never been able to get that 7za.dll working correctly so I usually just install the 7za.exe file.

Does your version of the UDF still have that annoying problem where it wants to open the 7Zip GUI?

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

Does your version of the UDF still have that annoying problem where it wants to open the 7Zip GUI?

It's not a problem. User have a three ways:

1. Use the 7-zip32.dll functions with the 7Zip internal GUI dialog.

2. Use a hidden method.

3. Use your own GUI, all necessary information will be processed by Call-back function (see a _7ZipAdd_Example_using_Callback.au3)

:)

Link to comment
Share on other sites

It's not a problem. User have a three ways:

1. Use the 7-zip32.dll functions with the 7Zip internal GUI dialog.

2. Use a hidden method.

3. Use your own GUI, all necessary information will be processed by Call-back function (see a _7ZipAdd_Example_using_Callback.au3)

:)

The problem is that I don't want any notification or GUI indicating that it's even running so hiding it is the only way. Guess it's still simpler to install the command line version like I do now.

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

The problem is that I don't want any notification or GUI indicating that it's even running so hiding it is the only way. Guess it's still simpler to install the command line version like I do now.

Just use a hidden mode:

#include <7Zip.au3>

$ArcFile = @ScriptDir & "\myArchive.zip"

$FileName = "c:\Program Files\AutoIt3\Examples"
If Not FileExists($FileName) Then Exit MsgBox(16, "Error", "File not exists")

$retResult = _7ZipAdd(0, $ArcFile, $FileName, 1)
If $retResult = 0 Then
    MsgBox(64, "_7ZipAdd", "Archive created successfully")
Else
    MsgBox(64, "_7ZipAdd", "Error occurred")
EndIf

:)

Link to comment
Share on other sites

Great UDF, but I found some errors :) : Spaces are not supported in archive filename

You should add those lines to each functions wich uses FileName / ArcName.

If StringInStr($sFileName, Chr(32)) Then $sFileName = '"' & $sFileName & '"'
If StringInStr($sArcName, Chr(32)) Then $sArcName = '"' & $sArcName & '"'
(add quotation marks when spaces occur)

Also, it should be possible to read the output-buffer, if you want it :) (add $fReturnLog=False to the end of the func definition and follwing line to the end of the functions:

If $fReturnLog Then Return SetExtended($aRet[0],DllStructGetData($OutBuffer))
Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

Great UDF, but I found some errors :) : Spaces are not supported in archive filename

You should add those lines to each functions wich uses FileName / ArcName.

If StringInStr($sFileName, Chr(32)) Then $sFileName = '"' & $sFileName & '"'
If StringInStr($sArcName, Chr(32)) Then $sArcName = '"' & $sArcName & '"'
(add quotation marks when spaces occur)

Also, it should be possible to read the output-buffer, if you want it :) (add $fReturnLog=False to the end of the func definition and follwing line to the end of the functions:

If $fReturnLog Then Return SetExtended($aRet[0],DllStructGetData($OutBuffer))
Better yet. don't bother with the If StringInStr($sArcName, Chr(32)) Just make sure it's quoted anyway. Quotes when not required don't make any difference.

Edit: I often use something like $sFilename = StringReplace($sFilename, Chr(32), "_") and then quote it anyway.

Edited by GEOSoft

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

support for gz ?

From the 7Zip site

Supported formats:

  • Packing / unpacking: 7z, ZIP, GZIP, BZIP2 and TAR
  • Unpacking only: RAR, CAB, ISO, ARJ, LZH, CHM, MSI, WIM, Z, CPIO, RPM, DEB and NSIS

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

Hello rasim.

I try to use the function _7ZipGetArcOriginalSize, but it seems that it can't work whithout the function _7ZipOpenArchive and wen I try to use _7ZipOpenArchive, I have all the time an error returned.

I try to use your example _7ZipFindFirst__7ZipFindNext_Example.au3, but it doesn't work anymore.

Can you point me what I'm doing wrong or forget ?

Edited by Tlem

Best Regards.Thierry

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