Jump to content

Search the Community

Showing results for tags '7zip'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 11 results

  1. Always searching for the "final" solution to my zipping/unzipping needs, I started years ago using WinRar with AutoIT (don't ask me why...) and for the last 10 years I worked well with the _zip.UDF , a good solution using the embedded windows zipfldr.dll. But often I work with a lot of data (both multi gigabytes and/or 100K+ files) and I noticed the performance of the windows zip DLL are not so good, the problem is maybe worsened by the mono thread operation using AutoIT + zipfldr.dll. SO my choice is 7zip (7ZA.exe) also for licence (freeware also for business) reasons, and I wrote a small and simple UDF: ; #INDEX# ======================================================================================================================= ; Title .........: _7za ; AutoIt Version : 3.3.16.0 ; Language ......: English ; Description ...: Functions for using 7za.exe archive manipulation app ; Author(s) .....: NSC ; Version .......: 1.2 ; Date ..........: 2022/06/28 ; =============================================================================================================================== ; ------------------------------------------------------------------------------ ; This software is provided 'as-is', without any express or ; implied warranty. In no event will the authors be held liable for any ; damages arising from the use of this software. ; #INCLUDES# =================================================================================================================== ; #include-once #include <AutoItConstants.au3> ; =============================================================================================================================== ; #VARIABLES# =================================================================================================================== ; Global Global $7za_exe = @ScriptDir & "\" & "7za.exe" ; =============================================================================================================================== ; #CURRENT# ===================================================================================================================== ; _EXEC7za ;_UNcompress_7za ;_COMpress_7za_7z ;_COMpress_7za_zip ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name ..........: _EXEC7za ; Description ...: launch 7Za.exe with params and returns exit codes ; Syntax ........: EXEC7za($7zCommands, $archive, $folder[, $show]) ; Parameters ....: $7zCommands - 7zip command line params ; $archive - complete path to the archive ; $folder - the source/destination folder ; $show - optional set the state of 7za console visibility, default @SW_HIDE, ; other values as ShellExecuteWait() ; Return values .: 1 - Success ; 0 - and set @error = 1 ; and ; @extended = 1 (Warning (Non fatal error(s)) ; @extended = 2 (Fatal error) ; @extended = 7 (Command line error) ; @extended = 8 (Not enough memory for operation) ; @extended = 255 (User stopped the process) ; @extended values set by 7za.exe exit codes ; Author ........: NSC ; Modified ......: 2022/05/13 ; Remarks .......: requires 7za.exe in @scriptdir, 7za.exe (7-Zip Extra: standalone console version) ; Thanks to 7-zip.org ; Related .......: ; Link ..........: ; Examples .......: compress a folder recursive with subfolders ; EXEC7za("u -mx4 -bt", c:\folder1\archive.7z", c:\folder1\folderTOcompress\ ) ; uncompress the same folder recursive ; EXEC7za("x -aoa -bt -r", "c:\folder1\archive.7z", "-oc:\folder2\") ; =============================================================================================================================== Func _EXEC_7za($7zCommands, $archive, $folder, $show = @SW_HIDE) Local $return7za = ShellExecuteWait($7za_exe, $7zCommands & ' "' & $archive & '" "' & $folder & '"', '', $SHEX_OPEN, $show) Select Case $return7za = 0 Return 1 Case Else Return SetError(1, $return7za, 0) EndSelect EndFunc ;==>_EXEC_7za ; #FUNCTION# ==================================================================================================================== ; Name ..........: _UNcompress_7za ; Description ...: launch 7Za.exe with preset params to uncompress an archive (.7z or .zip recursively) and returns exit codes ; Syntax ........: _UNcompress_7za($archive, $folder[, $show]) ; Parameters ....: $archive - complete path to the archive ; $folder - the source/destination folder ; $show - optional set the state of 7za console visibility, default @SW_HIDE, ; other values as ShellExecuteWait() ; Return values .: 1 - Success ; 0 - and set @error = 1 ; and ; @extended = 1 (Warning (Non fatal error(s)) ; @extended = 2 (Fatal error) ; @extended = 7 (Command line error) ; @extended = 8 (Not enough memory for operation) ; @extended = 255 (User stopped the process) ; @extended values set by 7za.exe exit codes ; Author ........: NSC ; Modified ......: 2022/05/19 ; Remarks .......: requires 7za.exe in @scriptdir, 7za.exe (7-Zip Extra: standalone console version) ; Thanks to 7-zip.org ; Related .......: ; Link ..........: ; =============================================================================================================================== Func _UNcompress_7za($archive, $folder, $show = @SW_HIDE) Local $return7za = ShellExecuteWait($7za_exe, "x -aoa -bt -r" & ' "' & $archive & '" -o"' & $folder & '"', '', $SHEX_OPEN, $show) Select Case $return7za = 0 Return 1 Case Else Return SetError(1, $return7za, 0) EndSelect EndFunc ;==>_UNcompress_Folder_7za ; #FUNCTION# ==================================================================================================================== ; Name ..........: _COMpress_7za_7z ; Description ...: launch 7Za.exe with precompiled params to compress in .7z format ;a single file, a filtered (*.pdf) bunch of files or a folder (recursively) and returns exit codes ; Syntax ........: _COMpress_7za_7z($archive, $folder[, $show [, $compLvl]] ) ; Parameters ....: $archive - complete path to the archive ; $folder - the source file(s) / folder ; $show - optional set the state of 7za console visibility, default @SW_HIDE, ; other values as ShellExecuteWait() ; $CompLvl - optional compression level (1-9) default 4 ; Return values .: 1 - Success ; 0 - and set @error = 1 ; and ; @extended = 1 (Warning (Non fatal error(s)) ; @extended = 2 (Fatal error) ; @extended = 7 (Command line error) ; @extended = 8 (Not enough memory for operation) ; @extended = 255 (User stopped the process) ; @extended values set by 7za.exe exit codes ; Author ........: NSC ; Modified ......: 2022/06/22 ; Remarks .......: requires 7za.exe in @scriptdir, 7za.exe (7-Zip Extra: standalone console version) ; avoids re-compress of popular archives. ; Thanks to 7-zip.org ; Related .......: ; Link ..........: ; =============================================================================================================================== Func _COMpress_7za_7z($archive, $folder, $show = @SW_HIDE, $CompLvl = 4) If StringRight($folder, 4) = ".zip" Or StringRight($folder, 3) = ".7z" Or StringRight($folder, 4) = ".rar" Or StringRight($folder, 4) = ".lha" Or StringRight($folder, 3) = ".gz" Or StringRight($folder, 7) = ".tar.gz" Or StringRight($folder, 4) = ".iso" Then $CompLvl = 0 EndIf Local $return7za = ShellExecuteWait($7za_exe, 'u -mx' & $CompLvl & ' -mmt -bt' & ' "' & $archive & '" "' & $folder & '"', '', $SHEX_OPEN, $show) Select Case $return7za = 0 Return 1 Case Else Return SetError(1, $return7za, 0) EndSelect EndFunc ;==>_COMpress_7za_7z ; #FUNCTION# ==================================================================================================================== ; Name ..........: _COMpress_7za_zip ; Description ...: launch 7Za.exe with precompiled params to compress in zip format ; a single file, a filtered (*.pdf) bunch of files or a folder (recursively) and returns exit codes ; Syntax ........: _COMpress_7za_zip($archive, $folder[, $show [, $compLvl]] ) ; Parameters ....: $archive - complete path to the archive ; $folder - the source file(s) / folder ; $show - optional set the state of 7za console visibility, default @SW_HIDE, ; other values as ShellExecuteWait() ; $CompLvl - optional compression level (1-9) default 4 ; Return values .: 1 - Success ; 0 - and set @error = 1 ; and ; @extended = 1 (Warning (Non fatal error(s)) ; @extended = 2 (Fatal error) ; @extended = 7 (Command line error) ; @extended = 8 (Not enough memory for operation) ; @extended = 255 (User stopped the process) ; @extended values set by 7za.exe exit codes ; Author ........: NSC ; Modified ......: 2022/06/22 ; Remarks .......: requires 7za.exe in @scriptdir, 7za.exe (7-Zip Extra: standalone console version), ; avoids re-compress of popular archives. ; Thanks to 7-zip.org ; Related .......: ; Link ..........: ; =============================================================================================================================== Func _COMpress_7za_zip($archive, $folder, $show = @SW_HIDE, $CompLvl = 9) If StringRight($folder, 4) = ".zip" Or StringRight($folder, 3) = ".7z" Or StringRight($folder, 4) = ".rar" Or StringRight($folder, 4) = ".lha" Or StringRight($folder, 3) = ".gz" Or StringRight($folder, 7) = ".tar.gz" Or StringRight($folder, 4) = ".iso" Then $CompLvl = 0 EndIf Local $return7za = ShellExecuteWait($7za_exe, 'u -tzip -mx' & $CompLvl & ' -mmt -bt' & ' "' & $archive & '" "' & $folder & '"', '', $SHEX_OPEN, $show) Select Case $return7za = 0 Return 1 Case Else Return SetError(1, $return7za, 0) EndSelect EndFunc ;==>_COMpress_7za_zip You have to provide 7za.exe, in scriptdir in some way, maybe with a fileinstall or embedding in some way. Daily I use most of the time: _UNcompress_7za _COMpress_7za_7z so I'am almost done with these funcs.... Also I made a quick and dirty benchmark on some real world data (for me at least) , comparing the windows DLL, the zip ULTRA by 7zip and the various 7zip levels. My choice is level 4 (time/size) but your mileage may vary... Also, extracting many thousands of little files from a 7z archive with 7zip is waaaay fast in respect to other solutions.
  2. I updated the UDF by Patric Pendelin to use the MemoryDLL UDF. There are only two new functions: _SevenZip_Load & _SevenZip_Free The first function must be called before using any other functions included in the UDF and the other should be called to free memory when the UDF is no longer needed! The size of binary from the module was excessive so I used the ZLMA UDF to compress it. It will be decompressed at run time before its loaded into memory. The only advantage of using this UDF is that it removes the need to included any DLLs in your script. A lot of functions haven't been added yet! For those that dare: The API for the 7-Zip32.dll module is included in the attachment. These functions work in the same way you would you use the standalone 7za.exe executable so the Help.chm file applies to these functions aswell. Thats it, Enjoy! The code below is a sneak peak at the actually UDF, meaning it dosen't work without the other includes and the embed binary. - Download the attachment. #include-once #include "MemoryDLL.au3" #include "LZMA.au3" Global $__7ZIPDLL = Default, $__7ZIPINIT = False #cs =============================================================================== Name: 7-Zip.au3 Version: 1.0 Datum: 08.07.2008 Author: Patric Pendelin eMail: <patric.pendelin (a) gmx.de> Modified By: Decipher Script Function: _SevenZip_Load() _SevenZip_Extract($s_Archive, $s_Out="", $s_Pass="", $szCmdLine="", $s_Overwrite="", $hwnd=0, $szOutput="NULL", $dwSize=0) Extracts files from an archive _SevenZip_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 _SevenZip_GetVersion() Get 7_zip32.dll Version _SevenZip_GetRunning() _SevenZip_CheckArchive($s_Archive, $i_iMode = 0) _SevenZip_GetArchiveType($s_Archive) _SevenZip_GetFileCount($s_Archive) _SevenZip_GetUDFVersion() Returns UDF version number _SevenZip_Free() #ce =============================================================================== Func _SevenZip_Load() If Not $__7ZIPINIT Then $__7ZIPDLL = MemoryDllOpen(__7ZIPBIN()) $__7ZIPINIT = True EndIf EndFunc Func _SevenZip_Free() If $__7ZIPINIT Then MemoryDllClose($__7ZIPDLL) $__7ZIPINIT = False $__7ZIPDLL = Default EndIf EndFunc ;=============================================================================== ; Function Name: _SevenZip_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. "") ; $s_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: _SevenZip_Extract($s_Archive, $s_Out="", $s_Pass="", $szCmdLine="", $s_Overwrite="", $hwnd=0, $szOutput="NULL", $dwSize=0) ; Return Value(s): On Success -Return 1 ; On Failure -@error ; Author(s): Patric Pendelin <patric.pendelin (a) gmx.de> ;=============================================================================== Func _SevenZip_Extract($s_Archive, $s_Out = "", $s_Pass = "", $szCmdLine = "", $s_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 $s_Overwrite = 1 Then $s_Overwrite = "-aoa"; Overwrite All existing files without prompt. ElseIf $s_Overwrite = 2 Then $s_Overwrite = "-aos"; Skip extracting of existing files. ElseIf $s_Overwrite = 3 Then $s_Overwrite = "-aou"; Auto rename extracting file (for example, name.txt will be renamed to name_1.txt). ElseIf $s_Overwrite = 4 Then $s_Overwrite = "-aot"; Auto rename existing file (for example, name.txt will be renamed to name_1.txt). EndIf If $szCmdLine = "" Then $szCmdLine = ' x "' & $s_Archive & '" ' & $s_Overwrite & ' -o"' & $s_Out & '" -p"' & $s_Pass & '"' Local $aRet = MemoryDllCall($__7ZIPDLL, "int", "SevenZip", "hwnd", $hwnd, "str", $szCmdLine, "str", $szOutput, "int", $dwSize) Return SetError(@error, "", $aRet[0]) EndFunc ;==> _SevenZip_Extract ;=============================================================================== ; Function Name: _SevenZip_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: _SevenZip_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 ; Author(s): Patric Pendelin <patric.pendelin (a) gmx.de> ;=============================================================================== Func _SevenZip_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 Else $szCmdLine = '-t' & $s_Typ & ' a "' & $s_Archive & '" "' & $s_Out & '" -p"' & $s_Pass & '" -mhe=on -mx=' & $i_Comp EndIf EndIf Local $aRet = MemoryDllCall($__7ZIPDLL, "int", "SevenZip", "hwnd", $hwnd, "str", $szCmdLine, "str", $szOutput, "int", $dwSize) Return SetError(@error, "", $aRet[0]) EndFunc ;==> _SevenZip_Add ;=============================================================================== ; Function Name: _SevenZip_GetVersion ; Description: The version of 7-zip32.dll is returned. ; ; Parameter(s): None. ; ; Syntax: _SevenZip_GetVersion() ; Return Value(s): On Success -Return File Version ; On Failure -@error ; Author(s): Patric Pendelin <patric.pendelin (a) gmx.de> ;=============================================================================== Func _SevenZip_GetVersion() Local $aRet = MemoryDllCall($__7ZIPDLL, "int", "SevenZipGetVersion") Return SetError(@error, "", $aRet[0]) EndFunc ;==> _SevenZip_GetVersion ;=============================================================================== ; Function Name: _SevenZip_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: _SevenZip_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 ; Author(s): Patric Pendelin <patric.pendelin (a) gmx.de> ;=============================================================================== Func _SevenZip_GetRunning() Local $aRet = MemoryDllCall($__7ZIPDLL, "int", "SevenZipGetRunning") Return SetError(@error, "", $aRet[0]) EndFunc ;==> _SevenZip_GetRunning ;=============================================================================== ; Function Name: _SevenZip_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: _SevenZip_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 ; Author(s): Patric Pendelin <patric.pendelin (a) gmx.de> ;=============================================================================== Func _SevenZip_CheckArchive($s_Archive, $i_iMode = 0) Local $aRet = MemoryDllCall($__7ZIPDLL, "int", "SevenZipCheckArchive", "str", $s_Archive, "int", $i_iMode) Return SetError(@error, "", $aRet[0]) EndFunc ;==> _SevenZip_CheckArchive ;=============================================================================== ; Function Name: _SevenZip_GetArchiveType ; Description: Type of the archive file ; ; Parameter(s): $s_Archive: Fullpath to Archive file ; ; Syntax: _SevenZip_GetArchiveType($s_Archive) ; Return Value(s): On Success -Return 1 (ZIP type) ; Return 2 (7z32 type) ; On Failure -@error ; Author(s): Patric Pendelin <patric.pendelin (a) gmx.de> ;=============================================================================== Func _SevenZip_GetArchiveType($s_Archive) Local $aRet = MemoryDllCall($__7ZIPDLL, "int", "SevenZipGetArchiveType", "str", $s_Archive) Return SetError(@error, "", $aRet[0]) EndFunc ;==> _SevenZip_GetArchiveType ;=============================================================================== ; Function Name: _SevenZip_GetFileCount ; Description: Type of the archive file ; ; Parameter(s): $s_Archive: The number of files in the Archive file. ; ; Syntax: _SevenZip_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 MemoryDllCall. ; @error 2: Error in MemoryDllCall ; ; Author(s): Patric Pendelin <patric.pendelin (a) gmx.de> ;=============================================================================== Func _SevenZip_GetFileCount($s_Archive) Local $aRet = MemoryDllCall($__7ZIPDLL, "int", "SevenZipGetFileCount", "str", $s_Archive) Return SetError(@error, "", $aRet[0]) EndFunc ;==> _SevenZip_GetFileCount #region ### BINARY ### Func __7ZIPBIN() #cs Name: 7-ZIP32 BINARY Version 9.20.00.02 Requirements: Windows9x/Me/NT/200x/XP/Vista/7 Author: Akita Minoru ( Http://Akky.Xrea.Jp/support.Html ) Download the Library: 7-Zip-Library.7z Basic Usage: #include "7-Zip.au3" _SevenZip_Load() Dim $sCommandLine = "Accepts Switches and etc" _SevenZip_Exec($sCommandLine) ; See the included 7-Zip.chm documentation _SevenZip_Free() Exit
  3. I am a novice and my English is not very good, I hope everyone can understand my statement and give me some advice, thanks. The code is very suitable for echoing the progress bar when the 7z file is released, but FileGetSize cannot correctly echo the progress bar when encountering multiple sub-volume compressed files. For example, AA.7z.001, AA.7z.002, AA.7z.003, AA.7z.004, AA.7z.005, AA.7z.006, AA.7z.007, AA.7z.008, AA .7z.009, AA.7z.010…………, FileGetSize can only progress by AA.7z.001. The card is 100% completed. Please help me, and help me solve the file detection part of FileGetSize. thank. #include <array.au3> #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> Global $Title = "7zip progress echo demo" $hGUI = GUICreate($Title, 320, 80,-1,-1) $progressbar = GUICtrlCreateProgress(10, 10, 300, 30) $btn = GUICtrlCreateButton("Start", 125, 45, 70, 30) GUISetState() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $btn $ExtrTarget = 'E:\DP' ;Release path $ExtrSource = 'E:\mtest.7z' ;Target file $UnPack_line = ' x -y -o' & '"'& $ExtrTarget & '"' & ' ' & '"'& $ExtrSource & '"' _GetPIODataSend2Bar('7za.exe', $UnPack_line, FileGetSize($ExtrSource), $progressbar) GUICtrlSetData($progressbar, 100) MsgBox(0, '', 'Successful release') GUICtrlSetData($progressbar, 0) GUICtrlSetData($hGUI, "") Exit EndSwitch WEnd Func _GetPIODataSend2Bar($Execute, $Commandline, $Param, $Ctrl) Local $Pid, $PIOData, $iPercentage, $iPercentageBefore $Pid = Run ($Execute & $Commandline, '', @SW_HIDE) While ProcessExists($Pid) $PIOData = ProcessGetStats($Execute, 1) If @error Then MsgBox(0, '', $Execute) Else $iPercentage = Round($PIOData[3]/$Param*100) If $iPercentage <> $iPercentageBefore And $iPercentage > 0 And $iPercentage <= 100 Then ConsoleWrite('->-' & $iPercentage & @CRLF) GUICtrlSetData($Ctrl , $iPercentage) WinSetTitle($hGUI, "", $Title & " " & $iPercentage & "%") EndIf EndIf WEnd Return $iPercentage EndFunc
  4. Good evening! I know this has been done to death in many programming languages and probably even in AutoIt. But couldn't help myself and as a learning challenge I wrote "yet another converter" LOL I need your help to test it and show me "the error of my ways" but in a nutshell here's what it can do already (taken from my source file) : Converts all zip files recursively into a 7Zip file, with max compression REQUIRES AUTOIT Version 3.3.14.5 + Exact copy with attributes and folder structure + Extensive error checking, including files blocked by anti-virus (by file count) + Can stop process and restart later with the use of a log file + Can pause process (but in between compressing / extracting files) + Creates a .CSV file that can be used to check on compression ratios + Dynamic GUI that enables user to see console while 7zip is working + Gui can be stretched horizontally for long filenames + Up to 5 retries while transfering compressed files + Checks free space (at startup) to make sure you don't kill your OS LOL + Have converted 10,000+ files with no issues in file integrity. + Open to suggestions and program free to modify to your liking + Will eventually be fully modular and configurable (if there is interest for this) + Exit codes so you can have an idea where program went wrong (if it did) + Fully commented so users can tinker away. - Cannot save archive comments. - Not FULLY tested yet, do not use on .zip files that have no backups The program also has a very minimal GUI that can be stretched. Not a huge fan of million-button interfaces. I also assume some people running this program will have a 1024x768 monitor so the GUI is made accordingly. There is no way I am keeping this script for myself. If this is useful to anybody, feel free to use it and modify it. All I ask is you credit me (as I will credit those who contribute). Now here's the issues that are left to fix. Any help is greatly appreciated and I will add your name in the credits if you so wish. - For some reason while compression is under way, all my current explorer windows flicker; notably the cut-and-paste part. I can't seem to narrow it down. - Also context menu is closed in explorer every time program compresses / extracts a new file - I've added support for retries if, for some reason, AutoIt can't move the converted file. This happened once after 5000-6000 conversions. Now that I've programmed the retries, the process is somewhat slower. It shouldn't affect speed though. - After compressing 10,000+ files (Yes I have that many zip files! Think Mame) I've had a system meltdown. There's a leak somewhere. Am I supposed to close something and I'm not? I've added _IsPressed() lately so closing that .DLL is not the cause of this leak. - Subtracting one array from another was a tricky thing to program (happens when user stops and restarts process), if you can think of a faster way I'm all in. Obviously if you find bugs or have suggestions, I'm all ears. Changelog is included in the source file, including credits. PLEASE DON'T CONVERT ALL YOUR FILES YET. It's not fully tested (well I tested it but I need others to test too). Obiwanceleri Zip27z_102.au3
  5. Hi all, Long time lurker and now forum poster! I'm writing a relatively simple backup script for my firm that automates the copy, compression and organization of Leaver's data on one of our secured NAS systems. I personally found the best method to do this so far was to use 7zG.exe (GUI version of 7Zip which can use command-line too) and it functions quite well! I would like to retrieve more info on whether any warnings or errors happen in 7Zip during the backup, but I can't quite get my head around the syntax and switches for reading out, it seems any adjustment I make to the RunWait call's string seems to break the backup or give unexpected repercussions! Hopefully its something silly I'm doing as I don't code very often. Here is the working version: ; Compress the directories one by one in the zip using the listfile.... Local $iPID = RunWait(@ScriptDir & "\bin\7zG.exe a -mx" & $compressionQuality & " -v" & $compressSplitFileSize & " -wc:\temp " _ & $backupToLocation & "\" & $userDirectory & ".7z @bin\listfile.txt -x@bin\excludefile.txt", "", @SW_SHOWDEFAULT, $STDOUT_CHILD) Ultimately I would love to switch entirely to 7za.exe (standalone) so that I can read the progress percentage, current file being uploaded and any warnings or errors could be processed and output to the AutoIT script's GUI I've created rather than jumping in and out of two applications per se.
  6. Hi guys, I often need zipping\unzipping function within my scripts, so I've decided to do a systematic research about it to understand which options I had. I'm sharing with you these results because I think it can save some time to somobody Autoit coders produced much material from 2005 till now, most of it consists of UDF wrappers of 3rd parts libraries, but there are some exception. Let's start: ZIP from scratch UDF: written by joakim. You can retrieve some info from a zip file, but it is just a PoC script, as I can see. LZ UDF: written by trancexx: another exception. It use native windows compression, so it doesn't need anything. It can work with memory, it doesn't work with files. LZMA UDF: written by Ward. He writes a dll which can be directly included or can be embedded within an au3 file. It can work with memory, it doesn't work with files. [it needs LZMA.dll or LZMA.dll.au3](link missing) Package UDF: written by Yashied. It is useful for dealing with package (.pkr) file. ZIP UDF: written by Wraithdu (yet torels UDF): the exception! Based on zipfldr.dll, a native library of Windows, so it does not need to include an external library into the script. It is its strenght, but its weak point too: if zipfldr.dll is corrupted or is missing, your script will not do what you expect. gZip UDF: written by Zinthose. Based on the parsing of gZip.exe output. It can work with memory, it doesn't work with files. [it needs gZip.exe] ZLib UDF: written by monoceres. Based on ZLib.dll. It can compress\uncompress data in memory, it doesn't work with files. [it needs ZLib.dll] pZip UDF: written by asdf8. Based on ZLib.dll. It can extract\add\overwrite file into archives. [it needs pZip.dll] ZLib and gZip UDF: written by Ward. Based on ZLib.dll but it does not need the dll file, because it is written directly in the UDF! It can compress\uncompress data in memory, and it can work with files. It works with gZip format too. (link missing) XZip UDF: written by eltorro, KXM and erifash. Based on XZip.dll, a COM dll. [it needs XZip.dll] XZip UDF: written by mLipok. Based on XZip.dll, a COM dll. A more complete alternative to previous UDF. [it needs XZip.dll] unRAR UDF: written by rasim. Based on unRAR.dll. You can just uncompress rar files with this one (the only method for new v5 RAR files). [it needs unRAR.dll] Parsing unRAR.exe output: you can just uncompress rar files in this way (the only method for new v5 RAR files). [it needs unRAR.exe] 7Zip: I spent a lot of time with it, because I think it is the most useful, there are different approaches: Parsing 7za.exe output, it is the simplest (and in my opinion the best) way, some UDFs can help with it, as jennico UDF (thanks to Screen Scrape script by Valik, it seems it doesn't work in Windows 10) [it needs 7za.exe] Using 3rd part dll, as rasim UDF (yet jak UDF). He rewrites a dll which can be simply invoked by his UDF [it needs 7-zip32.dll and\or 7-zip64.dll]. With Decipher UDF you doesn't need to include the dll in your project, because it is compiled into the script and loaded in memory directly at runtime. Invoking 7za.dll. This is the most complicated approach because the library doesn't use standard COM interfaces. Anyway dany, Starg, milky, trancexx, Mugen and finally Biatu had spent some time with it and they reach a sort of partial result. [it needs 7za.dll] Comment here to add suggestions\links\UDF I forgot and I'll update this post with them!
  7. Perhaps someone would benefit off this. I made heavy use of the Help file example. Only question I have here, is is there a better way to do the Regex for finding "error|ERROR|Error" in the source string? Thx Example7zPwd() Func Example7zPwd() ;-- Local $iPID = Run(@ComSpec & " /c DIR Example.au3", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) Local $iPID = Run(@ComSpec & " /c 7za t -pmasale myzip.zip ", "c:\files\testing", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) Local $sOutput = "" Local $myError = 0 ConsoleWrite("$myError:" & $myError & @CRLF) While 1 $sOutput = StdoutRead($iPID) If @error Then ; Exit the loop if the process closes or StdoutRead returns an error. ExitLoop EndIf MsgBox($MB_SYSTEMMODAL, "Stdout Read:", $sOutput, 5) If StringRegExp($sOutput, '\b(error|ERROR|[Ee]rror)\b', 0) Then $myError = $myError + 1 ;ConsoleWrite("$sOutput: " & $sOutput & @CRLF) ConsoleWrite("$myError: " & $myError & @CRLF) WEnd While 1 $sOutput = StderrRead($iPID) If @error Then ; Exit the loop if the process closes or StderrRead returns an error. ExitLoop EndIf MsgBox($MB_SYSTEMMODAL, "Stderr Read:", $sOutput, 15) WEnd ConsoleWrite("$myError: " & $myError & @CRLF) If $myError > 0 Then MsgBox(64, "An Error Occurred", "The upgrade may be incomplete. An error occurred") EndIf If StringRegExp($sOutput, '\b(error|ERROR|[Ee]rror)\b', 0) Then Is the Regex here optimized?
  8. Hello all I was wondering if any one new of a way to extract the files from a Comic Book Archive (.cbr)? My original thought was to use 7za.exe (&-zip console app) but when I run: 7za x 1.cbr 7-zip returns: Processing archive: 1.cbr Error: Can not open file as archive Does anyone a suggestion or other method? PS I am trying to make a .cbr to .pdf script
  9. Ok, here's what I'm trying to do. I've searched for the 7zip.udf and it's a complete no-go for what I wish to do, so I'm trying to make it work via the command line. Problem is, I'm so rusty that I can't exactly wrap my head around this one. $pid = RunWait(@ComSpec & " /c " & 'C:\Users\My Name\Documents\7za.exe t badzipfile.zip', "") Sleep(5000) MsgBox(0,"",StdoutRead($pid) & @CRLF & StderrRead($pid)) I'm trying to read whether or not a .zip file passes or is corrupt with the 7zip command line utility so I can batch process about 2,000 files and cull out the non-operational archives. When I do this manually, it reads as such on the CMD window. Good files spit out something other than the "Error: Can not open file as archive" and is not important for me at this time. So ... what am I doing wrong, besides everything, since I get a blank MsgBox()?
  10. Before I re-invent the wheel - has anyone written anything to monitor a folder and zip it's contents when something new shows? I want to automate zipping our db backups for offsite storage and was hoping something similar exists. Thanks.
  11. I have been trying to do this for last 3 days but nothing seems to be working (correctly). What i am trying to do is extracting an iso image to my pendrive during which progress bar should show the process. The actual size of the archive size is not known but no significant difference is there after extraction. Here is my code and where am i making mistke? #include <GUIConstants.au3> #include <GUIConstantsEx.au3> _PROGRESS () Func _PROGRESS () $Progress = GUICtrlCreateProgress(8, 56, 417, 25) $Form = GUICreate("Copy File", 369, 128, 193, 126) GUISetState(@SW_SHOW) $Progress1 = GUICtrlCreateProgress(8, 56, 353, 17) $close = GUICtrlCreateButton("Close", 200, 88, 75, 25, 0) $start = GUICtrlCreateButton("Start", 80, 88, 75, 25, 0) $Source = "E:\archive.iso" $Dest = "K:\TEST\" Const $INITIAL_SIZE = DriveSpaceFree( "K:" ) Const $FILE_SIZE = FileGetSize ( $Source ) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $close ExitLoop Case $msg = $start $Extract = Run(@ScriptDir & '\7z.exe' & ' x "' & $Source & '" ' & "-y -o" & '"' & $Dest & '"', "", @SW_HIDE) Sleep (100) While ProcessExists($Extract) > 0 $SPACE_FREE = DriveSpaceFree( "K:" ) $percentage = Round((( DriveSpaceFree( "K:" ) - $INITIAL_SIZE ) * 100 / $FILE_SIZE), 0) If $percentage > 0 And $percentage < 101 Then GUICtrlSetData($Progress1,$percentage) EndIf WEnd EndSelect WEnd EndFunc Any help is appriciated.
×
×
  • Create New...