Jump to content

7Zip


rasim
 Share

Recommended Posts

Hello, all. I'm new here, so please take it easy on me. :)

I've read through this thread from the start and despite a couple mentions on the first page starting with rasim, it isn't clear whether these user-defined functions will work with the latest version of 7za.dll (official 7-Zip Library). Rasim links to a rather ancient discussion of problems with a much older version of the DLL. GEOSoft seems to have had some experience with 7za.dll, but doesn't specify which versions or how long ago he's tried. A much more recent mention of the use of the DLL that I found with a google search seems to confirm some difficulties in its "Known Issues" section, yet further down states the following:

Personally, I'm just interested in a more recent version than the one linked in rasim's first post which is over two and a half years old.

+1

[center]MsgBox_Tipped: Eye candy msgboxes/inputboxes/loginboxes. | CreateBlankBox: Semi-transparent layers with borders and rounded corners.[/center]

Link to comment
Share on other sites

  • 1 month later...

hi there

this is nice. do you know if it works with the latest 7zip DLL etc?

cheers

None of my 7Zip functions have required changes with the new version so I would imagine the same applies here. There have been some changes in AutoIt that may have broken something with the UDF but I doubt it.

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

Hi, I've got that error:

D:\temp\7Zip.au3 (744) : ==> Variable used without being declared.:

If $hArchiveProc Then DllCallbackFree($hArchiveProc)

If ^ ERROR

$hArchiveProc is in function OnAutoitExit() in 7Zip.au3 file

dll is from here

any ideas? :)

do not beat, I'm new
Link to comment
Share on other sites

  • 3 weeks later...
  • 2 weeks later...

I'm having a slight problem, I cannot get a size out of the 7ZipGetArcOriginalSize() function, all it is returning is 0, Am I doing it wrong?

could someone try this out on a .zip file and see if it works for them.

$hgamearc = _7ZipOpenArchive(0, $sDir & $file)
$intFileSize = _7ZipGetArcOriginalSize($hgamearc)
_7ZipCloseArchive($hgamearc)

[size="2"] "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." - Brian Kernighan[/size]

Link to comment
Share on other sites

  • 1 month later...

Hi,i have an extraction problem.

I am using the function _7ZIPExtract to extract zip archive.

The extraction done but all files are saved under the main folder, e.g. under "Product" dir bellow.

I was expecting to see files under subdirectories extracted under the proper dirs.

Whats wrong?

$retResult = _7ZIPExtract(0, $Package, $DestPath, 0, 1,1)

here is the string that sent to 7-zip32.dll:

e "C:\SourcePath\Sources.zip" -o"C:\DestPath\Product" -aos -r

EDIT: I just found that the example with the callback function (_7ZIPExtractEx) is working while the simple one not.

Edited by lsakizada

Be Green Now or Never (BGNN)!

Link to comment
Share on other sites

  • 3 weeks later...

rasim

Your UDF has a little problem. It's not advisable to use "OnAutoItExit" inside an UDF.

That's because when you also want to use "OnAutoItExit" on a script that also includes an UDF that has its own "OnAutoItExit" function, in that case only one of the "OnAutoItExit" functions will run. This is easy to proove. So its better to DllClose() and DllCallBackFree() for each function.

My contributions:Local account UDF Registry UDFs DriverSigning UDF Windows Services UDF [url="http://www.autoitscript.com/forum/index.php?showtopic=81880"][/url]

Link to comment
Share on other sites

This is easy to proove. So its better to DllClose() and DllCallBackFree() for each function.

There is no need to call thise functions :D It's a better programming style, but AutoIt does it for us on termination.

Function Reference - DllClose :

Upon termination, AutoIt automatically closes any dlls it opened but calling DllClose is still a good idea.

Function Reference - DllCallbackFree:

Upon termination, AutoIt automatically closes any handles it opened but calling DllCallbackFree is still a good idea.

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

  • 1 month later...

Okay, I must be completely blind. I have read this topic something like 4 times and cant seem to figure out what my problem is. I have downloaded the zip from the first post with the .au3s and have dowloaded the 7_zip.dll that is referenced from the first post. I even renamed the the file 7-zip.dll. I keep getting the same error message

C:\Program Files\Special\AutoIt3\Include\7Zip.au3 (744) : ==> Variable used without being declared.:
If $hArchiveProc Then DllCallbackFree($hArchiveProc)
If ^ ERROR

And this is from running the _miscExamples.au3 from the original zip.

I see people on here say that they also have had the same issue but then reply back that they had the wrong dll. But other than that no link or mention on where they found the correct .dll

Could someone please point me in the right direction.

Thanks.

Link to comment
Share on other sites

  • 3 weeks later...
  • 3 weeks later...

