What is SetBatchLines? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
masheen
Posts: 295
Joined: 06 Dec 2016, 14:10

What is SetBatchLines?

21 Sep 2017, 19:21

If i set SetBatchLines, -1 script will never sleep, what it is mean?
If i set SetBatchLines, 10ms will script sleep on 10ms after every line? Is it same?

Code: Select all

SetBatchLines, 10ms
A:=1
B:=2
C:=3
ExitApp

Code: Select all

SetBatchLines, -1
A:=1
Sleep, 10
B:=2
Sleep, 10
C:=3
Sleep, 10
ExitApp
But this code will complete after Time: 0.1937

Code: Select all

SetBatchLines, 2000ms
A:=1
B:=2
C:=3
ExitApp
I read help file but i cant understand. Who can tell to me what is it SetBatchLines more clearly?
Also i have this code. If i set bigger value setbatchlines like 2000 i get 1500 clicks per sec, If i set setbatchlines 0 i get 150 clicks per sec. Why?

Code: Select all

setmousedelay 0 
setbatchlines 0
Count = 0
Stop = 0
Return

F2::
ST := A_TickCount
Loop
{
    Click
    Count++
}
Return

Z::
ET := A_TickCount - ST
Clicks_Second := Count / (ET / 1000)
MsgBox %Clicks_Second% clicks per second.`n%Count% clicks total.`n%ET% MS total.
Return
User avatar
Masonjar13
Posts: 1555
Joined: 20 Jul 2014, 10:16
Location: Не Россия
Contact:

Re: What is SetBatchLines?  Topic is solved

21 Sep 2017, 19:46

By default, to not overload the CPU unreasonably, there are built-in sleeps, defined by SetBatchLines. The sleep duration is always 10ms, but the command sets how often the sleep occurs, the variable being either milliseconds or lines. That is, setBatchLines 20ms means that every 20ms the script is running, there will be a 10ms sleep. Alternatively, setBatchLines 20 means that every 20 lines executed, there will be a 10ms sleep.

While the documentation regarding it could be a bit better, I believe it explains it well enough.
OS: Windows 10 Pro | Editor: Notepad++
My Personal Function Library | Old Build - New Build
User avatar
masheen
Posts: 295
Joined: 06 Dec 2016, 14:10

Re: What is SetBatchLines?

21 Sep 2017, 19:50

Masonjar13 wrote:By default, to not overload the CPU unreasonably, there are built-in sleeps, defined by SetBatchLines. The sleep duration is always 10ms, but the command sets how often the sleep occurs, the variable being either milliseconds or lines. That is, setBatchLines 20ms means that every 20ms the script is running, there will be a 10ms sleep. Alternatively, setBatchLines 20 means that every 20 lines executed, there will be a 10ms sleep.

While the documentation regarding it could be a bit better, I believe it explains it well enough.
Your answer more clear for me than the documentation. Maybe someone else will be able to add something to tell. In any case, thanks for the answer.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], jeves, mikeyww, Thorlian and 276 guests