<?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=9018&amp;type=atom" />
	<updated>2013-12-16T13:36:58Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=9018</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как сделать проверку текстового файла на изменение содержимого?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=78194#p78194" />
			<content type="html"><![CDATA[<p>Я написал, что в подопытном файле должен быть 1 байт на 1 символ (не юникод), и строки добавляются вместе с символами переноса строки.<br /></p><div class="fancy_spoiler_switcher"><div class="fancy_spoiler_switcher_header" data-lang-open="открыть спойлер" data-lang-close="скрыть спойлер"><strong>+</strong>&nbsp;открыть спойлер</div><div class="fancy_spoiler"><p><span class="postimg"><img src="http://savepic.net/4015667.png" alt="http://savepic.net/4015667.png" /></span></p></div></div>]]></content>
			<author>
				<name><![CDATA[Irbis]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27384</uri>
			</author>
			<updated>2013-12-16T13:36:58Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=78194#p78194</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как сделать проверку текстового файла на изменение содержимого?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=78193#p78193" />
			<content type="html"><![CDATA[<p>А какие там критерии? Я не умею читать такие сложные коды <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[Captain_SERG]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=31229</uri>
			</author>
			<updated>2013-12-16T13:29:21Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=78193#p78193</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как сделать проверку текстового файла на изменение содержимого?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=78191#p78191" />
			<content type="html"><![CDATA[<p>Значит, файл не подходит под один из критериев, которые я написал ранее (или под оба), и нужен другой подход.<br />На тестовом файле в блокноте все работает и новые строки оперативно отображаются. То есть:<br />11&lt;Enter&gt;&lt;Сохранить&gt;<br />222&lt;Enter&gt;&lt;Сохранить&gt;<br />333&lt;Enter&gt;&lt;Сохранить&gt; и т.д.</p><p>После каждого &lt;Сохранить&gt; новая строка добавляется в окно GUI.</p>]]></content>
			<author>
				<name><![CDATA[Irbis]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27384</uri>
			</author>
			<updated>2013-12-16T12:38:35Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=78191#p78191</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как сделать проверку текстового файла на изменение содержимого?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=78178#p78178" />
			<content type="html"><![CDATA[<p><strong>Irbis</strong>, как-то странно он работает. Указал путь к нужному файлу - скрипт не включался. указал путь к файлу поменьше (1 строчка) - включился, и 1 раз засек изменение в нем. После выключился и больше не включался</p>]]></content>
			<author>
				<name><![CDATA[Captain_SERG]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=31229</uri>
			</author>
			<updated>2013-12-16T09:52:43Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=78178#p78178</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как сделать проверку текстового файла на изменение содержимого?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=78172#p78172" />
			<content type="html"><![CDATA[<p>Ок, сделаем 2 предположения:<br />- Изменения в файле происходят добавлением строк в конец файла, причем строка заканчивается переводом (`r`n) ;<br />- Кодировка файла ANSI, т.е. 1 байт на символ.</p><p>Содержимое файла выводим через GUI, предложенный <strong>ypppu</strong>:<br /></p><div class="codebox"><pre><code>filename = c:\log.txt
lines := 5
GUI, Add, Text, ReadOnly vMyTime, %A_Hour%:%A_Min%:%A_Sec%
GUI, Color, FFFFFF
GUI, Add, Text, vMyText w640 R%lines%, %Content%
GUI, Show

FileGetSize, oldsize, %filename%
newsize := 0
Loop, read, %filename%
{
   newsize += StrLen(A_LoopReadLine)+2 ; ANSI + `r`n
   Content .= A_LoopReadLine . &quot;`n&quot;
   Content := SubStr(Content, InStr(Content, &quot;`n&quot;,0,-1, lines)+1)
   if (oldsize = newsize)
   {
   GuiControl, , MyTime, %A_Hour%:%A_Min%:%A_Sec%
   GuiControl, , MyText, %Content%
   GUI, Color,   FFFF99
   Sleep, 600
   GUI, Color,   FFFFFF
   }
   while oldsize = newsize
   {
      sleep 1000
      FileGetSize, oldsize, %filename%
   }

}

GuiClose:
Gui, Destroy
if !oldsize
   MsgBox Ошибка чтения, или файл &quot;%filename%&quot; не найден!
ExitApp</code></pre></div><p>Я думаю, алгоритм понятен - по достижении конца файла читать по одной строке, сверяя размер файла с количеством прочитанного.</p>]]></content>
			<author>
				<name><![CDATA[Irbis]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27384</uri>
			</author>
			<updated>2013-12-16T05:03:21Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=78172#p78172</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как сделать проверку текстового файла на изменение содержимого?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=78163#p78163" />
			<content type="html"><![CDATA[<p>Ладно, давайте проще: мне нужно чтобы большой файл файл text.txt читался каждую секунду и проецировал текст начиная с нижней строчки в GUI окно</p>]]></content>
			<author>
				<name><![CDATA[Captain_SERG]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=31229</uri>
			</author>
			<updated>2013-12-15T17:19:58Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=78163#p78163</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как сделать проверку текстового файла на изменение содержимого?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=78161#p78161" />
			<content type="html"><![CDATA[<p>В общем автор пошёл сложным путём. Файл может иметь большой размер и изменяться несколько раз в секунду. При этом никаких специальных уведомлений не поступает.</p>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2013-12-15T16:39:51Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=78161#p78161</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как сделать проверку текстового файла на изменение содержимого?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=78156#p78156" />
			<content type="html"><![CDATA[<p>А чем тут предложенный FileGetTime неподходит?</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2013-12-15T15:31:02Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=78156#p78156</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как сделать проверку текстового файла на изменение содержимого?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=78150#p78150" />
			<content type="html"><![CDATA[<p>А какая разница, сколько мегабайт? В любом случае файл нужно полностью считывать. GUI прикрутил для наглядности.</p>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2013-12-15T13:52:32Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=78150#p78150</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как сделать проверку текстового файла на изменение содержимого?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=78144#p78144" />
			<content type="html"><![CDATA[<p>Проверяй размер.</p>]]></content>
			<author>
				<name><![CDATA[Zmey25]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27845</uri>
			</author>
			<updated>2013-12-15T12:31:28Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=78144#p78144</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как сделать проверку текстового файла на изменение содержимого?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=78143#p78143" />
			<content type="html"><![CDATA[<p>Кстати текста там не мало, и мне надо чтобы текст отображался с нижней строчки и шел вверх.<br />На этой картинке показано как именно должно все выглядеть</p>]]></content>
			<author>
				<name><![CDATA[Captain_SERG]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=31229</uri>
			</author>
			<updated>2013-12-15T12:01:25Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=78143#p78143</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как сделать проверку текстового файла на изменение содержимого?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=78138#p78138" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>ypppu пишет:</cite><blockquote><p>GUI, Add, Text, vMyText, %OutputVar1%</p></blockquote></div><p>А если там текста на пару мегабайт? <img src="//forum.script-coding.com/img/smilies/wink.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2013-12-15T10:26:25Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=78138#p78138</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как сделать проверку текстового файла на изменение содержимого?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=78137#p78137" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>FileRead, OutputVar1, FileName.txt
GUI, Add, Text, ReadOnly vMyTime, %A_Hour%:%A_Min%:%A_Sec%
GUI, Color, FFFFFF
GUI, Add, Text, vMyText, %OutputVar1%
GUI, Show, w640 h680

Loop
{
FileRead, OutputVar2, FileName.txt

If OutputVar2 != %OutputVar1%
    {
    GuiControl, , MyTime, %A_Hour%:%A_Min%:%A_Sec%
    OutputVar1 = %OutputVar2%
    GuiControl, , MyText, %OutputVar2%
    GUI, Color,   FFFF99
    Sleep, 600
    GUI, Color,   FFFFFF
    }
Sleep, 2000
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2013-12-15T09:35:34Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=78137#p78137</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как сделать проверку текстового файла на изменение содержимого?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=78134#p78134" />
			<content type="html"><![CDATA[<p><strong>Captain_SERG</strong>, вот <a href="http://forum.script-coding.com/viewtopic.php?id=6273">здесь</a> этот вопрос рассматривался.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2013-12-15T06:49:42Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=78134#p78134</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как сделать проверку текстового файла на изменение содержимого?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=78122#p78122" />
			<content type="html"><![CDATA[<p>Поясню, файл обновляется чуть ли не каждую секунду, и мне надо всего лишь высвечивать его содержимое в окне, и если файл обновляется - обновить проекцию в окно. Вы скажете, что можно просто поставить обновление проекции через каждую секунду. Но я хочу обновлять проекцию минимальное количество раз, только тогда, когда файл дополнился</p>]]></content>
			<author>
				<name><![CDATA[Captain_SERG]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=31229</uri>
			</author>
			<updated>2013-12-14T19:08:10Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=78122#p78122</id>
		</entry>
</feed>
