sundar Posted March 13, 2013 Share Posted March 13, 2013 I need to extract iso file and /or other archieve formats to usb drive. When the extract process exisist the show the user progress of the process. For extraction i use windows version of bsdtar. The only idea i got is to calculate drive and iso size then create progress bar accordingly. But i am finding it difficult to get the progress bar properly. Code is given below.Any help is appriciated. Note: Please do not suggest me to use 7zip. expandcollapse popup#include <GUIConstants.au3> #include <GUIConstantsEx.au3> _PROGRESS () Func _PROGRESS () $Progress = GUICtrlCreateProgress(8, 56, 417, 25) $Form = GUICreate("Extracting 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) $Dest = "J:\test\" Const $iTotal_Space = Round (DriveSpaceTotal ( "J:" )) Const $FILE_SIZE = FileGetSize ( "E:\archieve.iso") $iIsoSize = Round ($FILE_SIZE / 1048576) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $close ExitLoop Case $msg = $start $Extract = Run(@DesktopDir& '\bsdtar.exe -C J:\empty -xf E:\archieve.iso', "", @SW_HIDE) While ProcessExists($Extract) $iCurrentSize = Round (DriveSpaceFree( "J:" )) $iDummyValue = 15252 - $iCurrentSize $percentage = Round ((($iDummyValue / 280) *100 )) ConsoleWrite ($percentage) If $percentage > 0 And $percentage < 101 Then GUICtrlSetData($Progress1,$percentage) Sleep (3000) EndIf WEnd EndSelect WEnd EndFunc Link to comment Share on other sites More sharing options...
Nessie Posted March 13, 2013 Share Posted March 13, 2013 if bsdtar.exe show to you the % of progress in a cmd prompt, then you can grab this info with StdoutRead and do what you want #include <Constants.au3> Local $foo = Run(@ComSpec & " /c dir foo.bar", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) Local $line While 1 $line = StdoutRead($foo) If @error Then ExitLoop MsgBox(0, "STDOUT read:", $line) WEnd While 1 $line = StderrRead($foo) If @error Then ExitLoop MsgBox(0, "STDERR read:", $line) WEnd MsgBox(0, "Debug", "Exiting...") Hi! My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s). My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all! My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file Link to comment Share on other sites More sharing options...
sundar Posted March 13, 2013 Author Share Posted March 13, 2013 Thanks for the reply. bsdtar does not show any progress. The only clue from the command line program however is that it can list all the files from archive. Link to comment Share on other sites More sharing options...
careca Posted March 13, 2013 Share Posted March 13, 2013 calculate drive and iso size then create progress bar accordingly.That seems like a plan, you seem to be on the right track, but for me to try this, ill have to change some stuff, in terms of organization.I'll come back later with what i have. Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
careca Posted March 13, 2013 Share Posted March 13, 2013 (edited) Well, the "some stuff" i changed lead me to almost a complete rewrite.. Your script seemed messy to me, i just had to reorder the code for better understanding. Changed the command to winrar, so it is working with winrar, you have to change to the application you are using. It calculates used drive space, the difference between used space and used space with the file... Now this may create a problem, you see, iso's sometimes(most) are smaller than the uncompressed files it carries, so, as we cannot know the uncompressed size of the file, we use the file size (compressed) and hope it doesn't flee much of the calculations. Added a tooltip, so we can see the values changing, you can comment that line sure, It's just to help you understand what it is doing. expandcollapse popup#include <GUIConstants.au3> #include <GUIConstantsEx.au3> Opt("TrayIconDebug", 1) Opt("TrayAutoPause", 0) Opt("GUIOnEventMode", 1) $Form = GUICreate("Extracting File", 369, 128, 193, 126) GUISetState(@SW_SHOW) $Progress = GUICtrlCreateProgress(8, 56, 353, 17) $Start = GUICtrlCreateButton("Start", 80, 88, 75, 25, 0) GUICtrlSetOnEvent($Start, "Progress") $Close = GUICtrlCreateButton("Close", 200, 88, 75, 25, 0) GUICtrlSetOnEvent($Close, "Quit") GUISetOnEvent($GUI_EVENT_MINIMIZE, "Minimize") GUISetOnEvent($GUI_EVENT_RESTORE, "Restore") GUISetOnEvent($GUI_EVENT_CLOSE, "Quit") Global $Form, $FileSize, $TotalSpace, $FreeSpace, $FreeStatic, $Getsize, $UsedSpace, $UsedSpaceF, $Percentage, $Difference1, $Difference2, $Difference3 Func Progress() $TotalSpace = Round (DriveSpaceTotal ("C:\")) $FreeStatic = Round (DriveSpaceFree("C:\")) $Getsize = FileGetSize ( "C:\Users\7\Desktop\Spartacus.rar") $FileSize = Round ($Getsize / 1048576) $UsedSpace = $TotalSpace - $FreeStatic $UsedSpaceF = $UsedSpace + $FileSize $Difference1 = $UsedSpaceF - $UsedSpace $Extract = Run("C:\Program Files\WinRAR\unrar.exe e C:\Users\7\Desktop\Spartacus.rar", '', @SW_SHOW) While ProcessExists($Extract) $FreeSpace = Round (DriveSpaceFree("C:\")) $UsedSpace = $TotalSpace - $FreeSpace $Difference2 = $UsedSpaceF - $UsedSpace $Difference3 = $Difference1 - $Difference2 $Percentage = Round ((($Difference3 / $Difference1) *100 )) GUICtrlSetData($Progress,$Percentage) ToolTip($Difference1&' '&$Difference3&' '&'$Percentage = '&$Percentage&'$FreeStatic = '&$FreeStatic&' $UsedSpace = '&$UsedSpace&' $UsedSpaceF = '&$UsedSpaceF) Sleep(1000) WEnd EndFunc Do Sleep(50) ToolTip($Difference1&' '&$Difference3&' '&'$Percentage = '&$Percentage&'$FreeStatic = '&$FreeStatic&' $UsedSpace = '&$UsedSpace&' $UsedSpaceF = '&$UsedSpaceF) Until $Form = 0 Func Minimize() WinSetState('', '', @SW_MINIMIZE) EndFunc ;==>Minimize Func Restore() WinSetState('', '', @SW_RESTORE) EndFunc ;==>Restore Func Quit() Exit EndFunc ;==>Quit Now you can add a nice FileOpenDialog to select the iso, and use it. Edited March 13, 2013 by careca Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
sundar Posted March 14, 2013 Author Share Posted March 14, 2013 @carecaThank you for the script. It works well here too :-) Link to comment Share on other sites More sharing options...
careca Posted March 14, 2013 Share Posted March 14, 2013 Ur welcome, if you need help for anything else, we're here. Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
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