algiuxas Posted July 19, 2016 Posted July 19, 2016 (edited) Hello, When I move GUI, script pause until I release GUI. I need to make script not pause while dragging GUI. GUICreate("Hello world!",250,175,-1,-1) Opt("GUIOnEventMode", 1) GUISetOnEvent(-3, "exit_") ; Check if closed GUISetState() While 1 ToolTip("This tooltip should move.") Sleep(50) WEnd Func exit_() GUIDelete() Exit EndFunc Edited July 19, 2016 by algiuxas After switching years ago to Linux, sadly I don't use AutoIt anymore.
Moderators JLogan3o13 Posted July 19, 2016 Moderators Posted July 19, 2016 @algiuxas we can't offer much in the way of help when you don't include any of your code. Obviously, we have many GUI scripts on this forum, and they aren't all freezing when dragged, so there is something going on in your script specifically. Rather than having us consult our crystal ball, how about posting your code? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
algiuxas Posted July 19, 2016 Author Posted July 19, 2016 (edited) 30 minutes ago, JLogan3o13 said: @algiuxas we can't offer much in the way of help when you don't include any of your code. Obviously, we have many GUI scripts on this forum, and they aren't all freezing when dragged, so there is something going on in your script specifically. Rather than having us consult our crystal ball, how about posting your code? GUICreate("Hello world!",250,175,-1,-1) Opt("GUIOnEventMode", 1) GUISetOnEvent(-3, "exit_") ; if closed, exit. GUISetState() While 1 ToolTip("This tooltip should move.") Sleep(50) WEnd Func exit_() GUIDelete() Exit EndFunc I wrote this right now, and it still haves the same problem, script pauses while moving GUI.I mean that it pauses, I didn't mean that it crashes, exits or etc., sorry. Edited July 19, 2016 by algiuxas After switching years ago to Linux, sadly I don't use AutoIt anymore.
UEZ Posted July 19, 2016 Posted July 19, 2016 Try this: #Include <Timers.au3> #include <WindowsConstants.au3> Global $hGUI = GUICreate("Hello world!",250,175,-1,-1) Opt("GUIOnEventMode", 1) GUISetOnEvent(-3, "exit_") ; Check if closed GUISetState() Global $iMs = 30 GUIRegisterMsg($WM_TIMER, "_Interrupt") DllCall("User32.dll", "int", "SetTimer", "hwnd", $hGUI, "int", 0, "int", $iMs, "int", 0) While 1 Sleep(50) WEnd Func exit_() GUIRegisterMsg($WM_TIMER, "") GUIDelete() Exit EndFunc Func _Interrupt() ToolTip("This tooltip should move.") EndFunc algiuxas 1 Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
algiuxas Posted July 19, 2016 Author Posted July 19, 2016 1 minute ago, UEZ said: Try this: #Include <Timers.au3> #include <WindowsConstants.au3> Global $hGUI = GUICreate("Hello world!",250,175,-1,-1) Opt("GUIOnEventMode", 1) GUISetOnEvent(-3, "exit_") ; Check if closed GUISetState() Global $iMs = 30 GUIRegisterMsg($WM_TIMER, "_Interrupt") DllCall("User32.dll", "int", "SetTimer", "hwnd", $hGUI, "int", 0, "int", $iMs, "int", 0) While 1 Sleep(50) WEnd Func exit_() GUIRegisterMsg($WM_TIMER, "") GUIDelete() Exit EndFunc Func _Interrupt() ToolTip("This tooltip should move.") EndFunc Thanks, but this loop took about 40 milisecounds, is there a way to make it faster, like in a normal loop(0.01ms)? After switching years ago to Linux, sadly I don't use AutoIt anymore.
BrewManNH Posted July 19, 2016 Posted July 19, 2016 Actually, with a 50ms sleep in there it takes at least 50ms. You can't use a sleep value under 10ms, sleep won't go lower. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator
algiuxas Posted July 19, 2016 Author Posted July 19, 2016 Just now, BrewManNH said: Actually, with a 50ms sleep in there it takes at least 50ms. You can't use a sleep value under 10ms, sleep won't go lower. I tested it without sleep After switching years ago to Linux, sadly I don't use AutoIt anymore.
UEZ Posted July 19, 2016 Posted July 19, 2016 (edited) FYI: The function _Interrupt() is called every 30 ms. Global $iMs = 30 Edited July 19, 2016 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
algiuxas Posted July 19, 2016 Author Posted July 19, 2016 Just now, UEZ said: FYI: The function _Interrupt() is called every 30 ms. Thank you, didn't saw that. After switching years ago to Linux, sadly I don't use AutoIt anymore.
algiuxas Posted July 19, 2016 Author Posted July 19, 2016 (edited) I found a problem - if it's a big script or it took long to execute it, it will pause anyway. Edited July 19, 2016 by algiuxas After switching years ago to Linux, sadly I don't use AutoIt anymore.
algiuxas Posted July 19, 2016 Author Posted July 19, 2016 (edited) This doesn't work... #Include <Timers.au3> #include <WindowsConstants.au3> Global $hGUI = GUICreate("Hello world!",250,175,-1,-1) Opt("GUIOnEventMode", 1) GUISetOnEvent(-3, "exit_") ; Check if closed GUISetState() Global $t = TimerInit() Global $iMs = 0 GUIRegisterMsg($WM_TIMER, "_Interrupt") DllCall("User32.dll", "int", "SetTimer", "hwnd", $hGUI, "int", 0, "int", $iMs, "int", 0) While 1 ToolTip("h") WEnd Func exit_() GUIRegisterMsg($WM_TIMER, "") GUIDelete() Exit EndFunc Func _Interrupt() ToolTip(TimerDiff($t)&@CRLF) sleep(Random(50,1000,1) $t = TimerInit() EndFunc I need another way to avoid pausing the script while moving/resizing GUI, because I'm not sure how much time will one loop took. Edited July 19, 2016 by algiuxas After switching years ago to Linux, sadly I don't use AutoIt anymore.
UEZ Posted July 19, 2016 Posted July 19, 2016 I think you don't have understand the timer functionality. The script will interrupt the execution every 30ms to call the _Interrupt(). When you put a sleep within that function the functionality of the timer will get obsolete. You have to put the code which should run in any case to the _Interrupt() function. I don't know what is not working in your big script. Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
Leo1906 Posted September 12, 2016 Posted September 12, 2016 On 19.7.2016 at 11:14 PM, UEZ said: The script will interrupt the execution every 30ms to call the _Interrupt(). When you put a sleep within that function the functionality of the timer will get obsolete. If it interrupts the script execution .. what is the difference to Adlib? Why not just register the function as adlib? On 19.7.2016 at 10:28 PM, BrewManNH said: Actually, with a 50ms sleep in there it takes at least 50ms. You can't use a sleep value under 10ms, sleep won't go lower. Isn't Sleep(1) a possibillity and below 10 ms? i thought I read so
UEZ Posted September 12, 2016 Posted September 12, 2016 26 minutes ago, Leo1906 said: f it interrupts the script execution .. what is the difference to Adlib? Why not just register the function as adlib? Adlib doesn't let continue the script on GUI move. Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
Leo1906 Posted September 12, 2016 Posted September 12, 2016 1 minute ago, UEZ said: Adlib doesn't let continue the script on GUI move. Ok thank you for the explanation Learned something new
AutoBert Posted September 13, 2016 Posted September 13, 2016 9 hours ago, Leo1906 said: Isn't Sleep(1) a possibillity and below 10 ms? i thought I read so it's below 10 but the shortest possible sleep is 10 so sleep(1), sleep(5) and sleep(10) will effect the same.
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