Jump to content

The progress of 7zip is displayed, and the problem of subvolume decompression is encountered. - (Moved)


 Share

Recommended Posts

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

 

Edited by netmaple
Link to comment
Share on other sites

  • Moderators

Moved to the appropriate forum.

Moderation Team

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

On 2/4/2021 at 3:28 AM, netmaple said:

Please help me, and help me solve the file detection part of FileGetSize. thank.

It is not necessary to implement a customized progress bar feature. The 7zG.exe command line tool can be used to both create and extract a multi-volume archive (including a progress window).

Example :

Global $s7ZipDir, $sCommand, $sZIPFile, $sSOURCEFiles, $sDestDir
$s7ZipDir     = @ScriptDir     ; directory where the 7-Zip tool and the .dll are located
$sZIPFile     = "Testfile.7z"
$sSOURCEFiles = "Testfile.mp4" ; name of file(s) to archive (e.g. *.txt is also possible)

; Example 1 : Create a multi-volume archive .zip file
; Info :
;   -v{Size}[b | k | m | g]
;    Specifies volume size in Bytes, Kilobytes, Megabytes or Gigabytes
; ==> Already existing files of type .00n must be deleted previously
$sCommand = $s7ZipDir & '\7zG a "' & $sZIPFile & '" "' & $sSOURCEFiles & '" -v100m -y'
RunWait ($sCommand, "",  @SW_SHOW)
If @error Then Exit MsgBox(BitOR(4096, 16), "Error : ", "Unable to create a multi-volume archive")

; Example 2 : Extract a multi-volume archive .zip file
$sZIPFile = "Testfile.7z.001"
$sDestDir = @ScriptDir & "\"
$sCommand = $s7ZipDir & '\7zG x "' & $sZIPFile & '" -o"' & $sDestDir & '" -aoa -y'
RunWait ($sCommand, "",  @SW_SHOW)
If @error Then Exit MsgBox(BitOR(4096, 16), "Error : ", "Unable to extract a multi-volume archive")

EDIT : I have attached the current 7zG.exe and 7z.dll for the sake of completeness.

Attachment removed, because a standard user account only allows 8 MB (total quota for all posts) :(.

Please download the files from the respective vendor's site.

 

Edited by Musashi
Attachment removed

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Link to comment
Share on other sites

  • Moderators

netmaple,

When you reply in future, please use the "Reply to this topic" button at the top of the thread or the "Reply to this topic" editor at the bottom rather than the "Quote" button - responders know what they wrote and it just pads the thread unnecessarily. Thanks in advance for your cooperation.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...