Shocker Posted June 30, 2017 Posted June 30, 2017 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)?
Moderators JLogan3o13 Posted July 1, 2017 Moderators Posted July 1, 2017 @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 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
Shocker Posted July 5, 2017 Author Posted July 5, 2017 (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... expandcollapse popup;_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 July 5, 2017 by Shocker
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