Av0 Posted June 23, 2019 Posted June 23, 2019 Will it be possible to show GUI progress bar for cmd - "Expand data.cab -F:* C:\Temp"? Thank you in advance, not very familiar with progress bars.
spudw2k Posted June 24, 2019 Posted June 24, 2019 Great question. It doesn't look like the expand exec provides any sort of progress on its own from what I can see. From I would think, you could hack something together by comparing the files contained in the cab, and monitoring the files extracted and do a percentage calculation of how many files out of the total are complete. This isn't the best to convey time wise the percentage is you can't see how big the files are (using expand), but it's something. Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF
Aelc Posted June 24, 2019 Posted June 24, 2019 Hey You could use winrar with command line then you would have the winrar Progress bar. Run ( $path & 'winrar.exe x ' & @ScriptDir & 'data.cab *.* C:\Temp\' ) i mean its not the expand of cmd but faster and u got a progress with cmd i have no idea just what spudw2k said. why do i get garbage when i buy garbage bags?
mLipok Posted June 24, 2019 Posted June 24, 2019 You can try: or this: Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24
Aelc Posted June 24, 2019 Posted June 24, 2019 (edited) i just had some free time and created something that works... a bit complicated way but don't know how else expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.14.5 Author: aElc Script Function: _expand_cab_with_progress Template AutoIt script. #ce ---------------------------------------------------------------------------- #include <Array.au3> ;;; input file $file_input = "test" $dir_input = "F:\" ;;;output dir ( folder must exist! - you can add fileopendialog or if to deny it ) $dir_output = "F:\test\" $type = ".cab" ;delete old files if exist If FileExists($dir_input & $file_input & '_compare.txt') Then FileDelete($dir_input & $file_input & '_compare.txt') If FileExists($dir_input & $file_input & '_before.txt') Then FileDelete($dir_input & $file_input & '_before.txt') If FileExists($dir_input & $file_input & '.txt') Then FileDelete($dir_input & $file_input & '.txt') ;CMD Command for list the .cab file $command = ' /c expand /d ' & $dir_input & $file_input & $type & ' >' & $dir_input & $file_input & '.txt' RunWait(@ComSpec & $command, "", @SW_HIDE) ;list and delete texts which not include files and bind the count to $TODO If FileExists($file_input & ".txt") Then Local $array = FileReadToArray($file_input & ".txt") For $i = 1 To 2 _ArrayDelete($array, 0) Next For $i = 1 To 2 _ArrayDelete($array, UBound($array) - 1) Next ;~ _ArraySort($array) $todo = UBound($array) - 1 ;set Index EndIf ;Check for other files in the folder to compare with them If FileExists($dir_input & $file_input & '_before.txt') Then FileDelete($dir_input & $file_input & '_before.txt') $command = ' /c dir ' & $dir_output & '*.* /w /s >' & $dir_input & $file_input & '_before.txt' $pid = RunWait(@ComSpec & $command, "", @SW_HIDE) Local $compare = FileReadToArray($dir_input & $file_input & '_before.txt') Local $array_da = StringRegExp($compare[UBound($compare) - 2], "\s[0-9]* D", 3, 1) $before = StringTrimLeft($array_da[0], 1) $before = StringTrimRight($before, 2) ;start expand / progress $command = ' /c expand -f:* ' & $dir_input & $file_input & $type & ' ' & $dir_output $pid = Run(@ComSpec & $command, "", @SW_HIDE) ProgressOn("Progress", "", "", 100) ;loop for checking progress While 1 Sleep(100) If FileExists($dir_input & $file_input & '_compare.txt') Then FileDelete($dir_input & $file_input & '_compare.txt') $command = ' /c dir ' & $dir_output & '*.* /w /s >' & $dir_input & $file_input & '_compare.txt' $pid = RunWait(@ComSpec & $command, "", @SW_HIDE) Local $compare2 = FileReadToArray($dir_input & $file_input & '_compare.txt') Local $array_das = StringRegExp($compare2[UBound($compare2) - 2], "\s[0-9]* D", 3, 1) $current = StringTrimLeft($array_das[0], 1) $current = StringTrimRight($current, 2) ProgressSet(($current - $before) / $todo * 100) If ($current - $before) / $todo * 100 > 99 Then Exit WEnd ProgressOff() MsgBox ( 64,"","Done" ) Exit btw OS win 7 x86 Edited June 24, 2019 by Aelc why do i get garbage when i buy garbage bags?
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