Sign in to follow this  
Followers 0
Shocker

How to compress Files with Progress Bar and percentage?

3 posts in this topic

#1 ·  Posted

Hi there,

i'm looking for a simple way to compress Files with Progress Bar and percentage. I need a zip File, which can be extracted with Windows resources. Who can help me (perhaps with key words)?

Share this post


Link to post
Share on other sites



#2 ·  Posted

@Shocker if you do a forum or google search, you would see that this has been discussed a number of times. There are quite a few threads that discuss different ways to do this:

https://www.google.com/search?q=site%3Aautoitscript.com+file+zip&oq=site%3Aautoitscript.com+file+zip&aqs=chrome..69i57j69i58.6432j0j8&sourceid=chrome&ie=UTF-8


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Thx 4 reply!

 

Found many of examples to compress files, but most without progressbar :( I found a example, where EXTRACT worked fine with progress bar, but i've no idea how i can use it with _7zipadd...

 

;_7ZIPExtractEx_Example_using_Callback.au3
#include <GuiConstantsEx.au3>
#include <7Zip.au3>

$hGUI = GUICreate("_7ZIPExtractEx demo", 300, 200)

$ctlEdit = GUICtrlCreateEdit("", 10, 10, 280, 100)

$ctlProgress = GUICtrlCreateProgress(10, 130, 280, 20)

$ctlButton_Pack = GUICtrlCreateButton("Unpack!", 10, 167, 75, 23)

$ctlButton_Close = GUICtrlCreateButton("Close", 215, 167, 75, 23)

GUISetState()

$ArcFile = FileOpenDialog("Select archive", "", "Archive Files (*.7z;*.zip;*.gzip;*.bzip2;*.tar)", 1, "", $hGUI)
If @error Then Exit

$sOutput = FileSelectFolder("Select output folder", "", 1, "", $hGUI)
If @error Then Exit

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE, $ctlButton_Close
            Exit
        Case $ctlButton_Pack
            _7ZipStartup()
            $retResult = _7ZipSetOwnerWindowEx($hGUI, "_ARCHIVERPROC")
            If $retResult = 0 Then Exit MsgBox(16, "_7ZipAdd demo", "Error occured")

            $retResult = _7ZIPExtractEx($hGUI, $ArcFile, $sOutput, 1)
            _7ZipShutdown()
            If @error = 0 Then
                MsgBox(64, "_7ZIPExtractEx demo", "Archive unpacked successfully", 0, $hGUI)
            Else
                MsgBox(64, "_7ZIPExtractEx demo", "Error occurred", 0, $hGUI)
            EndIf
            GUICtrlSetData($ctlProgress, 0)
            GUICtrlSetData($ctlEdit, "")
    EndSwitch
WEnd

Func _ARCHIVERPROC($hWnd, $Msg, $nState, $ExInfo)
    Local $iFileSize, $iWriteSize, $iPercent = 0

    If $nState = 0 Then
        Local $EXTRACTINGINFO = DllStructCreate($tagEXTRACTINGINFO, $ExInfo)

        GUICtrlSetData($ctlEdit, DllStructGetData($EXTRACTINGINFO, "szSourceFileName") & @CRLF, 1)

        $iFileSize = DllStructGetData($EXTRACTINGINFO, "dwFileSize")
        $iWriteSize = DllStructGetData($EXTRACTINGINFO, "dwWriteSize")

        $iPercent = Int($iWriteSize / $iFileSize * 100)

        GUICtrlSetData($ctlProgress, $iPercent)
        Return 1
    EndIf

    If $nState = 2 Then GUICtrlSetData($ctlProgress, 100)

    Return 1
EndFunc

 

Edited by Shocker

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  
Followers 0