Jump to content
Sign in to follow this  
Blue_Drache

7zip command line - batch archive testing script

Recommended Posts

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.

C:\Users\My Name\Documents>7za t badzipfile.zip

7-Zip (A) 9.20 Copyright © 1999-2010 Igor Pavlov 2010-11-18

Processing archive: badzipfile.zip

Error: Can not open file as archive

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()?


Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites

Please try using:

$pid = RunWait(@ComSpec & " /c " & 'C:UsersMy NameDocuments7za.exe t badzipfile.zip', "", @SW_HIDE, $STDOUT_CHILD)
.

Hope this was useful.


----------------------------------------

:bye: Hey there, was I helpful?

----------------------------------------

My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1

Share this post


Link to post
Share on other sites

Didn't think of using $stdout_child; however, the space is causing hiccups now.

'C:UsersMy is not recognized as an internal or external command,

operable program or batch file.

+>07:38:52 AutoIT3.exe ended.rc:0

>Exit code: 0 Time: 8.142

Told you I was rusty.

I've tried

$pid = RunWait(@ComSpec & " /c " & 'C:UsersMy NameDocuments7za.exe t badzipfile.zip', "", @SW_HIDE, $STDOUT_CHILD)
and
$pid = RunWait(@ComSpec & " /c " & '"C:UsersMy NameDocuments7za.exe t badzipfile.zip"', "", @SW_HIDE, $STDOUT_CHILD)

(Note the extra pair of quotes)

Edited by Blue_Drache

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites

Try this, because you have to read the StdOut in a loop to get all of the text from it.

$pid = Run(@ComSpec & " /c " & 'C:UsersMy NameDocuments7za.exe t badzipfile.zip', "", "", 8)
While 1
    $line = StdoutRead($pid)
    If @error Then ExitLoop
    If $line <> "" Then
        ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $line = ' & $line & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console
    EndIf
WEnd

This will write the information to the SciTe console if you run it from within SciTe, but skips blank lines to make it easier to read it.

EDIT: Forgot to change the RunWait to Run, because using RunWait won't let you read the information, because by the time it gets to the While loop, the process is closed.

Edited by BrewManNH

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

I presumed 7-Zip would return an Exit code if there was an error, hence the use of RunWait.


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites

I presumed 7-Zip would return an Exit code if there was an error, hence the use of RunWait.

I tried it using RunWait with a non-existant zip file and it returned:

@@ Debug(2) : $pid = 0

>Error code: 0

7za.exe doesn't seem to return an exitcode that tells you it had a problem.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Thanks for testing. I should have mentioned that I've had no luck in the past, so I've usually done the same approach as you did BrewManNH, with the addition of checking whether of not the file exists.


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites

Here's a part of the code I used for a tool I built which allows users to password protect documents....

Func EncryptZIP()
;# First lock out the controls....
GUICtrlSetState($FolderInput, $Gui_Disable)
GUICtrlSetState($NameInput, $Gui_Disable)
GUICtrlSetState($PasswordInputField1, $Gui_Disable)
GUICtrlSetState($PasswordInputField2, $Gui_Disable)
;# The debug option displays the background processes to the user so that troubleshooting can be done in the
;# event something is not going according to plan.  Those controls are displayed below.  The $DebugSwitch is
;# controlled by a "CASE" above in the BasicSet() function.
If $DebugSwitch = False Then
  $CMD = (" /c")
  $Visibility = @SW_HIDE
ElseIf $DebugSwitch = True Then
  $CMD = (" /k")
  $Visibility = @SW_SHOW
EndIf
;# Below processes the actual password protection and features
$PID1 = RunWait(@ComSpec & $CMD & " " & $TempDir & "7z.exe" & " a " & '"' & $FileName & ".zip" & '"' & ' "' & $FolderInputValue & '"' & " -p" & $Password1, $TempDir, $Visibility)
ProcessWaitClose($PID1)
If $EmailSwitch = True Then
  $objOutlook = ObjCreate("Outlook.Application")
  $OutlookMailItem = $objOutlook.CreateItem($olMailItem)
  $OutlookMailItem.HTMLBody = ("Attached to this message is a password protected archive.")
  $OutlookMailItem.Attachments.Add($TempDir & "" & $FileName & ".zip")
  $OutlookMailItem.Display
Else
  $PID3 = RunWait(@ComSpec & $CMD & " move " & "/y " & '"' & $FileName & ".zip" & '" "' & @DesktopDir & '"', $TempDir, $Visibility)
  ProcessWaitClose($PID3)
EndIf
; Clean up to the GUI is done here once the encryption is complete
GUICtrlSetData($NameInput, "") ; Clears out the $NameInput field
GUICtrlSetData($PasswordInputField1, "") ; Clears out the PasswordInputField1 field
GUICtrlSetData($PasswordInputField2, "") ; Clears out the PasswordInputField2 field
GUICtrlSetData($FolderInput, "")
GUICtrlSetBkColor($StatusIndicator, 0xffffff)
GUICtrlSetColor($StatusIndicator, 0xffffff)
; Now all the controls are released for input so the user can run the program again with new data
GUICtrlSetState($FolderInput, $Gui_Enable)
GUICtrlSetState($NameInput, $Gui_Enable)
GUICtrlSetState($PasswordInputField1, $Gui_Enable)
GUICtrlSetState($PasswordInputField2, $Gui_Enable)

BasicSet()

The actual line of code you'll be interested in is:

$PID1 = RunWait(@ComSpec & $CMD & " " & $TempDir & "7z.exe" & " a " & '"' & $FileName & ".zip" & '"' & ' "' & $FolderInputValue & '"' & " -p" & $Password1, $TempDir, $Visibility)

Hopefully you might find it useful if you can decipher it :oops:

Edited by Colyn1337

Share this post


Link to post
Share on other sites

I'm not sure if this will help you but I use external 7zip command-line (I could never get the UDF to work properly) but here is a simple code snippet example below of how I am using it:

7-Zip returns the following exit codes:

0 = No Error

1 = Warning (Non fatal error(s)). For example, one or more files were locked by some other application, so they were not compressed.

2 = Fatal Error

7 = Command line error

8 = Not enough memory for operation

255 = User Aborted

; === this is a basic sample ===

$DLdir = @ScriptDir&"DL"
$ZipName = "SourceZipFile.zip"
;
; the command-line passed to 7zip assembled below (this is an Extract with params)
$xString = " x " & $DLdir & $ZipName & " -O" & $DLdir & " -aoa"
;
$retResult = ShellExecuteWait("7za.exe", $xString, "", "") ;, @SW_MINIMIZE)
;
If @error > 0 Then
    ConsoleWrite("7ZIP Extract Error occurred: " & $retResult)
    ; above prints the error code to console, this could be acted upon with IF conditions and sent to statusbar or similar action
Else
    $UnPackMsg = "COMPLETED" & @CR
    ConsoleWrite("Unpack: " & $UnPackMsg)
EndIf
Edited by WhiteStar

~ WhiteStar Magic

Always tuned to http://www.superbluesradio.com/  Tune in at http://87.117.217.41:8036/

Share this post


Link to post
Share on other sites

Oooh!! Choices! I'll tinker with it in the morning then, since we're under a weather gun here. Thunder's actually shaking the house. Thanks, guys!


Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By obiwanceleri
      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
    • By Kevin Finnegan
      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.
       
    • By j0kky
      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!
    • By Skysnake
      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?
       
       
    • By libreau3
      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...