Jump to content

Search the Community

Showing results for tags 'zip'.

  • 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 14 results

  1. <NEWBIE ALERT> Is it possible to unzip a zip file in Autoit without using a dll! My script downloads a zip file to a temporary directory (successfully) and it must be unzipped to (Or moved to after unzip) another a folder which just happens to be @scriptdir & "file.exe" Thanks in advance
  2. 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.
  3. 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
  4. For my next project I would like to send files with "alternate data streams" by email in ZIP format. I can not use any external program like 7-Zip or WinRAR. (They would fit😥) Who knows how to create a ZIP file with "alternate data streams" included with the Powershell command "Compress-Archive"? Here a test script: (save as "ADSTester.cmd") @rem Try to create a zip file with alternate data streams (ADS) included @rem Housekeeping @cls @del ADSTester.zip >nul: @RD /S /Q Extracted >nul: @del ADSTester.txt >nul: @rem End of Housekeeping echo This is the ADSTester.txt file >ADSTester.txt echo This is the ADSTester.txt:Part1 file >ADSTester.txt:Part1 echo This is the ADSTester.txt:Part2 file >ADSTester.txt:Part2 dir /r ADSTester.txt @rem See the 3 files @rem **************************************************************** @rem **************************************************************** @rem Please alter the next lines to include the alternate data streams. powershell Compress-Archive -Path .\ADSTester.txt -Update -DestinationPath ADSTester.zip powershell Expand-Archive -Path ADSTester.zip -DestinationPath .\Extracted\ dir /r Extracted\ADSTester.txt @rem Only one file left :-( pause
  5. Here the this wiki page with list of available UDFs for data compression. For my tasks I only need ZIP support, so I started looking at pure AutoIt UDFs without any 3rd party dlls. And found out that most of available realizations uses standard ("native method") Windows dll - "zipfldr.dll". So for now I chose ZIP UDF by wraithdu. I've tested it on Windows 7 (x64) and it seem works fine. But here the comment from another topic where user says that Windows 10 discontinued support of "zipfldr.dll". Now I confused. I don't have around any Windows 10 machine to tested it. So maybe someone could confirm or deny that? Or maybe would better to switch to UDF with 7zip dll? I need an advice...
  6. Hello, How can I automatically download a list of zip files, like the ones in the quote, using a AutoIt script? Is it possible with AutoIt script?
  7. I got a UDF to zip the files from below link. With this I am able to create a zip file but the post processing of zip file creation I am checking the zip file exists or not, but it is giving the message as file not found. Any sugestions?? #include "Zip.au3" ZipLogs() Func ZipLogs() $ResultsFolder = @ScriptDir & "\Results" $ResultsDestFolder = @ScriptDir & "\Results_Archive" $zipFile = $ResultsDestFolder & "\Results_"&TodayDateTime()&".zip" DirCreate($ResultsDestFolder) Dim $Zip = _Zip_Create($zipFile) ;Create The Zip File. Returns a Handle to the zip File _Zip_AddFolderContents($Zip, $ResultsFolder) ;Add a folder's content in the zip file if FileExists(@ScriptDir&"\Logging.log") then _Zip_AddFile($Zip,@ScriptDir&"\Logging.log") FileDelete(@ScriptDir&"\Logging.log") EndIf if FileExists(@ScriptDir&"\RemoteExecution_Log.txt") then _Zip_AddFile($Zip,@ScriptDir&"\RemoteExecution_Log.txt") FileDelete(@ScriptDir&"\RemoteExecution_Log.txt") EndIf if FileExists($zipFile) then DirRemove($ResultsFolder,$DIR_REMOVE) Else MsgBox(0,"","Zip file not found") EndIf return $zipFile EndFunc Zip.au3
  8. Very simple: I had seen many examples of unzipping files (Zip) archive, but most of those example where using either some external .dll or are performing the job with the progress bar. Here is a small example how you can unzip your files without any external libraries and without any progress bar $ZipFile5="C:\file.zip" $ExtractTo5="C:\folder" $objShell5 = ObjCreate ("Shell.Application") $FilesInZip5=$objShell5.NameSpace($ZipFile5).items $objShell5.NameSpace($ExtractTo5).CopyHere($FilesInZip5,0x4)Enjoy
  9. There is a build machine in the network where it will automatically download the code from source repository and compile using visual studio and compresses the complete code in a zip file. I have added a line at the end of the build script(written in python on that machine) to copy that zip file to my ESX Virtual machine. Where I kept a AutoIT exe to wait for the zip file, once it is copied then I will extract the contents and find only the dll files in the extracted folder and do the Install creation using Installshield silently and copy the created setup files to anther machine. I wrote the script till the setup files creation. But now the problem is, when the zip file is copying through network, the autoit script is detecting it even the copy is still in progress and trying to extract the zip file and failing. Even when I am checking whether the file in use is not working. Any suggestion on how to check whether the copy is completed.?
  10. Hi guys, i hope i am in the right place for this question as it is in regards to zip.au3. I have some encrypted files on my harddrive which zip.au3 can't open. This is perfectly fine. The Problem is that it crashes my program as soon as it tries to access the file. Is there a way to detect if the file is encrypted BEFORE autoit tries to open it? I am using _zip_unzipall to unzip the file, i also tried _zip_count with the same result. My files are encrypted with SafeGuard Lan Crypt. Thanks, Comboku
  11. 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!
  12. Good Morning AutoIT Gurus! First - props to AutoIT and props to you guys It's an incredibly rich featured programming language - Thank you, thank you, thank you! Source:Gray Scripter - Zip32 '?do=embed' frameborder='0' data-embedContent>> Here is my issue with using the <Zip32.au3> If my folder name has periods in it, the zip function fails: Script Portion: $FolderName01 = "Computer_IP_192.168.2.1" ; Example formatting: ; _ZIP_Archive($ZipFile, $DirToZip) _ZIP_Archive($FolderName01, @ScriptDir & '' & $FolderName01) Console Output: !> _ZIPPrint: zip I/O error !> _ZIPPrint: zip error: Could not create output file (Computer_IP_192.168.2.1) Basically this Zip32.au3 can't zip folders with periods in them. Is this something discovered already? This is my current work around: $FolderName01 = StringRegExpReplace( $FolderName01, "[.]", "_") Just wondering if there is an update because I love the function Zip32.au3! "I put that sh** on everything" like Frank's Redhot Thanks!
  13. I was looking for a simple and small freeware ActiveX component for ZIP archive. And behold, here it is: http://www.xstandard.com/en/documentation/xzip/ HERE IS MY UDF (look also to attachment): #include-once #Tidy_Parameters=/sort_funcs /reel ; #AutoIt3Wrapper_Run_Debug_Mode=Y OnAutoItExitRegister("_XZIP_Shutdown") ; in case the script exit without calling _XZIP_Shutdown() #Region XZIP Include #include-once #include <MsgBoxConstants.au3> #include <FileConstants.au3> #include <String.au3> #include <WinAPIFiles.au3> #EndRegion XZIP Include #Region XZIP Header ; #INDEX# ======================================================================================================================= ; Title .........: UDF for "XStandard XZIP Component" ; AutoIt Version : 3.3.10.2++ ; Language ......: English ; Description ...: A collection of functions for "XStandard XZIP Component" ; Author(s) .....: mLipok ; Modified ......: ; =============================================================================================================================== #cs Title: UDF for "XStandard XZIP Component" Filename: XZip.au3 Description: A collection of functions for "XStandard XZIP Component" Author: mLipok Modified: Last Update: 2014/06/04 Requirements: AutoIt 3.3.10.2 or higher XStandard XZIP Component http://www.xstandard.com/en/documentation/xzip/ Update History: =================================================== 2014/06/04 v0.1 First official version #ce #EndRegion XZIP Header #Region #XZIP Constants# ; #CONSTANTS# =================================================================================================================== ; $__<UDF>_CONSTANT_<NAME> Global Const $__sXZIP_ClassName = "XStandard.Zip.1" Global Const $__sXZIP_CLSID = '{13D6BDE3-46AA-4FF2-A622-EBC43110D95C}' Global Const $__sXZIP_IID = '{0B2D411B-7A91-483A-95C4-53DDC6B17895}' Global Enum _ $tFolder = 1, _ $tFile #EndRegion #XZIP Constants# #Region XZIP Global Variables ; #VARIABLES# =================================================================================================================== ; $__g<VARNAME>_<UDF> Global $__hDll_XZIP = 0 Global $__oXZIP_ErrorHandler = '' Global $__fXPDF_Notification = True Global $__sXZIP_DllFileFullPath = @ScriptDir & '\XZIP.dll' #EndRegion XZIP Global Variables #Region EXAMPLES ;~ _XZIP_UseErrorHandler() ;~ _TEST() ;~ _Examples() Func _Examples() Local $oXZIP $sFilePath = @ScriptFullPath $sArchive = @ScriptFullPath & '.zip' $fStorePath = 0 $sNewPath = "" ;~ Sleep(1000) _XZIP_Pack($oXZIP, $sFilePath, $sArchive, $fStorePath, $sNewPath) ;~ _XZIP_ErrorCode($oXZIP) $output = _XZIP_Contents($oXZIP, $sArchive) ;~ MsgBox(1, 'VarGetType', VarGetType($output)) For $out In $output ConsoleWrite($out.Path & $out.Name & @CRLF) Next _XZIP_UnPack($oXZIP, @ScriptDir & '\xZIP.zip', @ScriptDir & '\TESTING') $oXZIP = '' ; CleanUp EndFunc ;==>_Examples #EndRegion EXAMPLES #Region #XZIP INTERNAL# ; =============================================================================================================================== ; #INTERNAL# ==================================================================================================================== #EndRegion #XZIP INTERNAL# #Region #XZIP CURRENT# ; #FUNCTION# ==================================================================================================================== ; Name ..........: _XZIP_Contents ; Description ...: Get a list of files and folder in the archive ; Syntax ........: _XZIP_Contents(ByRef $oXZIP, $sArchive) ; Parameters ....: $oXZIP - [in/out] Reference to xZIP object. ; $sArchive - A string value. ; Return values .: None ; Author ........: mLipok ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: http://www.xstandard.com/en/documentation/XZIP/ ; Example .......: No ; =============================================================================================================================== Func _XZIP_Contents(ByRef $oXZIP, $sArchive) _XZIP_CreateObject($oXZIP) If @error Then Return SetError(1, '', '') Else Return $oXZIP.Contents($sArchive) EndIf EndFunc ;==>_XZIP_Contents ; #FUNCTION# ==================================================================================================================== ; Name ..........: _XZIP_CreateObject ; Description ...: Create Object for XZIP ; Syntax ........: _XZIP_CreateObject(Byref $oXZIP) ; Parameters ....: $oXZIP - [in/out] Reference to xZIP object. ; Return values .: Success: $oXZIP object ; Failure: 0 and set @error to non zero ; Author ........: mLipok ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _XZIP_CreateObject(ByRef $oXZIP) ;~ $oXZIP = ObjCreate($__sXZIP_ClassName) ;~ Return If _XZIP_StartUp() Then If Not IsObj($oXZIP) Then $oXZIP = ObjCreate($__sXZIP_CLSID, $__sXZIP_IID, $__hDll_XZIP) ; $__sClassName_XZIP_Commercial ;~ _XZIP_ErrorCode($oXZIP) Return SetError(@error, 0, $oXZIP) EndIf EndIf EndFunc ;==>_XZIP_CreateObject ; #FUNCTION# ==================================================================================================================== ; Name ..........: _XZIP_Delete ; Description ...: Remove a file from an archive. ; Syntax ........: _XZIP_Delete(ByRef $oXZIP, $sFile, $sArchive) ; Parameters ....: $oXZIP - [in/out] Reference to xZIP object. ; $sFile - A string value. ; $sArchive - A string value. ; Return values .: None ; Author ........: mLipok ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: http://www.xstandard.com/en/documentation/XZIP/ ; Example .......: No ; =============================================================================================================================== Func _XZIP_Delete(ByRef $oXZIP, $sFile, $sArchive) EndFunc ;==>_XZIP_Delete ; #FUNCTION# ==================================================================================================================== ; Name ..........: _XZIP_ErrFunc ; Description ...: AutoIt COM Error Handling Functionality ; Syntax ........: _XZIP_ErrFunc($oError) ; Parameters ....: $oError - An unknown value. ; Return values .: None ; Author ........: mLipok ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _XZIP_ErrFunc($oError) ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _ @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _ @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _ @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _ @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _ @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF) EndFunc ;==>_XZIP_ErrFunc ; #FUNCTION# ==================================================================================================================== ; Name ..........: _XZIP_ErrorCode ; Description ...: Return the code of last operation. ; Syntax ........: _XZIP_ErrorCode(Byref $oXZIP) ; Parameters ....: $oXZIP - [in/out] Reference to xZIP object. ; Return values .: ErrorCode of last operation. ; Author ........: mLipok ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: http://www.xstandard.com/en/documentation/XZIP/ ; Example .......: No ; =============================================================================================================================== Func _XZIP_ErrorCode(ByRef $oXZIP) If IsObj($oXZIP) Then Local $oXZIP_ErrorCode = $oXZIP.ErrorCode($oXZIP) Local $oXZIP_ErrorDescription = $oXZIP.ErrorDescription($oXZIP) ConsoleWrite('! _XZIP_ErrorCode:' & @CRLF) ConsoleWrite('> $oXZIP_ErrorCode = ' & $oXZIP_ErrorCode & @CRLF) ConsoleWrite('> $oXZIP_ErrorDescription = ' & $oXZIP_ErrorDescription & @CRLF) Return SetError(0, $oXZIP_ErrorDescription, $oXZIP_ErrorCode) Else ConsoleWrite('! _XZIP_ErrorCode:' & @CRLF) ConsoleWrite('> $oXZIP is not an object.' & @CRLF) Return SetError(1, '', 0) EndIf EndFunc ;==>_XZIP_ErrorCode ; #FUNCTION# ==================================================================================================================== ; Name ..........: _XZIP_ErrorDescription ; Description ...: Return the error code description of last operation. ; Syntax ........: _XZIP_ErrorDescription(Byref $oXZIP) ; Parameters ....: $oXZIP - [in/out] An unknown value. ; Return values .: None ; Author ........: mLipok ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _XZIP_ErrorDescription(ByRef $oXZIP) Return $oXZIP.ErrorDescription() EndFunc ;==>_XZIP_ErrorDescription ; #FUNCTION# ==================================================================================================================== ; Name ..........: _XZIP_Move ; Description ...: Move or rename a file in the archive. ; Syntax ........: _XZIP_Move(ByRef $oXZIP, $sFrom, $sTo, $sArchive) ; Parameters ....: $oXZIP - [in/out] Reference to xZIP object. ; $sFrom - A string value. ; $sTo - A string value. ; $sArchive - A string value. ; Return values .: None ; Author ........: mLipok ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: http://www.xstandard.com/en/documentation/XZIP/ ; Example .......: No ; =============================================================================================================================== Func _XZIP_Move(ByRef $oXZIP, $sFrom, $sTo, $sArchive) EndFunc ;==>_XZIP_Move ; #CURRENT# ===================================================================================================================== ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name ..........: _XZIP_Pack ; Description ...: Add file or folder to an archive. ; Syntax ........: _XZIP_Pack(ByRef $oXZIP, $sFilePath, $sArchive[, $fStorePath = False[, $sNewPath = Default[, $iCompressionLevel = -1]]]) ; Parameters ....: $oXZIP - [in/out] Reference to xZIP object. ; $sFilePath - A string value. ; $sArchive - A string value. ; $fStorePath - [optional] A boolean value. Default is False. ; $sNewPath - [optional] A string value. Default is "". ; $iCompressionLevel - [optional] An integer value. Default is -1. Compression level 1 is minimum, level 9 is maximum, all other values default to level 6. ; Return values .: None ; Author ........: mLipok ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: http://www.xstandard.com/en/documentation/XZIP/ ; Example .......: No ; =============================================================================================================================== Func _XZIP_Pack(ByRef $oXZIP, $sFilePath, $sArchive, $fStorePath = False, $sNewPath = "", $iCompressionLevel = -1) _XZIP_CreateObject($oXZIP) If @error Then Return -1 Else $oXZIP.Pack($sFilePath, $sArchive, $fStorePath, $sNewPath, $iCompressionLevel) ConsoleWrite('> $oXZIP.ErrorCode = ' & $oXZIP.ErrorCode() & @CRLF) ConsoleWrite('> $oXZIP.ErrorDescription = ' & $oXZIP.ErrorDescription() & @CRLF) ConsoleWrite('! $oXZIP.Version = ' & $oXZIP.Version() & @CRLF) EndIf EndFunc ;==>_XZIP_Pack ; #FUNCTION# ==================================================================================================================== ; Name ..........: _XZIP_Shutdown ; Description ...: Close the XZip.dll library ; Syntax ........: _XZIP_Shutdown() ; Parameters ....: None ; Return values .: None ; Author ........: mLipok ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _XZIP_Shutdown() $oXZIP = '' If $__hDll_XZIP > 0 Then DllClose($__hDll_XZIP) $__hDll_XZIP = 0 OnAutoItExitUnRegister("_XZIP_Shutdown") EndFunc ;==>_XZIP_Shutdown ; #FUNCTION# ==================================================================================================================== ; Name ..........: _XZIP_StartUp ; Description ...: Open the XZip.dll library ; Syntax ........: _XZIP_StartUp() ; Parameters ....: None ; Return values .: TODO ; Author ........: mLipok ; Modified ......: ; Remarks .......: If you not set $__sLicenseKey_XZIP then DebenuPDFLibraryLite1012.dll will be used (Lite version). SET YOUR LICENSE KEY in your main script using _XZIP_SetLicenseKey() ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _XZIP_StartUp() If $__hDll_XZIP = 0 Then If FileExists($__sXZIP_DllFileFullPath) Then $__hDll_XZIP = DllOpen($__sXZIP_DllFileFullPath) If @error = -1 Then MsgBox($MB_SYSTEMMODAL + $MB_OK, "DllOpen Error", "Can not open: " & @CRLF & $__sXZIP_DllFileFullPath) Return SetError(2, '', 0) EndIf Return 1 Else MsgBox($MB_SYSTEMMODAL + $MB_OK, "DllOpen Error", "Dll File not exist: " & @CRLF & $__sXZIP_DllFileFullPath) Return SetError(1, '', 0) EndIf Else EndIf EndFunc ;==>_XZIP_StartUp ; #FUNCTION# ==================================================================================================================== ; Name ..........: _XZIP_UnPack ; Description ...: Extract contents of an archive to a folder. ; Syntax ........: _XZIP_UnPack(ByRef $oXZIP, $sArchive, $sFolderPath[, $sPattern = ""]) ; Parameters ....: $oXZIP - [in/out] Reference to xZIP object. ; $sArchive - A string value. ; $sFolderPath - A string value. ; $sPattern - [optional] A string value. Default is "". ; Return values .: None ; Author ........: mLipok ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: http://www.xstandard.com/en/documentation/XZIP/ ; Example .......: No ; =============================================================================================================================== Func _XZIP_UnPack(ByRef $oXZIP, $sArchive, $sFolderPath, $sPattern = "") Return $oXZIP.UnPack($sArchive, $sFolderPath, $sPattern) EndFunc ;==>_XZIP_UnPack ; #FUNCTION# ==================================================================================================================== ; Name ..........: _XZIP_UseErrorHandler ; Description ...: Handles incoming events from the given Object. ; Syntax ........: _XZIP_UseErrorHandler() ; Parameters ....: ; Return values .: None ; Author ........: mLipok ; Modified ......: ; Remarks .......: Use it only if you do not use your own COM Error Handling. ; Related .......: _XZIP_ErrFunc ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _XZIP_UseErrorHandler() $__oXZIP_ErrorHandler = ObjEvent("AutoIt.Error", "_XZIP_ErrFunc") EndFunc ;==>_XZIP_UseErrorHandler #EndRegion #XZIP CURRENT# #Region TODO Func _TEST() $oXZIP = '' _XZIP_CreateObject($oXZIP) If Not IsObj($oXZIP) Then MsgBox(1, 'IsObj ERROR', '') Else $sFilePath = @ScriptFullPath $sArchive = @ScriptFullPath & '.zip' ConsoleWrite('> $oXZIP.ErrorCode = ' & $oXZIP.ErrorCode() & @CRLF) ConsoleWrite('> $oXZIP.ErrorDescription = ' & $oXZIP.ErrorDescription() & @CRLF) ConsoleWrite('! $oXZIP.Version = ' & $oXZIP.Version() & @CRLF) EndIf $oXZIP = '' EndFunc ;==>_TEST #EndRegion TODO HOW TO USE IT: look at #Region EXAMPLES ;~ _XZIP_UseErrorHandler() ;~ _TEST() ;~ _Examples() Func _Examples() Local $oXZIP $sFilePath = @ScriptFullPath $sArchive = @ScriptFullPath & '.zip' $fStorePath = 0 $sNewPath = "" ;~ Sleep(1000) _XZIP_Pack($oXZIP, $sFilePath, $sArchive, $fStorePath, $sNewPath) ;~ _XZIP_ErrorCode($oXZIP) $output = _XZIP_Contents($oXZIP, $sArchive) ;~ MsgBox(1, 'VarGetType', VarGetType($output)) For $out In $output ConsoleWrite($out.Path & $out.Name & @CRLF) Next _XZIP_UnPack($oXZIP, @ScriptDir & '\xZIP.zip', @ScriptDir & '\TESTING') $oXZIP = '' ; CleanUp EndFunc ;==>_Examples #EndRegion EXAMPLES Have fun mLipok XZip.au3.Download.html
  14. 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
×
×
  • Create New...