Tyranna Posted July 4, 2018 Share Posted July 4, 2018 expandcollapse popup#include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiEdit.au3> Global $TextString = " " & _ "This scroller speeds up massively when I move the mouse. When the mouse is NOT moving then the scrolling slows " & _ "down to a crawl. I would like to be able to control the speed at which the scrolling is done and not have a cha" & _ "nge in speed when moving the mouse. Maybe someone can tell me what I need to do to keep a consistent speed for " & _ "this. I tried a Do / Until loop and it ran consitently super fast. When I use GuiGetMsg , the scroller starts f" & _ "ast momentarily and then becomes slow. This I am sure is due to the dwell in the GuiGetMsg function itself. I n" & _ "eed to be able to regulate the dwell time for GuiGetMsg cpu idling or pick up the window messages another way..." $hGUI = GUICreate("GDI+", 400, 22) Global $MovingInput = GUICtrlCreateLabel( "" , 0 , 0 , 400 , 22 , $ES_READONLY , $WS_EX_TRANSPARENT ) $Handle = GUICtrlGetHandle(-1) GUISetState(@SW_SHOW) Local $hGUI, $hGraphic, $hBrush, $hFormat, $hFamily, $hFont, $tLayout Local $aInfo Local $bitmap Local $i = 200 _GDIPlus_Startup() $hGraphic = _GDIPlus_GraphicsCreateFromHWND($Handle) $bitmap = _GDIPlus_BitmapCreateFromGraphics( 400 , 22 , $hGraphic ) $backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap) $hBrush = _GDIPlus_BrushCreateSolid(0xFFFFFF00) $hFormat = _GDIPlus_StringFormatCreate( 0x1000 ) $hFamily = _GDIPlus_FontFamilyCreate( "Arial" ) $hFont = _GDIPlus_FontCreate($hFamily, 10 , 1) $tLayout = _GDIPlus_RectFCreate( 0 , 0 , 8192 , 16 ) $aInfo = _GDIPlus_GraphicsMeasureString( $backbuffer , $TextString , $hFont , $tLayout , $hFormat ) _GDIPlus_GraphicsDrawStringEx( $backbuffer , $TextString , $hFont , $aInfo[0] , $hFormat , $hBrush ) Do _GDIPlus_GraphicsClear ( $backbuffer , 0xFF000000 ) $tLayout = _GDIPlus_RectFCreate( $i , 4 , 8192 , 16 ) $aInfo = _GDIPlus_GraphicsMeasureString( $backbuffer , $TextString , $hFont , $tLayout , $hFormat ) _GDIPlus_GraphicsDrawStringEx( $backbuffer , $TextString , $hFont , $aInfo[0] , $hFormat , $hBrush ) _GDIPlus_GraphicsDrawImageRect( $hGraphic , $bitmap , 0 , 0 , 400 , 22 ) $i = $i -1 If $i < -5000 Then $i = 1 Until GUIGetMsg() = $GUI_EVENT_CLOSE _GDIPlus_FontDispose($hFont) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() Just run thus code it will be obvious.... Link to comment Share on other sites More sharing options...
Earthshine Posted July 4, 2018 Share Posted July 4, 2018 (edited) i can move my mouse all i want and the speed is constant... hmmmmm and I have the worst possible cpu too. an A6 Edited July 4, 2018 by Earthshine My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
Tyranna Posted July 4, 2018 Author Share Posted July 4, 2018 I am on Win7 Ultimate SP1 Processor: AMD FX(tm)-8350 Eight-Core Processor 4.01 GHz Installed Memory(RAM) : 32.0 GB 64-bit Operating system. AMD Radeon HD 7900 Series (Tahiti) AutoIt version: 3.3.12.0 Link to comment Share on other sites More sharing options...
Earthshine Posted July 4, 2018 Share Posted July 4, 2018 (edited) there is a bew autoit. im on that and win 10 Edited July 4, 2018 by Earthshine My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
Tyranna Posted July 4, 2018 Author Share Posted July 4, 2018 What is "bew"? I assuming "new". I just read the script breaking modifications on the new 3.3.14.0 version. I think the mouse floods the messaging system with mouse messages and keeps AutoIt from Idling the CPU, and therefore it runs the script at full speed. Strange thing is that it produces the speed boost no matter if the cursor is in the Autoit window or not. The slowdown really is too slow to make the scroller convenient to watch. Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted July 4, 2018 Share Posted July 4, 2018 @Tyranna Did you try with: Opt("GUIOnEventMode", 1) ? Best Regards. Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
Tyranna Posted July 4, 2018 Author Share Posted July 4, 2018 Not an option. Link to comment Share on other sites More sharing options...
Tyranna Posted July 4, 2018 Author Share Posted July 4, 2018 New information: The speed change happens only when the GUI for my Script has FOCUS. Link to comment Share on other sites More sharing options...
TimRude Posted July 4, 2018 Share Posted July 4, 2018 I see your speed change behavior on my 32-bit Windows 7 Pro SP1 with Intel Core i3 @ 3.4 GHz CPU, running AutoIt 3.3.14.5. Speedy when script GUI has focus, not speedy when other windows have focus. I don't know how to fix it, but I wanted to report that it's not just something on your machine. I do notice that adding a Sleep(10) command just before the Until... line alleviates the issue quite a bit. Not perfect but at least the text doesn't go supersonic in the scroller. Link to comment Share on other sites More sharing options...
Tyranna Posted July 4, 2018 Author Share Posted July 4, 2018 It does go quite fast does it not! And sleep(10) makes it go too slow. I want to adjust the delay built into the GuiGetMsg() function. Maybe there is a byte that we can edit so I can get slow mode to go faster. Link to comment Share on other sites More sharing options...
AutoBert Posted July 4, 2018 Share Posted July 4, 2018 2 hours ago, FrancescoDiMuro said: Did you try with: Opt("GUIOnEventMode", 1) ? 2 hours ago, Tyranna said: Not an option. The best solution is GUIOnEventMode for your problem. FrancescoDiMuro and user4157124 2 Link to comment Share on other sites More sharing options...
Tyranna Posted July 5, 2018 Author Share Posted July 5, 2018 Really? How does that solve this problem? Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted July 5, 2018 Share Posted July 5, 2018 @Tyranna From the Help file: In the OnEvent mode instead of constantly polling the GUI to find out if anything has happened you make the GUI temporarily pause your script and call a pre-defined function to handle the event. Take a look here. Give it a try Best Regards. Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
LarsJ Posted July 5, 2018 Share Posted July 5, 2018 Use a Timer to check how many times per. second your graphics update: expandcollapse popup#include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiEdit.au3> Global $TextString = " " & _ "This scroller speeds up massively when I move the mouse. When the mouse is NOT moving then the scrolling slows " & _ "down to a crawl. I would like to be able to control the speed at which the scrolling is done and not have a cha" & _ "nge in speed when moving the mouse. Maybe someone can tell me what I need to do to keep a consistent speed for " & _ "this. I tried a Do / Until loop and it ran consitently super fast. When I use GuiGetMsg , the scroller starts f" & _ "ast momentarily and then becomes slow. This I am sure is due to the dwell in the GuiGetMsg function itself. I n" & _ "eed to be able to regulate the dwell time for GuiGetMsg cpu idling or pick up the window messages another way..." $hGUI = GUICreate("GDI+", 400, 22) Global $MovingInput = GUICtrlCreateLabel( "" , 0 , 0 , 400 , 22 , $ES_READONLY , $WS_EX_TRANSPARENT ) $Handle = GUICtrlGetHandle(-1) GUISetState(@SW_SHOW) Local $hGUI, $hGraphic, $hBrush, $hFormat, $hFamily, $hFont, $tLayout Local $aInfo Local $bitmap Local $i = 200 _GDIPlus_Startup() $hGraphic = _GDIPlus_GraphicsCreateFromHWND($Handle) $bitmap = _GDIPlus_BitmapCreateFromGraphics( 400 , 22 , $hGraphic ) $backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap) $hBrush = _GDIPlus_BrushCreateSolid(0xFFFFFF00) $hFormat = _GDIPlus_StringFormatCreate( 0x1000 ) $hFamily = _GDIPlus_FontFamilyCreate( "Arial" ) $hFont = _GDIPlus_FontCreate($hFamily, 10 , 1) $tLayout = _GDIPlus_RectFCreate( 0 , 0 , 8192 , 16 ) $aInfo = _GDIPlus_GraphicsMeasureString( $backbuffer , $TextString , $hFont , $tLayout , $hFormat ) _GDIPlus_GraphicsDrawStringEx( $backbuffer , $TextString , $hFont , $aInfo[0] , $hFormat , $hBrush ) Local $hTimer = TimerInit() Do If TimerDiff($hTimer) > 25 Then _GDIPlus_GraphicsClear ( $backbuffer , 0xFF000000 ) $tLayout = _GDIPlus_RectFCreate( $i , 4 , 8192 , 16 ) $aInfo = _GDIPlus_GraphicsMeasureString( $backbuffer , $TextString , $hFont , $tLayout , $hFormat ) _GDIPlus_GraphicsDrawStringEx( $backbuffer , $TextString , $hFont , $aInfo[0] , $hFormat , $hBrush ) _GDIPlus_GraphicsDrawImageRect( $hGraphic , $bitmap , 0 , 0 , 400 , 22 ) $i = $i -1 If $i < -5000 Then $i = 1 $hTimer = TimerInit() EndIf Until GUIGetMsg() = $GUI_EVENT_CLOSE _GDIPlus_FontDispose($hFont) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions Link to comment Share on other sites More sharing options...
mikell Posted July 5, 2018 Share Posted July 5, 2018 Or maybe use AdlibRegister expandcollapse popup#include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiEdit.au3> Global $TextString = " " & _ "This scroller speeds up massively when I move the mouse. When the mouse is NOT moving then the scrolling slows " & _ "down to a crawl. I would like to be able to control the speed at which the scrolling is done and not have a cha" & _ "nge in speed when moving the mouse. Maybe someone can tell me what I need to do to keep a consistent speed for " & _ "this. I tried a Do / Until loop and it ran consitently super fast. When I use GuiGetMsg , the scroller starts f" & _ "ast momentarily and then becomes slow. This I am sure is due to the dwell in the GuiGetMsg function itself. I n" & _ "eed to be able to regulate the dwell time for GuiGetMsg cpu idling or pick up the window messages another way..." $hGUI = GUICreate("GDI+", 400, 22) Global $MovingInput = GUICtrlCreateLabel( "" , 0 , 0 , 400 , 22 , $ES_READONLY , $WS_EX_TRANSPARENT ) $Handle = GUICtrlGetHandle(-1) GUISetState(@SW_SHOW) Local $hGUI, $hGraphic, $hBrush, $hFormat, $hFamily, $hFont, $tLayout Local $aInfo Local $bitmap ; Local $i = 200 _GDIPlus_Startup() $hGraphic = _GDIPlus_GraphicsCreateFromHWND($Handle) $bitmap = _GDIPlus_BitmapCreateFromGraphics( 400 , 22 , $hGraphic ) $backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap) $hBrush = _GDIPlus_BrushCreateSolid(0xFFFFFF00) $hFormat = _GDIPlus_StringFormatCreate( 0x1000 ) $hFamily = _GDIPlus_FontFamilyCreate( "Arial" ) $hFont = _GDIPlus_FontCreate($hFamily, 10 , 1) $tLayout = _GDIPlus_RectFCreate( 0 , 0 , 8192 , 16 ) $aInfo = _GDIPlus_GraphicsMeasureString( $backbuffer , $TextString , $hFont , $tLayout , $hFormat ) _GDIPlus_GraphicsDrawStringEx( $backbuffer , $TextString , $hFont , $aInfo[0] , $hFormat , $hBrush ) AdLibRegister("_slide", 15) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE _GDIPlus_FontDispose($hFont) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() Func _slide() Static $i = 200 _GDIPlus_GraphicsClear ( $backbuffer , 0xFF000000 ) $tLayout = _GDIPlus_RectFCreate( $i , 4 , 8192 , 16 ) $aInfo = _GDIPlus_GraphicsMeasureString( $backbuffer , $TextString , $hFont , $tLayout , $hFormat ) _GDIPlus_GraphicsDrawStringEx( $backbuffer , $TextString , $hFont , $aInfo[0] , $hFormat , $hBrush ) _GDIPlus_GraphicsDrawImageRect( $hGraphic , $bitmap , 0 , 0 , 400 , 22 ) $i = $i -1 If $i < -5000 Then $i = 1 EndFunc Link to comment Share on other sites More sharing options...
Tyranna Posted July 5, 2018 Author Share Posted July 5, 2018 New Information: After about 25 minutes, the overspeeding caused by the mouse movement stoppend and it ran at normal speed again. I have ran the script at least 3 times and at about 25 minutes the scroller behaves normally. Very odd. The scroller , when running at normal speed, is really too slow due to the complexity of the script itself. I do not want to slow it down more that it is. I would however like to speed it up. Decresing the dwell time built into the GUIGetMsg() function would do that. I will try AdLib to update the graphics and let you know. Link to comment Share on other sites More sharing options...
Tyranna Posted July 5, 2018 Author Share Posted July 5, 2018 The Adlib function fixes the mouse speeding up the scroller problem. That is very cool. The scroller behavior is not real smooth anymore. And when I imbed it in my other script it is really really slow. The GuiGetMsg() loop is really slowing this process down. As stated above, A Do Until Loop makes the scroller run very fast , and I can limit easily with with a TimerInit(). But then I do not get the Message Loop. I need a way to make the CPU Idler in the GuiGetMsg() function not restrict the speed so much. Maybe we can make that function adjustable or something. I did notice that the CPU ran at 13% when it was in a Do Until Loop, and 6% when in the GuiGetMsg() loop. There seems to be alot of room for speeding it up. Link to comment Share on other sites More sharing options...
Developers Jos Posted July 5, 2018 Developers Share Posted July 5, 2018 (edited) 8 hours ago, Tyranna said: Really? How does that solve this problem? Really ? what about letting the attitude go, start thinking for a little bit and properly answering that question? Jos Edited July 5, 2018 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Tyranna Posted July 5, 2018 Author Share Posted July 5, 2018 Who are you addressing ? Link to comment Share on other sites More sharing options...
Earthshine Posted July 5, 2018 Share Posted July 5, 2018 you. as the Moderator quoted you My resources are limited. You must ask the right questions 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