Sleep Function is not sleeping. Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
SirSocks
Posts: 360
Joined: 26 Oct 2018, 08:14

Sleep Function is not sleeping.

15 Nov 2019, 15:48

Hello -

I'm having a problem with the sleep function not sleeping.
I have the sleep set to 60000 (60 seconds). But it only sleeps for 0.25 (250 milliseconds). Please see the image below.
Why is this? Does anyone have suggestions to fix it?

Image

This is the first time it's happened to me. Has anyone else experienced this?
All help is appreciated, Thank you.
gregster
Posts: 8988
Joined: 30 Sep 2013, 06:48

Re: Sleep Function is not sleeping.

15 Nov 2019, 16:19

Just a guess:
Make sure that there is no invisible unicode character in this line - sometimes they can get somehow included when you copy and paste code and lead to unexpected results.

I would delete that line and completely re-type it. I hope that works.
But I don't see why the sleep would be 250 ms :think: That's strange.
User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: Sleep Function is not sleeping.

15 Nov 2019, 16:30

Could be getting interrupted from another Thread.
Example:

Code: Select all

#NoEnv

start := A_TickCount
SetTimer, interupt, -250
Sleep 60000
MsgBox % A_TickCount - start
ExitApp

interupt:
    MsgBox, Sleep interrupt
return
Run and when message box is open double click ahk icon and look at the last executed lines.
User avatar
SirSocks
Posts: 360
Joined: 26 Oct 2018, 08:14

Re: Sleep Function is not sleeping.

15 Nov 2019, 17:21

@Xtra I think you may be onto something, as I do have timers in my script. But how would a person avoid this interruption? :eh:
SOTE
Posts: 1426
Joined: 15 Jun 2015, 06:21

Re: Sleep Function is not sleeping.

15 Nov 2019, 23:08

SirSocks wrote:
15 Nov 2019, 15:48
Hello -

I'm having a problem with the sleep function not sleeping.
I have the sleep set to 60000 (60 seconds). But it only sleeps for 0.25 (250 milliseconds). Please see the image below.
Why is this? Does anyone have suggestions to fix it?

Image

This is the first time it's happened to me. Has anyone else experienced this?
All help is appreciated, Thank you.
It's quite impressive that Xtra was able to make a useful guess as to what was going on. But I think you were lucky. In the future, you might want to post more of your program, to actually show what you are doing. Does not have to be the entire program, but at least the complete subroutine or function, so that those who will help can fully understand what you are talking about.

Just saying, because I notice people will oddly hide information, and volunteers will be playing 50 guesses trying to figure out what the OP is talking about.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Descolada, Google [Bot] and 240 guests