Archaic Posted April 25, 2023 Posted April 25, 2023 Hey all! So, after a few years, just recently I've returned to AutoIt, And still haven't solved an annoying issue with GUI's. The thing is, that most kind of procedures from a While loop, like ConrolMove or GuiCtrlSetData on progressbars seem to happen with different speeds. For example, when I move the mouse, these procedures on controls seem to speed up and slow down when idle. Even more after a few seconds. I've tried with and without Sleep, but this doesn't solve the issue. Not even when GuiGetMsg is absent. And prefer not to use AdlibRegister, unless there's a savvy way, that I don't know about. Here's a simple example, that I've used: $gui = GUICreate("Progress", 220, 70) $gui_progress1 = GUICtrlCreateProgress(10, 10, 200, 20) $gui_progress2 = GUICtrlCreateLabel("", 10, 40, 200, 20) GUICtrlSetBkColor($gui_progress2, 0x80c0b0) GUISetState() Local $count = 0 While 1 $guimsg = GUIGetMsg() If $guimsg = -3 Then ExitLoop $count = $count + 1 If $count > 100 Then $count = 0 GUICtrlSetData($gui_progress1, $count) ControlMove("Progress", "", $gui_progress2, 10, 40, $count * 2, 20) Sleep(1) WEnd So, my question is, is there a way to keep the GUI control activitiy speed constant, no matter if any other user input is used?
Nine Posted April 25, 2023 Posted April 25, 2023 Sleep(1) is useless. Beside under 10, sleep will take a default value (see help file to understand). 2 hours ago, Archaic said: So, my question is, is there a way to keep the GUI control activitiy speed constant, no matter if any other user input is used? what other user input ? “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
AutoBert Posted April 26, 2023 Posted April 26, 2023 Read about: Quote GUI Reference GUI Concepts GUI MessageLoop Mode GUI OnEvent Mode in helpfile and test in both modes.
Archaic Posted April 26, 2023 Author Posted April 26, 2023 @Nine, I knew that, it's easier to type a 1 than a 10. And my goal wasn't to use a delay, but a function that might have some influence on the issue. @AutoBert, Actually, I've tracked down a few posts in the meanwhile, where an OS issue was pointed out. I was testing this on a Win7 PC. While on my Win10 laptop, this issue is non-existent. I guess this changes my question to: if anyone knows the reason for the difference in AutoIt functioning between the OS versions and an eventual solution.
Gianni Posted April 26, 2023 Posted April 26, 2023 (edited) #include <WinAPITheme.au3> ; <---- $gui = GUICreate("Progress", 220, 70) $gui_progress1 = GUICtrlCreateProgress(10, 10, 200, 20) _WinAPI_SetWindowTheme(GUICtrlGetHandle(-1), "", "") ; <---- $gui_progress2 = GUICtrlCreateLabel("", 10, 40, 200, 20) GUICtrlSetBkColor($gui_progress2, 0x80c0b0) GUISetState() Local $count = 0 While 1 $guimsg = GUIGetMsg() If $guimsg = -3 Then ExitLoop $count = $count + 1 If $count > 100 Then $count = 0 GUICtrlSetData($gui_progress1, $count) ControlMove("Progress", "", $gui_progress2, 10, 40, $count * 2, 20) ; Sleep(1) WEnd https://www.autoitscript.com/forum/topic/207063-show-percentage-in-the-middle-of-the-progress-bar/?do=findComment&comment=1492823 P.S. tested on win10 and win11: on win10 it works fine, on win11 the progressbar goes crazy Edited April 27, 2023 by Gianni Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....
Zedna Posted May 2, 2023 Posted May 2, 2023 Look at _Timer_SetTimer() https://www.autoitscript.com/autoit3/docs/libfunctions/_Timer_SetTimer.htm Resources UDF ResourcesEx UDF AutoIt Forum Search
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