<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Будильник]]></title>
	<link rel="self" href="http://forum.script-coding.com/extern.php?action=feed&amp;tid=11237&amp;type=atom" />
	<updated>2016-01-21T01:31:19Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.script-coding.com/viewtopic.php?id=11237</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Будильник]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=100566#p100566" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Malcev пишет:</cite><blockquote><p>Можно для большей точности отнимать от sleep A_Msec, а как точнее не подскажу.<br /></p><div class="codebox"><pre><code>Sleep, % target * 1000 - A_Msec</code></pre></div></blockquote></div><p>Спасибо, мне чуть позже та же мысль пришла. Хотя мне кажется здесь A_Msec будет брать текущий показатель милисекунд, а за время исполнения программы он немного измениться, так что точность будет меньше. Ну это чепуха конечно.</p><div class="quotebox"><cite>Flasher пишет:</cite><blockquote><p>Зачем дополнительно нагружать трей ещё одним процессом?</p></blockquote></div><p>Я хочу лучше разобраться в AHK на примерах, все таки он дает достаточно широкие возможности.</p>]]></content>
			<author>
				<name><![CDATA[ThrowSum]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=33610</uri>
			</author>
			<updated>2016-01-21T01:31:19Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=100566#p100566</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Будильник]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=100512#p100512" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>ThrowSum пишет:</cite><blockquote><p>Ну если бы просто нужно было запустить программу, я бы не интересовался AutoHotkey.</p></blockquote></div><p>Это не объясняет то, чем планировщик в данном случае не годится. Запускать оттуда сценарий/скрипт никто не мешает. Taskend грузится в трей по умолчанию. Зачем дополнительно нагружать трей ещё одним процессом?</p>]]></content>
			<author>
				<name><![CDATA[Flasher]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27593</uri>
			</author>
			<updated>2016-01-19T15:52:03Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=100512#p100512</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Будильник]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=100499#p100499" />
			<content type="html"><![CDATA[<p>Можно для большей точности отнимать от sleep A_Msec, а как точнее не подскажу.<br /></p><div class="codebox"><pre><code>target_time = 1205   ; 12:05
target := A_YYYY A_MM A_DD target_time 00
if (target &lt; A_Now)
   EnvAdd, target, 1, d
EnvSub, target, %A_Now%, Seconds
Sleep, % target * 1000 - A_Msec
msgbox % A_Hour &quot;:&quot; A_Min &quot;:&quot; A_Sec &quot;:&quot; A_MSec </code></pre></div>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2016-01-19T02:27:02Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=100499#p100499</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Будильник]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=100498#p100498" />
			<content type="html"><![CDATA[<p><strong>Malcev</strong>, огромное спасибо за помощь, именно так я и представлял этот будильник, простой и без циклов.</p><p>Сначала все вообще устроило, но возникла проблема - я начал тестировать таймер и вижу, что срабатывает не всегда в 12:05 например, а иногда секундой позже. Вот здесь я затупил, подумал, что это из-за лагов каких, нагрузки компа, поставил -300мс на Sleep, тогда он начала срабатывать иногда на 12:04:59 с хвостиком. Подумал, что на большем отрезке будет и больше погрешность. Потом пришло в голову - задавая Sleep мы ведь не учитываем миллисекунды! То есть все зависит когда я запущу этот скрипт, отсюда и получается точность в +\- секунду.</p><p>Вот первое, что пришло в голову, это работает, но ужасно тупо решено. Пока A_MSec будет равно нулю проходят секунд 15, задержку Sleep меньше 10 вроде бессмысленно ставить. Ну и задача запустить таймер в 0 миллисекунд, когда они не будут влиять на точность срабатывания в секундах. <br />Как правильно это сделать?<br /></p><div class="codebox"><pre><code>while (A_MSec != 0)
    {
	Sleep, 10
    }

target_time = 120500   ; 12:05
...</code></pre></div>]]></content>
			<author>
				<name><![CDATA[ThrowSum]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=33610</uri>
			</author>
			<updated>2016-01-19T00:14:46Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=100498#p100498</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Будильник]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=100489#p100489" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>target_time = 1205   ; 12:05
target := A_YYYY A_MM A_DD target_time 00
if (target &lt; A_Now)
   EnvAdd, target, 1, d
EnvSub, target, %A_Now%, Seconds
Sleep, % target * 1000
msgbox Alarm!</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2016-01-18T11:37:40Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=100489#p100489</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Будильник]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=100488#p100488" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Flasher пишет:</cite><blockquote><p><strong>taskschd.msc /s</strong> без всякого AHK.</p></blockquote></div><p>Ну если бы просто нужно было запустить программу, я бы не интересовался AutoHotkey. Остальные действия мне более-менее понятны. А вот как отследить такое событие как время, например 12:05 не знаю. Предположения есть, запустить цикл, проверять переменную с временем, но опять же я практически не знаю AHK. Хотелось бы совета как это делают или ссылку на рабочий пример.<br />Боюсь, что у меня будут какие-то бесконечные циклы, которые загрузят процессор под завязку.</p><div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p><span style="color: green"><strong>ThrowSum</strong>, ознакомьтесь с <a href="http://forum.script-coding.com/viewtopic.php?id=6148">этой</a> темой, отредактируйте заголовок.</span></p></blockquote></div><p>Поправил.</p>]]></content>
			<author>
				<name><![CDATA[ThrowSum]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=33610</uri>
			</author>
			<updated>2016-01-18T11:33:02Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=100488#p100488</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Будильник]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=100466#p100466" />
			<content type="html"><![CDATA[<p><span style="color: green"><strong>ThrowSum</strong>, ознакомьтесь с <a href="http://forum.script-coding.com/viewtopic.php?id=6148">этой</a> темой, отредактируйте заголовок.</span></p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2016-01-18T05:50:56Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=100466#p100466</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Будильник]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=100464#p100464" />
			<content type="html"><![CDATA[<p><strong>taskschd.msc /s</strong> без всякого AHK.</p>]]></content>
			<author>
				<name><![CDATA[Flasher]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27593</uri>
			</author>
			<updated>2016-01-18T01:37:17Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=100464#p100464</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Будильник]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=100463#p100463" />
			<content type="html"><![CDATA[<p>По сути нужно создать подобие будильника - например при достижении времени в 12:00 запускается определенная программа.<br />Подскажите как реализовать проще и правильнее.</p>]]></content>
			<author>
				<name><![CDATA[ThrowSum]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=33610</uri>
			</author>
			<updated>2016-01-18T01:25:56Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=100463#p100463</id>
		</entry>
</feed>
