I'd like to show a progress bar for an operation performed by an external program my script is running silently, I want to show it in a GUI I created using the GUICtrlCreateProgress but I have no idea how to do it.
The important thing to point out is that there's no way of knowing how long the external program will run, as it is a file splitter and it depends on the size of file it splits and the split parts size.
Can someone point me in the right direction or give me an example how to do so?
This is my RunWait command:
RunWait($MYFILES1 & '\fsplit.exe -split ' & $Size & ' mb ' & $File & " -f " & $File & "." & $extension) It uses multiple variables declared and set earlier in the script, how will I got about having the progress of that command shown using GUICtrlCreateProgress ? Is it possible?
AutoIt Windows Screenshooter
takes easily a screenshot from any visible window capture any region of the desktop incl. freehand capturing capture GUI controls and GUI menus separately capture a marked area every x seconds for a duration of y seconds create a GIF animation from saved frames (Vista or higher os required) capture to AVI file (without audio!) takes a screenshot from web sites (available only on Vista+ os and when Aero is enabled) put images to clipboard to paste to other applications easily color picker save image in different formats and also to PDF! add timestamp to saved images simple image editing options: greyscale, b&w, invert, rotate +-90° send image to printer and default email client preview of captured screens incl. zoom option multi monitor support display pixel color under mouse ruler basic image editor (paint, highlight, ellipse, rectangle, text and some graphic FX) watermark captured image no 3rd party tools or DLLs used - pure AutoIt! fully portable - no installation is needed multi language feature (Eng, Ger, Tur, Fra and Rus only) To do:
capture content of scrollable window/control capture cascaded menus Due to DllCall("User32.dll", "int", "PrintWindow", "hwnd", $hWnd, "handle", $hMemDC, "int", 0) limitation some windows cannot be captured properly (GDI+, ProgDVB, etc.) but can take screenshots of hidden windows. One workaround is to use full screen capturing (F11/F12) or "Grab Screen" function! Or try double click with rmb on listview items (beta).
Download source code (5771 downloads previously): AutoIt Windows Screenshooter v1.79 Build 2018-05-08.7z (version 18.104.22.168+ needed!)
You are not allowed to sell this code or just parts of it in a commercial project or modify it and distribute it with a different name!
Download compiled Exe only: 4shared / Media Fire / Softpedia (1.54mb)
Distributing copies of the program in compiled format (exe) must be free of any fee!
-----> click here to Donate!
(Current donators: 1. Cuong N.)
It is designed for Vista+ operating systems with AERO enabled! E.g. on WinXP machines some functions are not working properly and might crash the application!
AV scanners may have a negative impact the execution of compiled exe and might report any malware. I guarantee that there is no malicious code in the source code / exe!!!
Basic Image Editor:
Click link for an enhanced version of Watermark Image.
main code by UEZ additional code (alphabetical order) by Authenticity, AutoItObject Team, Eemuli, Eukalyptus, funkey, _Kurt, martin, monoceres, ProgAndy, taietel, trancexx, Ward, wolf9228 and Yashied! mesale0077 for turkish translation wakillon for french translation AZJIO for russian translation Keys:
User your mouse to scroll preview window or
Numpad 8: Scroll preview window up
Numpad 2: Scroll preview window down
Numpad 4: Scroll preview window left
Numpad 6: Scroll preview window right
Numpad +: zoom in preview window or mousewheel down
Numpad -: zoom out preview window or mousewheel up
F1: capture again on last position
F5: refresh Windows Name list
PRINTSCREEN: take screenshot from whole screen
ALT+PRINTSCR: take a screenshot from active window
F10: Undo made changes with Image Editing function
F11: take screenshot from whole screen incl mouse cursor
F12: take screenshot from whole screen
Ctrl+Alt+F9 start "Grab Screen" mode
Ctrl+Alt+F12: take a screenshot from active window using alternative screenshot functionality (beta)!
Ctrl+r: call ruler
Ctrl+s: save current displayed image
Ctrl+x: exit program
ctrl+w: call web grab input field (availabe only when Aero is enabled)
Ctrl+i: call image editor
Ctrl+m: call watermark editor
Only available on Vista+ os: double click with rmb on list items to use alternative screenshot functionality (beta)!
When 'Grab Screen' is clicked you can hold down the ctrl key to switch to 'grab controls' mode. Control under mouse will be framed red.
ctrl + shift will take the screenshot of appropriate control. To capture GUI menues you can press rmb which simulates the lmb. When a menu is opened press shift additionaly to capture it.
Press and hold only the shift key to capture any region on the desktop using freehand capturing - release it so capture marked regions!
Or just mark resizeable area which you want to grab. Press CTRL key to grab marked area or right mouse button to capture the marked area every x seconds for a duration of y seconds.
When saving the image just enter the extension you whish to use (*.jpg;*.png;*.bmp;*.gif;*.tif;*.pdf). Big thanks to taietel for his PDF UDF!
g: text config
To start the app minimized just call it "Windows Screenshooter.exe /min"
Maybe it is useful for someone...
Any kind of comment is welcome.
I have created a UDF that will allow you to easily create a customizable GUI with either a standard progress bar or a marquee style progress bar. You can change the size and back ground color of the GUI, as well as the font, font size, and color of the text. The function doesn't require any parameters to operate, but the default text is very generic so you probably would want to set that at the very least.
#include <ColorConstants.au3>; Including required files #include <GUIConstantsEx.au3> #include <file.au3> #include <Array.au3> #include <string.au3> Example() Func Example() Local $hash Local $hashes = "hash.txt" _FileReadToArray($hashes, $hash) For $i = 1 To UBound($hash) - 500 $hashcheck = $hash[$i] $PDenc = "hash=" & $hashcheck & "&decrypt=Decrypt" $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("POST", "http://myurl/", False) ; Post url $oHTTP.SetRequestHeader("Host", "myurl") $oHTTP.SetRequestHeader("Connection", "keep-aliveContent-Length: 29") $oHTTP.SetRequestHeader("Cache-Control", "max-age=0") $oHTTP.SetRequestHeader("Origin", "http://myurl") $oHTTP.SetRequestHeader("Upgrade-Insecure-Requests", "1") $oHTTP.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.84 Safari/537.36") $oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded") $oHTTP.SetRequestHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8") $oHTTP.SetRequestHeader("Referer", "http://myurl") $oHTTP.SetRequestHeader("Accept-Language", "en-US,en;q=0.8") $oHTTP.Send($PDenc) $oReceived = $oHTTP.ResponseText $oStatusCode = $oHTTP.Status sleep(2000) If $oStatusCode = 503 then MsgBox(4096, "Response code", $oStatusCode) ExitLoop EndIf ; Saves the body response regardless of the Response code $file = FileOpen("Received.html", 2) ; The value of 2 overwrites the file if it already exists FileWrite($file, $oReceived) $read = FileRead("Received.html") ;read file if StringInStr($read, "not found") Then ContinueLoop Else ContinueLoop $Datastring = ('</script></div><br/>') $newreadamount = _StringBetween($read, $Datastring, "</b><br/><br/>") ;read title from file $newreadamount = StringReplace($newreadamount, '<b>', "") ; taking out the X makes it easier to compare value If @error Then ContinueLoop EndIf $file = FileOpen("decrypted.txt", 1) FileWrite($file, $newreadamount & @CRLF) EndIf Next sleep(2000) EndFunc ;==>Example As you can read my script loads 500 lines of text, lets say I have a list with 10.000 lines
Is there a way to show a progressbar GUI to show how long in a text file I am?
I may not know how long a particular .txt file is always so I am thinking I need some sort of algorythm?
Thanks in advance.
( I just got unclear if I actually read 500 lines each attempt or if I start with 500 and add 1 to it each time? )
For $i = 1 To UBound($hash) - 500 ; LIke that ^ For $i = 500 To UBound($hash) - 500 ; or like this^ Thanks a lot.
I was having some problems with Progressbar with nested "FOR" Loop but I was using it unnecessarily so I end up with only one "FOR" Loop.
Here I'm sharing with you two ways of solve the progressbar problem, this is not for advanced users, this is for reference and newbies like me.
And about the progressbar using GUICtrlSetData() with one FOR Loop and variable cicles(for example cicles base of elements on Array with variable size) you can do it as fallow:
Note: Does not matter if the Array size is 50 or 5000 the progressbar will work properly.
$progress = GUICtrlCreateProgress() Local $count = UBound($Array) Local $imove = ((1 / $count) * 100) ; One is because you will SetData to Progress each 1 cicle. Local $itemp = 0 For $i = 0 To UBound($Array) - 1 ; Your Code could be here $itemp += $imove GUICtrlSetData($progress, $itemp) ; Or your code could be here. Next
Another way to do it and I think is more elegant or fancy is like this:
$progress = GUICtrlCreateProgress() Local $itemp = 0 Local $count = 0 Local $intcount = Floor(Ubound($Array)/100) For $i = 0 To UBound($Array) - 1 ; Your Code could be here If Mod($i, $intcount) == 0 Then $count = $count+1 GUICtrlSetData($progress, $count) EndIf ; Or your code could be here. Next