Jump to content

Recommended Posts

Posted

I have been trying to do this for last 3 days but nothing seems to be working (correctly). What i am trying to do is extracting an iso image to my pendrive during which progress bar should show the process. The actual size of the archive size is not known but no significant difference is there after extraction. Here is my code and where am i making mistke?

#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
_PROGRESS ()
Func _PROGRESS ()
$Progress = GUICtrlCreateProgress(8, 56, 417, 25)
$Form = GUICreate("Copy File", 369, 128, 193, 126)
GUISetState(@SW_SHOW)
$Progress1 = GUICtrlCreateProgress(8, 56, 353, 17)
$close = GUICtrlCreateButton("Close", 200, 88, 75, 25, 0)
$start = GUICtrlCreateButton("Start", 80, 88, 75, 25, 0)
$Source = "E:\archive.iso"
$Dest = "K:\TEST\"
Const $INITIAL_SIZE = DriveSpaceFree( "K:" )
Const $FILE_SIZE = FileGetSize ( $Source )
While 1
 
  $msg = GUIGetMsg()
Select
 
  Case $msg = $GUI_EVENT_CLOSE
  
   ExitLoop
 
  Case $msg = $close
   ExitLoop
  
  Case $msg = $start
  
   $Extract = Run(@ScriptDir & '\7z.exe' & ' x "' & $Source & '" ' & "-y -o" & '"' & $Dest & '"', "", @SW_HIDE)
   Sleep (100)
   While ProcessExists($Extract) > 0
  
    $SPACE_FREE = DriveSpaceFree( "K:" )
  
   $percentage = Round((( DriveSpaceFree( "K:" ) - $INITIAL_SIZE ) * 100 / $FILE_SIZE), 0)
  
   If $percentage > 0 And $percentage < 101 Then
  
    GUICtrlSetData($Progress1,$percentage)
   EndIf
 
  WEnd
EndSelect
WEnd
EndFunc

Any help is appriciated.

Posted

Look in your Program Files folder where 7zip is installed. In there, you will find an executable called 7zG.exe. It is the same thing as 7z.exe except it displays a GUI progressbar.

#include <ByteMe.au3>

Posted

Look in your Program Files folder where 7zip is installed. In there, you will find an executable called 7zG.exe. It is the same thing as 7z.exe except it displays a GUI progressbar.

Thanks for the reply. That worked but in a seperate window. However i am trying to integrate the progress bar with in my GUI.

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
×
×
  • Create New...