No one remembers using this wonderful udf. That really sucks. Come on, there has to be someone out there that has the dll that work with this udf

I'm having the same issue as you and I have also used the dll in the first post and the 3.0.11 version with no luck.

*EDIT* The issue is the 7zip.au3 not being able to find the .dll. You can test this by putting your script, the 7zip.au3, and the .dll in the same folder. Everything works like a charm.

The only problem I'm having now is when i compile my script and run it elsewhere it can't find the .dll file even thou I've used "FileInstall" and specified to incorporate it into the .exe.

Edited by PnoT
Link to comment
Share on other sites

Upsa, just didn't read this thread :evil:... I utilize this function in SMF... I don't know what in detail I changed, but I'm using a custom version 7 ;)... give it a try. Add this to your main script:

Global $hDLL_7ZIP = DllOpen(@Scriptdir & "\7-zip32.dll") ; adjust to respective dll location
#include<SMF_Func_7Zip_v07.au3>

Edit: Oh, and on Exit call

_OnAutoitExit7Zip()

SMF_Func_7Zip_v07.zip

Edited by KaFu
Link to comment
Share on other sites

Upsa, just didn't read this thread :evil:... I utilize this function in SMF... I don't know what in detail I changed, but I'm using a custom version 7 ;)... give it a try. Add this to your main script:

Global $hDLL_7ZIP = DllOpen(@Scriptdir & "\7-zip32.dll") ; adjust to respective dll location
#include<SMF_Func_7Zip_v07.au3>

Edit: Oh, and on Exit call

_OnAutoitExit7Zip()

Has anyone thought of useing COM with the built in .zip support?

_ExtractZip(".zip", "dir\folder")

; #FUNCTION# ;===============================================================================
;
; Name...........: _ExtractZip
; Description ...: Extracts file/folder from ZIP compressed file
; Syntax.........: _ExtractZip($sZipFile, $sDestinationFolder)
; Parameters ....: $sZipFile - full path to the ZIP file to process
;                  $sDestinationFolder - folder to extract to. Will be created if it does not exsist exist.
; Return values .: Success - Returns 1
;                          - Sets @error to 0
;                  Failure - Returns 0 sets @error:
;                  |1 - Shell Object creation failure
;                  |2 - Destination folder is unavailable
;                  |3 - Structure within ZIP file is wrong
;                  |4 - Specified file/folder to extract not existing
; Author ........: trancexx, modifyed by corgano (to extract all files)
;
;==========================================================================================
Func _ExtractZip($sZipFile, $sDestinationFolder, $sFolderStructure = "")

    Local $i
    Do
        $i += 1
        $sTempZipFolder = @TempDir & "\Temporary Directory " & $i & " for " & StringRegExpReplace($sZipFile, ".*\\", "")
    Until Not FileExists($sTempZipFolder) ; this folder will be created during extraction

    Local $oShell = ObjCreate("Shell.Application")

    If Not IsObj($oShell) Then
        Return SetError(1, 0, 0) ; highly unlikely but could happen
    EndIf

    Local $oDestinationFolder = $oShell.NameSpace($sDestinationFolder)
    If Not IsObj($oDestinationFolder) Then
        DirCreate($sDestinationFolder)
;~         Return SetError(2, 0, 0) ; unavailable destionation location
    EndIf

    Local $oOriginFolder = $oShell.NameSpace($sZipFile & "\" & $sFolderStructure) ; FolderStructure is overstatement because of the available depth
    If Not IsObj($oOriginFolder) Then
        Return SetError(3, 0, 0) ; unavailable location
    EndIf

    Local $oOriginFile = $oOriginFolder.Items();get all items
    If Not IsObj($oOriginFile) Then
        Return SetError(4, 0, 0) ; no such file in ZIP file
    EndIf

    ; copy content of origin to destination
    $oDestinationFolder.CopyHere($oOriginFile, 20) ; 20 means 4 and 16, replaces files if asked

    DirRemove($sTempZipFolder, 1) ; clean temp dir

    Return 1 ; All OK!

EndFunc

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Link to comment
Share on other sites

Upsa, just didn't read this thread :evil:... I utilize this function in SMF... I don't know what in detail I changed, but I'm using a custom version 7 ;)... give it a try. Add this to your main script:

Global $hDLL_7ZIP = DllOpen(@Scriptdir & "\7-zip32.dll") ; adjust to respective dll location
#include<SMF_Func_7Zip_v07.au3>

Edit: Oh, and on Exit call

_OnAutoitExit7Zip()

This is exactly how the original script is setup. I have it running right now but I want to know if there is a way to incorporate the actual 7-zip32.dll file into the compiled exe and have it run. The compiled exe will only work if the .dll is in the proper location on the target machine. Edited by PnoT
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...