<?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="https://forum.script-coding.com/extern.php?action=feed&amp;tid=15226&amp;type=atom" />
	<updated>2020-03-08T18:55:25Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=15226</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Беспрерывное чтение файла]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=138389#p138389" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>File := FileOpen(&quot;input.txt&quot;, &quot;r&quot;)
Loop {
	while (File.AtEOF)
		Sleep 1
	strings := File.Read()
	/*
		Что-то делаем со %strings%.

		Следует учитывать, что последняя строка могла быть прочитана
		не полностью и её следует запомнить и добавить в начало
		следующей считанной части.
	*/
}
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[wisgest]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=3850</uri>
			</author>
			<updated>2020-03-08T18:55:25Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=138389#p138389</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Беспрерывное чтение файла]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=138388#p138388" />
			<content type="html"><![CDATA[<p>Таймеры: <a href="http://www.script-coding.com/AutoHotkey/SetTimer.html">http://www.script-coding.com/AutoHotkey/SetTimer.html</a></p>]]></content>
			<author>
				<name><![CDATA[Foma]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=31521</uri>
			</author>
			<updated>2020-03-08T18:17:24Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=138388#p138388</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Беспрерывное чтение файла]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=138387#p138387" />
			<content type="html"><![CDATA[<p><strong>stealzy</strong><br />Ситуация описанная с использованием таймера.</p>]]></content>
			<author>
				<name><![CDATA[Anton.Badonov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40556</uri>
			</author>
			<updated>2020-03-08T18:05:17Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=138387#p138387</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Беспрерывное чтение файла]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=138386#p138386" />
			<content type="html"><![CDATA[<p>Навскидку — у вас два бесконечных цикла. Нить выполнения только одна, и, соответственно, цикл будет крутиться только последний запущенный, а предпоследний замрет в ожидании выхода из последнего.</p><p>Решение попроще - уместить все в один цикл, посложнее — переделать на таймеры.<br /><span style="color: grey">И прекратите пытать знаки пунктуации.</span></p>]]></content>
			<author>
				<name><![CDATA[stealzy]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=31937</uri>
			</author>
			<updated>2020-03-08T17:25:11Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=138386#p138386</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Беспрерывное чтение файла]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=138382#p138382" />
			<content type="html"><![CDATA[<p>Добрый день .<br />Пользуюсь кодом . <br />Он должен считывать файл в&nbsp; цикле и каждый раз новые строки . <br />Но считывание происходит только единожды при запуске . <br />Вот &quot; читающая часть&quot;<br /></p><div class="codebox"><pre><code>
loop, read, combat.log
{
	if (lastLine.combat &gt;= A_Index)
		Continue

	lastLine.combat := A_Index
	str := RegExReplace(A_LoopReadLine, &quot;\s+&quot;, A_Space)
	str := RegExReplace(str, &quot;^\d+:\d+:[\.\d+]+\|\s+&quot;)

	if (str ~= &quot;Active battle started\.&quot;)	
	{
		Active := A_TickCount
	}
	else if (str ~=  &quot;attacker:\s+&quot; nickName1)
		{
			Active2 := A_TickCount
		}
	else if (str ~=  &quot;killer:\s+&quot; nickName1)
		{
            Active3 := A_TickCount
		}
    else if (str ~=  &quot;Victim:\s+&quot; nickName1)
		{
			Active4 := A_TickCount
		}
	else if (str ~=  &quot;Kill\. Victim:\s+&quot; nickName1)
		{
			Active5 := A_TickCount
		}
} 
</code></pre></div><p>А вот часть которая выводит переменные . <br /></p><div class="codebox"><pre><code>
loop
{
		if (A_TickCount - Active &lt;= 500)
		{
           pic = 5
		}
		else if (A_tickCount - Active2 &lt;= 500)
		{
			pic = 2				
		}
		else if (A_tickCount - Active3 &lt;= 500)
		{
			pic = 3		
		}
		else if (A_tickCount - Active4 &lt;= 500)
		{	 
		   pic = 2  
		}
		else if (A_tickCount - Active5 &lt;= 500)
		{
			pic = 4
		}
}
</code></pre></div><p>Ник берется выше читающей части и помещается в переменную nickName1</p><p>Вот пример того , как выглядит файл который читается . <br />08:54:49.990| Active battle started.<br />09:00:18.024| Damage. Victim: Sophia&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; , attacker: MS_ONE&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;, weapon &#039;CarPart_Gun_BigCannon_EX_Relic&#039;, damage: 929.58 DMG_BLAST|CAR_PART|IGNORE_DAMAGE_SCALE<br />09:00:30.137| Damage. Victim: MS_ONE&nbsp; &nbsp; &nbsp; &nbsp; , attacker: Christopher&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;, weapon &#039;CarPart_Gun_Shotgun_epic&#039;, damage: 5.90 DMG_DIRECT|CAR_PART|HIGH_FIRE_RATE<br />09:22:45.333| Kill. Victim: TestDriveCar2&nbsp; &nbsp; &nbsp; &nbsp; killer: MS_ONE<br />09:29:13.630| Kill. Victim: MS_ONE&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; killer: n/a&nbsp; &nbsp;</p><br /><p>Вывод сообщений на экран через GDIP . ( эта часть кода работает , проверялась с другими чтениями )<br />Подскажите в чем проблема .</p>]]></content>
			<author>
				<name><![CDATA[Anton.Badonov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40556</uri>
			</author>
			<updated>2020-03-08T07:08:30Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=138382#p138382</id>
		</entry>
</feed>
