<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Loop и SetTimer]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=11594&amp;type=atom" />
	<updated>2016-05-17T03:05:50Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=11594</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Loop и SetTimer]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=103867#p103867" />
			<content type="html"><![CDATA[<p>Не знаю в чем вчера причина была, но сейчас буквально изменил строки какие нужно искать и ваш скрипт заработал. Спасибо.</p>]]></content>
			<author>
				<name><![CDATA[SeaVodikendu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33752</uri>
			</author>
			<updated>2016-05-17T03:05:50Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=103867#p103867</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Loop и SetTimer]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=103855#p103855" />
			<content type="html"><![CDATA[<p>А я не проверяю?</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2016-05-16T16:22:30Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=103855#p103855</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Loop и SetTimer]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=103853#p103853" />
			<content type="html"><![CDATA[<p><strong>serzh82saratov</strong><br />Не может быть. Я ведь сперва на шаблоне проверяю и в вручную сам добавляю.</p>]]></content>
			<author>
				<name><![CDATA[SeaVodikendu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33752</uri>
			</author>
			<updated>2016-05-16T15:57:59Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=103853#p103853</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Loop и SetTimer]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=103852#p103852" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>SeaVodikendu пишет:</cite><blockquote><p>Бесконечный поиск после &quot;MsgBox Search text11&quot;.</p></blockquote></div><p>Значит <span class="bbu">после запуска</span> скрипта в <span class="bbu">указанный вами</span> файл не добавляется строка с содержимым &quot;text11&quot;.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2016-05-16T14:03:49Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=103852#p103852</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Loop и SetTimer]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=103851#p103851" />
			<content type="html"><![CDATA[<p><strong>serzh82saratov</strong><br />Ваш код у меня не работает. Бесконечный поиск после &quot;MsgBox Search text11&quot;.<br />Но вы неумышленно помогли разобраться мне в &quot;A_TickCount&quot; и я просто присобачил его к моему коду. <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[SeaVodikendu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33752</uri>
			</author>
			<updated>2016-05-16T13:48:38Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=103851#p103851</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Loop и SetTimer]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=103847#p103847" />
			<content type="html"><![CDATA[<div class="quotebox"><blockquote><p>последняя оказывается пустой</p></blockquote></div><p>Это без разницы, а вот если добавит больше 2 строк между проверками файла, то можно пропустить.<br />В PathLog указать путь к файлу.<br /></p><div class="codebox"><pre><code>
PathLog := A_ScriptFullPath
File := FileOpen(PathLog, &quot;r`n&quot;), File.Pos := File.Length

Search:
	MsgBox Search text11
	Match := 0
	While !Match
	{ 
		Loop, Parse, % File.Read(), `n 
			If (Instr(A_LoopField, &quot;text11&quot;) &amp;&amp; Match := 1)
				Break
		File.Pos := File.Length
		Sleep 200
	} 
	
	MsgBox Search text22
	Match := 0, Start := A_TickCount
	While !Match
	{
		If (A_TickCount - Start &gt;= 10000)
			Break 
		Loop, Parse, % File.Read(), `n
			If (Instr(A_LoopField, &quot;text22&quot;) &amp;&amp; Match := 1)
				Break
		File.Pos := File.Length
		Sleep 200
	}
	If !Match
		GoTo, Search

	MsgBox ExitApp
	ExitApp
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2016-05-16T11:31:10Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=103847#p103847</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Loop и SetTimer]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=103846#p103846" />
			<content type="html"><![CDATA[<p>Да, именно. Но бывает лог файл добавляет строку так, что последняя оказывается пустой.</p>]]></content>
			<author>
				<name><![CDATA[SeaVodikendu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33752</uri>
			</author>
			<updated>2016-05-16T11:26:19Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=103846#p103846</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Loop и SetTimer]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=103841#p103841" />
			<content type="html"><![CDATA[<p>Нет, я про то что почему 2 последние строки. У вас наверное речь про лог файл, и интересны просто новые добавленные данные...</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2016-05-16T10:48:11Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=103841#p103841</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Loop и SetTimer]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=103839#p103839" />
			<content type="html"><![CDATA[<p><strong>serzh82saratov</strong><br />Проверка последней и предпоследней строки.<br />Вы хотите сказать что второй &quot;Loop&quot; конфликтует с &quot;text11&quot; из первого?</p>]]></content>
			<author>
				<name><![CDATA[SeaVodikendu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33752</uri>
			</author>
			<updated>2016-05-16T10:44:28Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=103839#p103839</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Loop и SetTimer]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=103838#p103838" />
			<content type="html"><![CDATA[<div class="quotebox"><blockquote><p>идет поиск&nbsp; строки &quot;text11&quot; в файле.</p></blockquote></div><div class="quotebox"><blockquote><p>в файле появится строка &quot;text22&quot;</p></blockquote></div><div class="codebox"><pre><code>Loop, read, %path%tex.txt
   {
    pred_line := last_line
    last_line := A_LoopReadLine
}
   if (last_line = &quot;text22&quot; or pred_line = &quot;text22&quot;)</code></pre></div><p>Интересуют только 2 последние строки?</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2016-05-16T10:02:13Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=103838#p103838</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Loop и SetTimer]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=103833#p103833" />
			<content type="html"><![CDATA[<p>Здравствуйте.<br />Помогите разобраться с SetTimer.<br />Что должно быть:<br />После запуска скрипта идет поиск&nbsp; строки &quot;text11&quot; в файле.<br />Когда находит, переход к &quot;Loop&quot; с &quot;SetTimer&quot;.<br />Далее, если в течении (не по прошествии) 10 секунд в файле появится строка &quot;text22&quot;, сразу переход к &quot;Metka3&quot; (завершает скрипт).<br />Если не находит строку, переход к &quot;Metka1&quot; (начинает заново).</p><p>Мой вариант совсем не так работает:<br /></p><div class="codebox"><pre><code>#Persistent

Metka1:
Loop, read, %path%tex.txt
   {
    pred_line := last_line
    last_line := A_LoopReadLine
}
   if (last_line = &quot;text11&quot; or pred_line = &quot;text11&quot;)
{     
A=1
MsgBox, Таймер вкл. Переход к Metka2
goto, Metka2
}
If !a
{
goto, Metka1
}
return

Metka2:
SetTimer, tover, 10000
F=0
Loop, read, %path%tex.txt
   {
    pred_line := last_line
    last_line := A_LoopReadLine
}
   if (last_line = &quot;text22&quot; or pred_line = &quot;text22&quot;)
{     
F=1
SetTimer, tover, off
MsgBox, Таймер выкл. Переход к Metka3
goto, Metka3
}
return
tover:
MsgBox, Время вышло. Переход к Metka1
goto, Metka1
return

Metka3:
MsgBox, Ok
ExitApp
return</code></pre></div>]]></content>
			<author>
				<name><![CDATA[SeaVodikendu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33752</uri>
			</author>
			<updated>2016-05-16T09:23:30Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=103833#p103833</id>
		</entry>
</feed>
