Jump to content

Recommended Posts

Posted (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 by algiuxas

After switching years ago to Linux, sadly I don't use AutoIt anymore.

  • Moderators
Posted

@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!

Posted (edited)
  On 7/19/2016 at 7:36 PM, 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? ;)

Expand  
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 by algiuxas

After switching years ago to Linux, sadly I don't use AutoIt anymore.

Posted

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

 

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Posted
  On 7/19/2016 at 8:13 PM, 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

 

Expand  

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.

Posted

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 Gude
How to ask questions the smart way!

  Reveal hidden contents

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

Posted
  On 7/19/2016 at 8: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.

Expand  

I tested it without sleep :)

After switching years ago to Linux, sadly I don't use AutoIt anymore.

Posted (edited)

I found a problem - if it's a big script or it took long to execute it, it will pause anyway.

Edited by algiuxas

After switching years ago to Linux, sadly I don't use AutoIt anymore.

Posted (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 by algiuxas

After switching years ago to Linux, sadly I don't use AutoIt anymore.

Posted

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

  • 1 month later...
Posted
  On 7/19/2016 at 9: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.

Expand  

If it interrupts the script execution .. what is the difference to Adlib? Why not just register the function as adlib?

 

  On 7/19/2016 at 8: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.

Expand  

Isn't Sleep(1) a possibillity and below 10 ms?
i thought I read so

Posted
  On 9/12/2016 at 9:54 PM, Leo1906 said:

f it interrupts the script execution .. what is the difference to Adlib? Why not just register the function as adlib?

Expand  

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...