ankitstr Posted July 30, 2009 Share Posted July 30, 2009 Hi all, I am trying to script a simulator for my final year project in university using Autoitv3. The project involves moving different objects around in the graphics area. I have created the following script to simulate the problem I am having. It appears that the GUICtrlSetPos() function that I am using to reposition the graphics is taking more and more time after each execution. Is it a bug in Autoit? or Am I doing something wrong? ; Script to simulate a bug in Autoit. #include <GUIConstantsEx.au3> AdlibEnable("GUIUpdate",20) GUICreate("THIS IS A TEST",400,400) GUICtrlCreateGraphic(10,10,380,380) GUICtrlSetBkColor(-1,0xffffff) GUICtrlSetColor(-1,0) Global $box=GUICtrlCreateGraphic(20,20,20,20) GUICtrlSetGraphic($box,$GUI_GR_PENSIZE,2) GUICtrlSetGraphic($box, $GUI_GR_COLOR,0,0xc0c0ff) GUICtrlSetGraphic($box,$GUI_GR_RECT,1,1,18,18) GUISetState(@SW_SHOW) Sleep(3000) While 1 If GUIGetMsg()=$GUI_EVENT_CLOSE Then ExitLoop WEnd GUIDelete() Func GUIUpdate() AdlibDisable() GUICtrlSetGraphic($box,$GUI_GR_PENSIZE,2) GUICtrlSetGraphic($box,$GUI_GR_COLOR,0xff0000,0x00ffff) GUICtrlSetGraphic($box,$GUI_GR_RECT,1,1,18,18) Local $time=TimerInit() GUICtrlSetPos($box,Random(10,360,1),Random(10,360,1)) $time=TimerDiff($time) ToolTip("TimeTaken: "&$time) AdlibEnable("GUIUpdate",10) EndFunc Any help would be much appreciated. Thanks in advance, Ankit [topic="80940"] AutoScript Creator, Script to automate anything![/topic] Link to comment Share on other sites More sharing options...
Yoriz Posted July 30, 2009 Share Posted July 30, 2009 Looks like you are getting an ever increasing amount of GUIUpdate func running due to you are calling up AdlibEnable("GUIUpdate",20) so every 20 secs it runs it gets to the line AdlibEnable("GUIUpdate",10) inside the function and sets up an increasing amount of functions runing every 10 secs. GDIPlusDispose - A modified version of GDIPlus that auto disposes of its own objects before shutdown of the Dll using the same function Syntax as the original.EzMySql UDF - Use MySql Databases with autoit with syntax similar to SQLite UDF. Link to comment Share on other sites More sharing options...
ankitstr Posted July 30, 2009 Author Share Posted July 30, 2009 Looks like you are getting an ever increasing amount of GUIUpdate func running due to you are calling up AdlibEnable("GUIUpdate",20) so every 20 secs it runs it gets to the line AdlibEnable("GUIUpdate",10) inside the function and sets up an increasing amount of functions runing every 10 secs.Thanks for the reply, but that is not the case, since I disable the adlib function at the start of the function call.If you run the script, and monitor the time in the tooltip, it keeps on increasing. [topic="80940"] AutoScript Creator, Script to automate anything![/topic] Link to comment Share on other sites More sharing options...
Yoriz Posted July 30, 2009 Share Posted July 30, 2009 Ok sorry didnt realise that , i found commenting out the folowing lines in the function ;~ GUICtrlSetGraphic($box,$GUI_GR_PENSIZE,2) ;~ GUICtrlSetGraphic($box,$GUI_GR_COLOR,0xff0000,0x00ffff) ;~ GUICtrlSetGraphic($box,$GUI_GR_RECT,1,1,18,18) makes the timer stay the same, strange but some where to start from maybe ? GDIPlusDispose - A modified version of GDIPlus that auto disposes of its own objects before shutdown of the Dll using the same function Syntax as the original.EzMySql UDF - Use MySql Databases with autoit with syntax similar to SQLite UDF. Link to comment Share on other sites More sharing options...
ankitstr Posted July 30, 2009 Author Share Posted July 30, 2009 Ok sorry didnt realise that , i found commenting out the folowing lines in the function;~ GUICtrlSetGraphic($box,$GUI_GR_PENSIZE,2);~ GUICtrlSetGraphic($box,$GUI_GR_COLOR,0xff0000,0x00ffff);~ GUICtrlSetGraphic($box,$GUI_GR_RECT,1,1,18,18)makes the timer stay the same, strange but some where to start from maybe ?Yeah, right, but any idea why it might be doing that? Looks like an internal bug to me. [topic="80940"] AutoScript Creator, Script to automate anything![/topic] Link to comment Share on other sites More sharing options...
jpm Posted July 30, 2009 Share Posted July 30, 2009 in the adlib function you aree adding more and more graphics so the redrawing need to do more job >_ 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