netmaple Posted February 4, 2021 Posted February 4, 2021 (edited) 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. expandcollapse popup#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 February 4, 2021 by netmaple
Moderators Melba23 Posted February 4, 2021 Moderators Posted February 4, 2021 Moved to the appropriate forum. Moderation Team 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Musashi Posted February 5, 2021 Posted February 5, 2021 (edited) 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 May 23, 2021 by Musashi Attachment removed "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."
netmaple Posted February 5, 2021 Author Posted February 5, 2021 (edited) Hello there The code itself can use 7zG.exe, I ask for advice how to solve, FileGetSize 7zip sub-volume compressed file release callback problem. Edited February 5, 2021 by Melba23 Quote removed
Moderators Melba23 Posted February 5, 2021 Moderators Posted February 5, 2021 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 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now