Ich hab letztens die 7-Zip32.dll von "Akita Minoru" benutzt und da es im englischen Forum kein
funktionierendes Skript dafür gibt veröffentliche ich hier mal die UDF.
Ist noch nicht wirklich fertig, aber die puren Funktionen, wie zB. _7z32_Extract, _7z32_Add oder _7z32_CheckArchive laufen.
Spoiler anzeigen
#include-once
;
#cs ----------------------------------------------------------------------------
AutoIt Version: 3.2.12.0
Name: 7z32
Version: 0.2.1
Datum: 08.07.2008
Author: Patric Pendelin eMail: <patric.pendelin (a) gmx.de>
Info: UDF for the 7-Zip32.dll file archiver v.4.3.1.0.3 Copyright (c) 2002-2006 by Akita Minoru
Script Function:
_7z32_Extract($s_Archive, $s_Out="", $s_Pass="", $szCmdLine="", $i_Overwrite="", $hwnd=0, $szOutput="NULL", $dwSize=0) Extracts files from an archive
_7z32_Add($s_Archive, $s_Out = "", $s_Typ = "7z32", $i_Comp = 5, $s_Pass = "", $szCmdLine = "", $hwnd = 0, $szOutput = "NULL", $dwSize = 0) Add files to an archive
_7z32_GetVersion() Get 7_zip32.dll Version
_7z32_GetRunning()
_7z32_CheckArchive($s_Archive, $i_iMode = 0)
_7z32_GetArchiveType($s_Archive)
_7z32_GetFileCount($s_Archive)
_7z32_GetUDFVersion() Returns UDF version number
#ce
;===============================================================================
;
#include <array.au3>
;===============================================================================
; Declaring Variables
;===============================================================================
Global Const $S_7z32UDFVERSION = "0.2.1"
Global Const $s_7z32_dll = @ScriptDir & "\7-zip32.dll"
;
;===============================================================================
;UDF Functions:
;===============================================================================
;===============================================================================
; Function Name: _7z32_Extract
; Description: Extracts files from an archive
;
; Parameter(s): $s_Archive: Fullpath to Archive-File
; $s_Out: Specifies a destination directory where files are to be extracted. (Def. "")
; $s_Pass: Specifies password. (Def. "")
; $szCmdLine: Command Line Commands. (Def. "")
; $i_Overwrite: Specifies the overwrite mode during extraction, to overwrite files already present on disk. (Def. "")
; -1: Overwrite All existing files without prompt.
; -2: Skip extracting of existing files.
; -3: aUto rename extracting file (for example, name.txt will be renamed to name_1.txt).
; -4: auto rename existing file (for example, name.txt will be renamed to name_1.txt).
; $hwnd: The window handle of the application which calls 7-zip32.dll. (Def. 0)
; $szOutput: The buffer because 7-zip32.dll returns the result. (Def. "NULL")
; $dwSize: Größe des Puffers. When the result exceeds designated size, it is economized in this size.
; If size is 1 or more, always NULL letter is added lastly. (Def. 0)
;
;
; Syntax: _7z32_Extract($s_Archive, $s_Out="", $s_Pass="", $szCmdLine="", $i_Overwrite="", $hwnd=0, $szOutput="NULL", $dwSize=0)
; Return Value(s): On Success -Return 1
; On Failure -@error 1: Can´t opens a DLL file for use in DllCall.
; @error 2: Error in DllCall
; @error 3: Error
;
; Author(s): Patric Pendelin <patric.pendelin (a) gmx.de>
;===============================================================================
Func _7z32_Extract($s_Archive, $s_Out = "", $s_Pass = "", $szCmdLine = "", $i_Overwrite = "", $hwnd = 0, $szOutput = "NULL", $dwSize = 0)
; set Output directory
If $s_Out = "" Then
Local $as_Res = StringSplit($s_Archive, "\")
For $i = 1 To $as_Res[0] - 1
$s_Out &= $as_Res[$i] & "\"
Next
EndIf
; (Overwrite mode) switch:
If $i_Overwrite = 1 Then
$i_Overwrite = "-aoa"; Overwrite All existing files without prompt.
ElseIf $i_Overwrite = 2 Then
$i_Overwrite = "-aos"; Skip extracting of existing files.
ElseIf $i_Overwrite = 3 Then
$i_Overwrite = "-aou"; aUto rename extracting file (for example, name.txt will be renamed to name_1.txt).
ElseIf $i_Overwrite = 4 Then
$i_Overwrite = "-aot"; auto rename existing file (for example, name.txt will be renamed to name_1.txt).
EndIf
; Command Line:
If $szCmdLine = "" Then $szCmdLine = ' x "' & $s_Archive & '" ' & $i_Overwrite & ' -o"' & $s_Out & '" -p"' & $s_Pass & '"'
;
Local $dll = DllOpen($s_7z32_dll)
If $dll = -1 Then Return SetError(1)
Local $result = DllCall($dll, "int", "SevenZip", "hwnd", $hwnd, "str", $szCmdLine, "str", $szOutput, "int", $dwSize)
If @error Then Return SetError(2)
DllClose($dll)
If $result[0] = 0 Then
Return 1
Else
Return SetError(3)
EndIf
EndFunc ;==>_7z32_Extract
;
;===============================================================================
; Function Name: _7z32_Add
; Description: Extracts files from an archive
;
; Parameter(s): $s_Archive: Fullpath to Archive-File
; $s_Out: Specifies a destination directory where files are to be extracted. (Def. "")
; $s_Typ: Specifies the type of archive.
; $i_Comp: Sets level of compression. [0 | 1 | 3 | 5 | 7 | 9 ]
; $s_Pass: Specifies password. (Def. "")
; $szCmdLine: Command Line Commands. (Def. "")
; $hwnd: The window handle of the application which calls 7-zip32.dll. (Def. 0)
; $szOutput: The buffer because 7-zip32.dll returns the result. (Def. "NULL")
; $dwSize: Größe des Puffers. When the result exceeds designated size, it is economized in this size.
; If size is 1 or more, always NULL letter is added lastly. (Def. 0)
;
;
; Syntax: _7z32_Add($s_Archive, $s_Out = "", $s_Typ = "7z32", $i_Comp = 5, $s_Pass = "", $szCmdLine = "", $hwnd = 0, $szOutput = "NULL", $dwSize = 0)
; Return Value(s): On Success -Return 1
; On Failure -@error 1: Can´t opens a DLL file for use in DllCall.
; @error 2: Error in DllCall
; @error 3: Error
;
; Author(s): Patric Pendelin <patric.pendelin (a) gmx.de>
;===============================================================================
Func _7z32_Add($s_Archive, $s_Out = "", $s_Typ = "7z32", $i_Comp = 5, $s_Pass = "", $szCmdLine = "", $hwnd = 0, $szOutput = "NULL", $dwSize = 0)
If $szCmdLine = "" Then
If $s_Pass = "" Then
$szCmdLine = '-t' & $s_Typ & ' a "' & $s_Archive & '" "' & $s_Out & '" -mx=' & $i_Comp
;~ $szCmdLine = '-t' & $s_Typ & ' -sfx a "' & $s_Archive & '" "' & $s_Out & '" -mx=' & $i_Comp
Else
$szCmdLine = '-t' & $s_Typ & ' a "' & $s_Archive & '" "' & $s_Out & '" -p"' & $s_Pass & '" -mhe=on -mx=' & $i_Comp
EndIf
EndIf
;
Local $dll = DllOpen($s_7z32_dll)
If $dll = -1 Then Return SetError(1)
Local $result = DllCall($dll, "int", "SevenZip", "hwnd", $hwnd, "str", $szCmdLine, "str", $szOutput, "int", $dwSize)
If @error Then Return SetError(2)
DllClose($dll)
;
;_ArrayDisplay($result, "_7z32_Add")
;
If $result[0] = 0 Then
Return 1
Else
Return SetError(3)
EndIf
EndFunc ;==>_7z32_Add
;
;===============================================================================
; Function Name: _7z32_GetVersion
; Description: The version of 7-zip32.dll is returned.
;
; Parameter(s): None.
;
;
; Syntax: _7z32_GetVersion()
; Return Value(s): On Success -Return File Version
; On Failure -@error 1: Can´t opens a DLL file for use in DllCall.
; @error 2: Error in DllCall
;
; Author(s): Patric Pendelin <patric.pendelin (a) gmx.de>
;===============================================================================
Func _7z32_GetVersion()
Local $dll = DllOpen($s_7z32_dll)
If $dll = -1 Then Return SetError(1)
Local $result = DllCall($dll, "int", "SevenZipGetVersion"); The version of 7-zip32.dll is returned.
If @error Then Return SetError(2)
DllClose($dll)
;
Return $result[0]
EndFunc ;==>_7z32_GetVersion
;
;===============================================================================
; Function Name: _7z32_GetRunning
; Description: Whether or not presently 7-zip32.dll while operating, you obtain.
; Application side before executing API which by all means accompanies file access such as compressing/thawing,
; it is necessary to check whether because of this feasibility.
;
; Parameter(s): None.
;
;
; Syntax: _7z32_GetRunning()
; Return Value(s): On Success -Return 1(It is in the midst of executing.)
; Return 0(Is not in the midst of executing, (feasibility).)
; On Failure -@error 1: Can´t opens a DLL file for use in DllCall.
; @error 2: Error in DllCall
;
; Author(s): Patric Pendelin <patric.pendelin (a) gmx.de>
;===============================================================================
Func _7z32_GetRunning()
Local $dll = DllOpen($s_7z32_dll)
If $dll = -1 Then Return SetError(1)
Local $result = DllCall($dll, "int", "SevenZipGetRunning")
If @error Then Return SetError(2)
DllClose($dll)
;
MsgBox(0, "", $result[0])
Return $result[0]
EndFunc ;==>_7z32_GetRunning
;
;===============================================================================
; Function Name: _7z32_CheckArchive
; Description: Whether or not presently 7-zip32.dll while operating, you obtain.
; As the archive file which the designated file supports
; It returns whether or not it is correct.
;
; Parameter(s): $s_Archive: Fullpath to Archive file
;
;
; Syntax: _7z32_CheckArchive($s_Archive)
; Return Value(s): On Success -Return 1 (At the time of correct archive file.)
; Return 0 (When the file is illegitimate.)
; On Failure -@error 1: Can´t opens a DLL file for use in DllCall.
; @error 2: Error in DllCall
;
; Author(s): Patric Pendelin <patric.pendelin (a) gmx.de>
;===============================================================================
Func _7z32_CheckArchive($s_Archive, $i_iMode = 0)
Local $dll = DllOpen($s_7z32_dll)
If $dll = -1 Then Return SetError(1)
Local $result = DllCall($dll, "int", "SevenZipCheckArchive", "str", $s_Archive, "int", $i_iMode)
If @error Then Return SetError(2)
DllClose($dll)
;
Return $result[0]
EndFunc ;==>_7z32_CheckArchive
;
;===============================================================================
; Function Name: _7z32_GetArchiveType
; Description: Type of the archive file
;
; Parameter(s): $s_Archive: Fullpath to Archive file
;
;
; Syntax: _7z32_GetArchiveType($s_Archive)
; Return Value(s): On Success -Return 1 (ZIP type)
; Return 2 (7z32 type)
; On Failure -@error 1: Can´t opens a DLL file for use in DllCall.
; @error 2: Error in DllCall
;
; Author(s): Patric Pendelin <patric.pendelin (a) gmx.de>
;===============================================================================
Func _7z32_GetArchiveType($s_Archive)
Local $dll = DllOpen($s_7z32_dll)
If $dll = -1 Then Return SetError(1)
Local $result = DllCall($dll, "int", "SevenZipGetArchiveType", "str", $s_Archive)
If @error Then Return SetError(2)
DllClose($dll)
;
Return $result[0]
EndFunc ;==>_7z32_GetArchiveType
;
;===============================================================================
; Function Name: _7z32_GetFileCount
; Description: Type of the archive file
;
; Parameter(s): $s_Archive: The number of files in the Archive file.
;
;
; Syntax: _7z32_GetFileCount($s_Archive)
; Return Value(s): On Success -Return Numer of files
; On Failure -@error 1: Can´t opens a DLL file for use in DllCall.
; @error 2: Error in DllCall
;
; Author(s): Patric Pendelin <patric.pendelin (a) gmx.de>
;===============================================================================
Func _7z32_GetFileCount($s_Archive)
Local $dll = DllOpen($s_7z32_dll)
If $dll = -1 Then Return SetError(1)
Local $result = DllCall($dll, "int", "SevenZipGetFileCount", "str", $s_Archive)
If @error Then Return SetError(2)
DllClose($dll)
;
Return $result[0]
EndFunc ;==>_7z32_GetFileCount
;
;===============================================================================
; Function Name: _7z32_GetUDFVersion
; Description: Returns UDF version number
;
; Parameter(s): None
;
; Syntax: _7z32_GetUDFVersion()
; Return Value(s) UDF version number
;
; Author(s): Patric Pendelin <patric.pendelin (a) gmx.de>
;===============================================================================
Func _7z32_GetUDFVersion()
Return $S_7z32UDFVERSION
EndFunc ;==>_7z32_GetUDFVersion
7z32.au3 & 7-Zip32.dll hier: autoit.de/wcf/attachment/2618/