<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; Нажатие клавиши по появлении определенной строки в файле]]></title>
		<link>http://forum.script-coding.com/viewtopic.php?id=7477</link>
		<atom:link href="http://forum.script-coding.com/extern.php?action=feed&amp;tid=7477&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «Нажатие клавиши по появлении определенной строки в файле».]]></description>
		<lastBuildDate>Tue, 09 Aug 2016 06:36:09 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Нажатие клавиши по появлении определенной строки в файле]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=106676#p106676</link>
			<description><![CDATA[<p>Можете дать готовый скрипт который. при появлении заданного вопроса в txt файле отвечает на него заданным ответом.<br />Вот пример из чатлога:</p><p>[07:02:13] <strong>Ivan_Ivanov[228]:</strong> <span class="bbu">Как дела?</span></p><p>И чтобы примерно через секунду был дан ответ на это (/sms 228 Хорошо.). ИД и Ник разные, но такого формата чтобы скрипт читал текст только.</p>]]></description>
			<author><![CDATA[null@example.com (Palah)]]></author>
			<pubDate>Tue, 09 Aug 2016 06:36:09 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=106676#p106676</guid>
		</item>
		<item>
			<title><![CDATA[Re: Нажатие клавиши по появлении определенной строки в файле]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=75176#p75176</link>
			<description><![CDATA[<p>Можно пожалуйста, полный скрипт, рабочий и доделанный? )) И скажите, для чего в скрипте файл debug.txt. ??</p>]]></description>
			<author><![CDATA[null@example.com (Mr_Braun)]]></author>
			<pubDate>Tue, 03 Sep 2013 10:31:16 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=75176#p75176</guid>
		</item>
		<item>
			<title><![CDATA[Re: Нажатие клавиши по появлении определенной строки в файле]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=63033#p63033</link>
			<description><![CDATA[<p>Пожалуйста <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p>]]></description>
			<author><![CDATA[null@example.com (Irbis)]]></author>
			<pubDate>Wed, 22 Aug 2012 13:28:39 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=63033#p63033</guid>
		</item>
		<item>
			<title><![CDATA[Re: Нажатие клавиши по появлении определенной строки в файле]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=63031#p63031</link>
			<description><![CDATA[<p>Огромное спасибо за весьма стойкий скрипт, Irbis!</p>]]></description>
			<author><![CDATA[null@example.com (Apache)]]></author>
			<pubDate>Wed, 22 Aug 2012 12:29:54 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=63031#p63031</guid>
		</item>
		<item>
			<title><![CDATA[Re: Нажатие клавиши по появлении определенной строки в файле]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=63028#p63028</link>
			<description><![CDATA[<p>В файле лога пустые строки - обычные символы перевода строки. Предложенный мной вариант:<br /></p><div class="codebox"><pre><code>Loop, read, chatlog.txt
   if A_LoopReadLine
      last_line := A_LoopReadLine</code></pre></div><p>- работает, но я его в исправленном скрипте не обнаружил <img src="//forum.script-coding.com/img/smilies/hmm.png" width="15" height="15" /></p><p>Ниже <strong>часть</strong> скрипта, где внесены необходимые изменения, функция получения новой непустой строки вынесена отдельно:<br /></p><div class="codebox"><pre><code>ButtonStart:
StringCaseSense, Locale
name = chatlog.txt
loop
{
lastline := GetNewLine(name)
IfInString, lastline, Следуйте к красному маячку на радаре
{
Fileappend, %lastline%`n`r, debug.txt
Sendplay z
}
IfInString, Lastline, Осталось точек
{
fileappend, %lastline%`n`r, debug.txt
sleep 1500
;Sendplay {z down}
;sleep 100
Sendplay z 
}
IfInString, lastline, стоянку и получите
{
fileappend, %Lastline%`n, debug.txt
Sleep 1500
Sendplay z
}
ifinstring, lastline, следующий рейс
{
fileappend, %lastline%`n, debug.txt
sleep 1500
Sendplay {f6}/duty{enter}
sleep 1200
Sendplay z
}
}

GetNewLine(filename)
{
   static old
   static new
   if !old
   {
      FileGetSize, old, %filename%
	  new := old
   }
   while old = new
   {
      sleep 500
      FileGetSize, new, %filename%
   }
   old := new
   Loop, read, %filename%
      if A_LoopReadLine
         last := A_LoopReadLine
   return last
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Irbis)]]></author>
			<pubDate>Wed, 22 Aug 2012 11:36:10 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=63028#p63028</guid>
		</item>
		<item>
			<title><![CDATA[Re: Нажатие клавиши по появлении определенной строки в файле]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=63025#p63025</link>
			<description><![CDATA[<div class="codebox"><pre><code>Gui, Add, Text, x2 y-1 w260 h20 , AntiAFK v0.8 build 17 by Apache52 aka Colin_McRae
Gui, Add, Button, x2 y19 w80 h30 , Инструкция
Gui, Add, Button, x82 y19 w80 h30 , Start
Gui, Add, Button, x162 y19 w100 h30 , Exit
Gui, Show, x390 y196 h53 w266, ANTI-AFK v0.8 build 17 by Apache52 aka Colin_McRae
Return
ButtonИнструкция:
run, readme.txt
return
ButtonExit:
GuiClose:
ExitApp


ButtonStart:
StringCaseSense, Locale
name = chatlog.txt
loop
{
FileGetSize, old, %Name%
   new := old
   while old = new
   {
      sleep 500
      FileGetSize, new, %Name%
   }
FileRead, chat, chatlog.txt ; Пробовал так
FileDelete, chat.log
FileAppend, %chat%, chat.log
Loop, read, chat.log
{

    lastline := A_LoopReadLine
}
FileReadLine, lastline, chat.log, %Number%
IfInString, lastline, Следуйте к красному маячку на радаре
{
Fileappend, %lastline%`n`r, debug.txt
Sendplay z
}
IfInString, Lastline, Осталось точек
{
fileappend, %lastline%`n`r, debug.txt
sleep 1500
;Sendplay {z down}
;sleep 100
Sendplay z 
}
IfInString, lastline, стоянку и получите
{
fileappend, %Lastline%`n, debug.txt
Sleep 1500
Sendplay z
}
ifinstring, lastline, следующий рейс
{
fileappend, %lastline%`n, debug.txt
sleep 1500
Sendplay {f6}/duty{enter}
sleep 1200
Sendplay z
}
}</code></pre></div><p>Сюда чатлог не получается нормально выложить:<br /><a href="http://rghost.ru/private/39932216/45b0c314392d3cf1c562a50ee97f7a1c">http://rghost.ru/private/39932216/45b0c … 0ee97f7a1c</a></p>]]></description>
			<author><![CDATA[null@example.com (Apache)]]></author>
			<pubDate>Wed, 22 Aug 2012 10:28:00 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=63025#p63025</guid>
		</item>
		<item>
			<title><![CDATA[Re: Нажатие клавиши по появлении определенной строки в файле]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=63024#p63024</link>
			<description><![CDATA[<p>Покажи исправленный скрипт и часть файла chatlog.txt с пустыми строками (В моем понимании пустая строка состоит из перевода строки, с чем <strong>if A_LoopReadLine</strong> прекрасно справляется)<br />И конечно же, у тебя установлен AHK_L последней версии?</p>]]></description>
			<author><![CDATA[null@example.com (Irbis)]]></author>
			<pubDate>Wed, 22 Aug 2012 10:22:09 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=63024#p63024</guid>
		</item>
		<item>
			<title><![CDATA[Re: Нажатие клавиши по появлении определенной строки в файле]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=63023#p63023</link>
			<description><![CDATA[<p>Исправил. Проблема остается не решенной.</p>]]></description>
			<author><![CDATA[null@example.com (Apache)]]></author>
			<pubDate>Wed, 22 Aug 2012 10:05:07 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=63023#p63023</guid>
		</item>
		<item>
			<title><![CDATA[Re: Нажатие клавиши по появлении определенной строки в файле]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=63015#p63015</link>
			<description><![CDATA[<p>Для начала, в скрипте из поста <a href="http://forum.script-coding.com/viewtopic.php?pid=62956#p62956">#7</a> количество &quot;<strong>{</strong>&quot; не равно &quot;<strong>}</strong>&quot;<br />(Обрати внимание на последний <em><span style="color: magenta">IfInString</span></em>)</p><p>Во-вторых, <span style="color: white">если не обращать внимания, что скрипт сам по себе ужасен</span>, сугубо узкую задачу пропуска пустых строк можно решить так:<br /></p><div class="codebox"><pre><code>...
Loop, read, chatlog.txt
   if A_LoopReadLine
      last_line := A_LoopReadLine
...</code></pre></div><p>И, кстати, в<br /></p><div class="codebox"><pre><code>IfInString, %last_line%, строка которую нужно найти</code></pre></div><p>% % - не нужны, потому что в таком случае совпадение ищется не в last_line, а в переменной, чье имя содержится в last_line (динамическая переменная)</p>]]></description>
			<author><![CDATA[null@example.com (Irbis)]]></author>
			<pubDate>Wed, 22 Aug 2012 08:56:45 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=63015#p63015</guid>
		</item>
		<item>
			<title><![CDATA[Re: Нажатие клавиши по появлении определенной строки в файле]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=63012#p63012</link>
			<description><![CDATA[<p>Прошу помочь. В файле чатлога через некоторое время появляется пустая строка (А мой скрипт читает по последней строке) из-за этого он работать не может. Прошу подсказать как можно удалить последнюю пустую строку из файла</p>]]></description>
			<author><![CDATA[null@example.com (Apache)]]></author>
			<pubDate>Wed, 22 Aug 2012 08:04:32 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=63012#p63012</guid>
		</item>
		<item>
			<title><![CDATA[Re: Нажатие клавиши по появлении определенной строки в файле]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=62956#p62956</link>
			<description><![CDATA[<p>Все то же самое.<br />Сделал скрипт по другому и многофункциональней. Через час протестирую.<br /></p><div class="codebox"><pre><code>StringCaseSense, Locale
name = chatlog.txt
loop
{
   FileGetSize, old, %Name%
   new := old
   while old = new
   {
      sleep 500
      FileGetSize, new, %Name%
   }
   Loop, read, chatlog.txt

       last_line := A_LoopReadLine

   IfInString, %last_line%, Следуйте к красному маячку на радаре
   {
      Fileappend, %last_line%`n`r, debug.txt
      Send {z down}
      sleep 10
      send {z up}
   }
   IfInString, %Last_line%, Осталось точек
   {
      fileappend, %last_line%`n`r, debug.txt
      sleep 100
      Send {z down}
      sleep 10
      send {z up}
   }
   IfInString, %last_line%, стоянку и получите
   {
      fileappend, %Last_line%, debug.txt
      Sleep 100
      send {z down}
      sleep 10
      send {z up}
   }
   ifinstring, %last_line%, следующий рейс
   {
    fileappend, %last_line%, debug.txt
    sleep 1000
    send {f6}/duty{enter}
    sleep 1000
    send {z down}
    sleep 10
    send {z up}
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Apache)]]></author>
			<pubDate>Mon, 20 Aug 2012 08:06:07 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=62956#p62956</guid>
		</item>
		<item>
			<title><![CDATA[Re: Нажатие клавиши по появлении определенной строки в файле]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=62955#p62955</link>
			<description><![CDATA[<p>Не-не-не, не нужно прям так сразу «задачу ставить», мы же ошибки ищем <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /><br /></p><div class="codebox"><pre><code>...
If !CurrentWord
   FileAppend, Not Detect (%A_Index%)`n, log.log
Else
   {
   Send, {Shift Down}
   Sleep, 10
   Send, {Shift Up}
   }
...</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (creature.ws)]]></author>
			<pubDate>Mon, 20 Aug 2012 07:26:38 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=62955#p62955</guid>
		</item>
		<item>
			<title><![CDATA[Re: Нажатие клавиши по появлении определенной строки в файле]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=62953#p62953</link>
			<description><![CDATA[<div class="codebox"><pre><code>name = chatlog.txt
Loop
{
FileGetSize, old_s, %Name%
   new_s := old_s
   while old_s = new_s {
      sleep 500
      FileGetSize, new_s, %Name%
   }
StringCaseSense, Locale
FindWords := &quot;Объявление&quot; 
Loop, Parse, FindWords, `, 
   {
      FileRead, OutPutVar, %A_ScriptDir%\chatlog.txt
      IfInString, OutPutVar, % A_LoopField
         {
            CurrentWord := % A_LoopField
            FoundWords .= &quot;, &quot;CurrentWord
            FoundWordsNum++
         }
   }
StringTrimLeft, FoundWords2, FoundWords, 1
StringTrimLeft, CountEmptyStringNum2, CountEmptyStringNum, 1
If !CurrentWord
   FileAppend, Not Detect (%A_Index%)`n, log.log
   {
   Send, {Shift Down}
   Sleep, 10
   Send, {Shift Up}
   }
 
}
return
F5::
ExitApp</code></pre></div><p>Задача скрипта:<br />Есть txt файл с неизвестным количеством строк. Строки практически все разные.<br />Из игры каждая строка записывается в этот txt файл.<br />При изменении размера файла должен происходить поиск слова со строки без повторений.<br />При нахождении слова или выражения должен нажимать на шифт.</p>]]></description>
			<author><![CDATA[null@example.com (Apache)]]></author>
			<pubDate>Mon, 20 Aug 2012 06:42:22 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=62953#p62953</guid>
		</item>
		<item>
			<title><![CDATA[Re: Нажатие клавиши по появлении определенной строки в файле]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=62952#p62952</link>
			<description><![CDATA[<p>Нет предела совершенству, продемонстрируйте текущую версию своего скрипта.</p>]]></description>
			<author><![CDATA[null@example.com (creature.ws)]]></author>
			<pubDate>Mon, 20 Aug 2012 06:21:57 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=62952#p62952</guid>
		</item>
		<item>
			<title><![CDATA[Re: Нажатие клавиши по появлении определенной строки в файле]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=62951#p62951</link>
			<description><![CDATA[<p>Скрипт продолжает не работать. Независимо от строчки персонаж нажимает на шифт всегда.</p>]]></description>
			<author><![CDATA[null@example.com (Apache)]]></author>
			<pubDate>Mon, 20 Aug 2012 06:16:07 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=62951#p62951</guid>
		</item>
	</channel>
</rss>
