<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK: Sleep короче 10 мс]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=18306</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=18306&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: Sleep короче 10 мс».]]></description>
		<lastBuildDate>Fri, 18 Oct 2024 10:13:28 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: Sleep короче 10 мс]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=161690#p161690</link>
			<description><![CDATA[<p><strong>teadrinker</strong>спасибо за ответ. </p><p>Если (!!!) интерпретатор LUA в LGS использует стандартную системную функцию, а не что-то свое.</p>]]></description>
			<author><![CDATA[null@example.com (RacalCucumber)]]></author>
			<pubDate>Fri, 18 Oct 2024 10:13:28 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=161690#p161690</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Sleep короче 10 мс]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=161648#p161648</link>
			<description><![CDATA[<div class="quotebox"><cite>RacalCucumber пишет:</cite><blockquote><p>Есть ли еще какие то способы получить короткие значения Sleep из AHK?</p></blockquote></div><p>Сам AHK или LUA тут не при чём, минимальный интервал зависит от разрешения системного таймера, которое в обычном режиме соответствует примерно 15 мс. Winapi функция timeBeginPeriod может уменьшить это разрешение (что вызывает повышенную нагрузку на систему).</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Fri, 27 Sep 2024 14:17:22 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=161648#p161648</guid>
		</item>
		<item>
			<title><![CDATA[AHK: Sleep короче 10 мс]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=161647#p161647</link>
			<description><![CDATA[<p>Да, спасибо, я читал https://www.autohotkey.com/docs/v1/lib/Sleep.htm и видел пример с изменением параметра timeBeginPeriod и вызова Sleep через DLL. </p><p>Два вопроса. <br />- Есть ли еще какие то способы получить короткие значения Sleep из AHK?<br />- В оболочке логитеха G-Hub для игровой переферии в сценарии Lua короткие задержки реализуются через вызов следующей подпрограммы:<br /></p><div class="codebox"><pre><code>function Sleep_Short(time)
    local a = GetRunningTime()
    while GetRunningTime()-a &lt; time do
    end
end
</code></pre></div><p>Ни кто не знает, насколько данное решение в Lua сходна с AHK решением из примера в статье про Sleep?</p><div class="codebox"><pre><code>SetBatchLines -1  ; Ensures maximum effectiveness of this method.

SleepDuration := 1  ; This can sometimes be finely adjusted (e.g. 2 is different than 3) depending on the value below.
TimePeriod := 3 ; Try 7 or 3.  See comment below.
; On a PC whose sleep duration normally rounds up to 15.6 ms, try TimePeriod:=7 to allow
; somewhat shorter sleeps, and try TimePeriod:=3 or less to allow the shortest possible sleeps.

DllCall(&quot;Winmm\timeBeginPeriod&quot;, &quot;UInt&quot;, TimePeriod)  ; Affects all applications, not just this script&#039;s DllCall(&quot;Sleep&quot;...), but does not affect SetTimer.
Iterations := 50
StartTime := A_TickCount

Loop %Iterations%
    DllCall(&quot;Sleep&quot;, &quot;UInt&quot;, SleepDuration)  ; Must use DllCall instead of the Sleep command.

DllCall(&quot;Winmm\timeEndPeriod&quot;, &quot;UInt&quot;, TimePeriod)  ; Should be called to restore system to normal.
MsgBox % &quot;Sleep duration = &quot; . (A_TickCount - StartTime) / Iterations</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (RacalCucumber)]]></author>
			<pubDate>Fri, 27 Sep 2024 08:15:31 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=161647#p161647</guid>
		</item>
	</channel>
</rss>
