jan48 Posted February 18, 2021 Share Posted February 18, 2021 (edited) #include <GUIConstantsEx.au3> Global $pb, $tw,$bc,$pl,$p=0,$perc=0 $tw = GUICreate("Test Progressbar",250,110) $pb=GUICtrlCreateProgress ( 20, 10 ,210,20) $pl=GUICtrlCreateLabel ( "", 20, 40 ,50,25) $bc = GUICtrlCreateButton("Close", 170, 80, 70, 25) GUISetState(@SW_SHOW, $tw) ; Loop until Close button is pushed. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $bc ExitLoop EndSwitch $p+=7 $perc=round($p/1000,3) if $perc>=100 then ExitLoop GUICtrlSetData ( $pl, $perc) GUICtrlSetData ( $pb, $perc) WEnd ; Delete the GUI and all controls. GUIDelete($tw) The standard progressbar will only update on percentage integers, not on a float. I run Autoit 3.3.14.5 64 bit on Windows 10 Pro. Edited February 23, 2021 by jan48 Link to comment Share on other sites More sharing options...
Nine Posted February 18, 2021 Share Posted February 18, 2021 Probably you got something wrong. Cause just tested with float and it is working fine. Show a runable snippet of your code. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 18, 2021 Moderators Share Posted February 18, 2021 Moved to the appropriate forum, as the AutoIt Example Scripts forum very clearly states: Quote Share your cool AutoIt scripts, UDFs and applications with others. Do not post general support questions here, instead use the AutoIt Help and Support forums. Moderation Team Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
jan48 Posted February 25, 2021 Author Share Posted February 25, 2021 bump Link to comment Share on other sites More sharing options...
Nine Posted February 25, 2021 Share Posted February 25, 2021 (edited) Ok I see now what you meant. It is even more obvious using larger bar and adding a sleep at the end of the loop : ... $tw = GUICreate("Test Progressbar", 500, 110) $pb = GUICtrlCreateProgress(20, 10, 460, 20) .... Sleep(50) WEnd The progress bar only updates when it hits next integer value. In between integers it does not. Not sure why it was implemented that way... Edited February 25, 2021 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
pixelsearch Posted February 25, 2021 Share Posted February 25, 2021 (edited) @Nine : some thoughts about this. I added a counter in OP's script, the While...Wend is looped 14286 times. So I tried to simulate a progress bar with a colored label having a 500 pixels width, which means that 1 pixel has to be shown every 28.572 times (14286 / 500 = 28.572) Here are 2 scripts quickly done (constants need to be reworked etc...), they may be useful to simulate an updated progress bar when percentages are needed : * 1st one, the basic idea : #include <ColorConstants.au3> #include <GUIConstantsEx.au3> Local $hGUI = GUICreate("Test Progressbar", 520, 200) Local $idLabel = GUICtrlCreateLabel ("", 10, 10, 0, 20) Local $hLabel = GUICtrlGetHandle($idLabel) GUICtrlSetBkColor($idLabel, $COLOR_RED) Local $pl = GUICtrlCreateLabel("", 20, 40, 50, 20) GUISetState() Local $iWidth = 0 While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch $iWidth += 1 If $iWidth > 500 Then ExitLoop GUICtrlSetData($pl, $iWidth & " / 500") WinMove($hLabel, "", 10, 10, $iWidth) Sleep(50) WEnd GUIDelete() * 2nd script, more adapted to OP : expandcollapse popup#include <ColorConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> Local $p=0, $perc=0 Local $hGUI = GUICreate("Test Progressbar", 520, 200) GUICtrlCreateLabel("", 9, 9, 500, 22, $SS_SUNKEN) GUICtrlSetState(-1, $GUI_DISABLE) Local $idLabel = GUICtrlCreateLabel ("", 10, 10, 0, 20) Local $hLabel = GUICtrlGetHandle($idLabel) GUICtrlSetBkColor($idLabel, $COLOR_RED) Local $pl = GUICtrlCreateLabel("", 20, 40, 50, 20) GUISetState() Local $iWidth = 0 While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch $p+=7 $perc=round($p/1000,3) If $perc >= 100 then ExitLoop GUICtrlSetData($pl, $perc) If Mod($p, 28.572) < 1 Then $iWidth += 1 WinMove($hLabel, "", 10, 10, $iWidth) EndIf WEnd GUIDelete() Edited February 25, 2021 by pixelsearch replaced variable name $iInc with $iWidth Link to comment Share on other sites More sharing options...
jan48 Posted March 4, 2021 Author Share Posted March 4, 2021 (edited) Thanks for the working example of a progressbar. I am sure that I used a working progessbar in an earlier project before some time ago. It was exactly as in my example and it was running fine. Maybe this was an earlier version of Windows and/or an earlier version of Autoit. So my question is simple: did the behaviour of a progressbar change since then? Edited March 7, 2021 by jan48 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