Jump to content
Sign in to follow this  

How to compress Files with Progress Bar and percentage?

Recommended Posts


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

@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:


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

How to get your question answered on this forum!

Share this post

Link to post
Share on other sites

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...


#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)


$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
        Case $ctlButton_Pack
            $retResult = _7ZipSetOwnerWindowEx($hGUI, "_ARCHIVERPROC")
            If $retResult = 0 Then Exit MsgBox(16, "_7ZipAdd demo", "Error occured")

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

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

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

    Return 1


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