<?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=7451&amp;type=atom" />
	<updated>2012-08-14T20:31:16Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=7451</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Сложные манипуляции с текстом]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=62777#p62777" />
			<content type="html"><![CDATA[<p>Irbis<br />Очень благодарен за помощь! Если не откажитесь вышлю вознаграждение <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /> пришлите rub webmoney в личку.</p>]]></content>
			<author>
				<name><![CDATA[max01]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27356</uri>
			</author>
			<updated>2012-08-14T20:31:16Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=62777#p62777</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Сложные манипуляции с текстом]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=62776#p62776" />
			<content type="html"><![CDATA[<p>Не стал сливать все в один скрипт, хоть это и несложно. (Не очень красиво, но работает)<br />Оставил два скрипта - управляющий с постоянным циклом и подчиненный ему parse.ahk, производящий подсчет.<br />Главный управляет подчиненным - одновременно со сворачиванием/разворачиванием окна игры посылает ему хоткей на стоп/пуск (Ctrl+Shift+F12)<br />Главный скрипт main.ahk:<br /></p><div class="codebox"><pre><code>Run, C:\Skript&#039;s\Anti [AFK]\parse.ahk ; Загрузка скрипта, производящий операции над текстовым файлом - изначально на паузе
F12:: ; Запуск главного скрипта
loop {
   Send ^+{F12} ; запуск parse.ahk
   SetKeyDelay, rand(500, 1000), rand(500, 1000)
   waiting := rand(5000, 10000) ; интервал между повторами 5-10 cек.
   loop % rand(3,5) { ; количество повторов
      Send,{vk57}{vk53}{vk41}{vk44}{vk57}{vk53}{vk41}{vk44}{vk57}{vk53} ;wsad
      sleep waiting
   }
   Send ^+{F12} ; ; стоп parse.ahk
   WinWait, GTA:SA:MP
   WinMinimize
   sleep % rand(60000, 150000)
   WinWait, GTA:SA:MP
   WinMaximize
   sleep 200 ; даем окну развернуться
}
return

rand(A, B)
{
 Random, r, A, B
 return r
}

~#F12:: ExitApp ; Win+F12 - выход</code></pre></div><p>Подчиненный скрипт parse.ahk:</p><div class="codebox"><pre><code>Name = example.txt
SetFormat, float, 0.0
pos := 1
pause
loop {
   FileRead, F, %Name%
   loop {
      RegExMatch(F, &quot;O)(\d+)(\+|-|\*|/)(\d+)\=\?&quot;, rez, pos)
      if !rez.Count()
         break
      sign := rez[2]
      ans := sign = &quot;+&quot; ? rez[1]+rez[3]
           : sign = &quot;-&quot; ? rez[1]-rez[3]
           : sign = &quot;*&quot; ? rez[1]*rez[3]
           : rez[1]/rez[3]
      pos := rez.pos(1)+5
      Send, {F6}%ans%{Enter}
   }
   FileGetSize, old_s, %Name%
   new_s := old_s
   while old_s = new_s {
      sleep 5000
      FileGetSize, new_s, %Name%
   }
}
#F12:: ExitApp ; Win+F12 - выход
^+F12:: pause, toggle</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Irbis]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27384</uri>
			</author>
			<updated>2012-08-14T20:18:19Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=62776#p62776</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Сложные манипуляции с текстом]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=62768#p62768" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Irbis пишет:</cite><blockquote><p>Задать произвольный диапазон:<br /></p><div class="codebox"><pre><code>SetKeyDelay, rand(1000, 2000), rand(500, 2000)
SetTimer, Timer1, % rand(30000, 150000)
return

rand(A, B)
{
 Random, r, A, B
 return r
}</code></pre></div></blockquote></div><p>а куда вставить? </p><p>Send,{vk57}{vk53}{vk41}{vk44}{vk57}{vk53}{vk41}{vk44}{vk57}{vk53};wsad</p><p>WinWait, GTA:SA:MP<br />WinMinimize</p><p> и&nbsp; cделать что бы скрипт повторялся постоянно....</p>]]></content>
			<author>
				<name><![CDATA[max01]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27356</uri>
			</author>
			<updated>2012-08-14T18:54:24Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=62768#p62768</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Сложные манипуляции с текстом]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=62755#p62755" />
			<content type="html"><![CDATA[<p>Задать произвольный диапазон:<br /></p><div class="codebox"><pre><code>SetKeyDelay, rand(1000, 2000), rand(500, 2000)
SetTimer, Timer1, % rand(30000, 150000)
return

rand(A, B)
{
 Random, r, A, B
 return r
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Irbis]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27384</uri>
			</author>
			<updated>2012-08-14T14:57:37Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=62755#p62755</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Сложные манипуляции с текстом]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=62748#p62748" />
			<content type="html"><![CDATA[<p>up</p>]]></content>
			<author>
				<name><![CDATA[max01]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27356</uri>
			</author>
			<updated>2012-08-14T10:05:00Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=62748#p62748</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Сложные манипуляции с текстом]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=62741#p62741" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Irbis пишет:</cite><blockquote><p>остальное не очень понял. :/</p></blockquote></div><p>У меня это скрипт выглядит так:<br /> Нажимает кнопки, затем работает с окном и запускает следующий.<br /></p><div class="codebox"><pre><code>SetKeyDelay, 2000, 1000
SetTimer, Timer1, 90000
Timer1:

Send,{vk57}{vk53}{vk41}{vk44}{vk57}{vk53}{vk41}{vk44}{vk57}{vk53};wsad


WinWait, GTA:SA:MP
WinMinimize ; Использует окно, найденное выше.

Run, C:\Skript&#039;s\Anti [AFK]\3.ahk
exit</code></pre></div><p>следущий:<br /></p><div class="codebox"><pre><code>Sleep 100200
WinWait, GTA:SA:MP
WinMaximize ; Использует окно, найденное выше.
Run, C:\Skript&#039;s\Anti [AFK]\1(3).ahk
exit</code></pre></div><p>И так по кругу.... У меня не получается сделать цельный скрипт и сделать значения SetKeyDelay, 2000, 1000<br />SetTimer, Timer1, 90000 рандомными и в определённом диапазоне.</p>]]></content>
			<author>
				<name><![CDATA[max01]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27356</uri>
			</author>
			<updated>2012-08-14T08:10:24Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=62741#p62741</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Сложные манипуляции с текстом]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=62739#p62739" />
			<content type="html"><![CDATA[<p>Вот код на 4 арифметических действия (деление - целочисленное), остальное не очень понял. <img src="//forum.script-coding.com/img/smilies/hmm.png" width="15" height="15" /><br /></p><div class="codebox"><pre><code>SetFormat, float, 0.0
Name = example.txt
pos := 1
F12::
loop {
   WinWaitActive, GTA:SA:MP
   FileRead, F, %Name%
   loop {
      RegExMatch(F, &quot;O)(\d+)(\+|-|\*|/)(\d+)\=\?&quot;, rez, pos)
      if !rez.Count()
         break
      sign := rez[2]
      ans := sign = &quot;+&quot; ? rez[1]+rez[3]
	       : sign = &quot;-&quot; ? rez[1]-rez[3]
	       : sign = &quot;*&quot; ? rez[1]*rez[3]
	       : rez[1]/rez[3]
      pos := rez.pos(1)+5
	  Send, {F6}%ans%{Enter}
   }
   FileGetSize, old_s, %Name%
   new_s := old_s
   while old_s = new_s {
      sleep 5000
      FileGetSize, new_s, %Name%
   }
}
#F12:: ExitApp ; Win+F12 - выход</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Irbis]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27384</uri>
			</author>
			<updated>2012-08-14T07:17:12Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=62739#p62739</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Сложные манипуляции с текстом]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=62737#p62737" />
			<content type="html"><![CDATA[<p>Прошу помощи в оптимизации скрипта. Мне нужен скрипт который бы нажимал определённые клавиши рандомное количество рас&nbsp; с интрервалом от 3 до 5 рас. Так же рандомное длительность нажатия (от 1 до 2 секунд ) и промежуток времени между нажатиями (от 5 до 10 секунд). Цикл нажатий клавиш от 3 до 8 нажатий после чего скрипт выполнял действие, а именно сворачивал окно тоже на рандомное количество времени от 1 до 2.5 минут, затем повторял цикл.<br /> У меня реализовать такой скрипт не получилось, я соорудил из нескольких скриптов цепочку которые включают и выключают друг друга, но они глючат и не работают как надо <img src="//forum.script-coding.com/img/smilies/sad.png" width="15" height="15" />.<br /> Ещё нюанс встроить в скрипт этот код, что бы он пока открыто окно работал, а при свёрнутом нет. Плюс доработать этот код добавив шаблоны типа (\d+)\-(\d+), (\d+)\*(\d+), (\d+)\/(\d+) соответственно и работа с шаблонами вычитание, умножение, деление.</p><div class="codebox"><pre><code>WinWaitActive, GTA:SA:MP
Name = C:\Users\max\Documents\GTA San Andreas User Files\SAMP\chatlog.txt
pos := 1
loop {
   FileRead, F, %Name%
   loop {
      RegExMatch(F, &quot;O)(\d+)\+(\d+)&quot;, rez, pos)
      if !rez.Count()
         break
      sum := rez[1]+rez[2]
      pos := rez.pos(1)+5
      Send, {F6}%sum%{Enter}
   }
   FileGetSize, old_s, %Name%
   new_s := old_s
   while old_s = new_s {
      sleep 5000
      FileGetSize, new_s, %Name%
   }
}
#F12:: ExitApp ; Win+F12 - выход</code></pre></div><p>Буду очень признателен за скрипт.</p>]]></content>
			<author>
				<name><![CDATA[max01]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27356</uri>
			</author>
			<updated>2012-08-14T06:31:57Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=62737#p62737</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Сложные манипуляции с текстом]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=62703#p62703" />
			<content type="html"><![CDATA[<p><strong>Irbis</strong><br /> То что нужно <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /> Большое спасибо!</p>]]></content>
			<author>
				<name><![CDATA[max01]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27356</uri>
			</author>
			<updated>2012-08-12T19:18:39Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=62703#p62703</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Сложные манипуляции с текстом]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=62701#p62701" />
			<content type="html"><![CDATA[<p>Сканирует файл на наличие нового текста, и парсит только его, а не весь файл.<br />Если, что маловероятно, нужно заново проходить весь файл, то <strong>pos := 1</strong> поместить следующей строкой после <strong>FileRead, F, %Name%</strong><br /></p><div class="codebox"><pre><code>Name = example.txt
pos := 1
F12::
loop {
   FileRead, F, %Name%
   loop {
      RegExMatch(F, &quot;O)(\d+)\+(\d+)\=\?&quot;, rez, pos)
      if !rez.Count()
         break
      sum := rez[1]+rez[2]
	  pos := rez.pos(1)+5
      Send, {F6}%sum%{Enter}
   }
   FileGetSize, old_s, %Name%
   new_s := old_s
   while old_s = new_s {
      sleep 5000
      FileGetSize, new_s, %Name%
   }
}
#F12:: ExitApp ; Win+F12 - выход</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Irbis]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27384</uri>
			</author>
			<updated>2012-08-12T18:56:36Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=62701#p62701</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Сложные манипуляции с текстом]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=62698#p62698" />
			<content type="html"><![CDATA[<p>Ещё вопрос: как сделать что бы скрипт сканировал txt непрерывно каждые 5 секунд?</p>]]></content>
			<author>
				<name><![CDATA[max01]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27356</uri>
			</author>
			<updated>2012-08-12T16:38:22Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=62698#p62698</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Сложные манипуляции с текстом]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=62697#p62697" />
			<content type="html"><![CDATA[<p>Irbis<br />Большое спасибо! Вы очень помогли.</p>]]></content>
			<author>
				<name><![CDATA[max01]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27356</uri>
			</author>
			<updated>2012-08-12T16:25:49Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=62697#p62697</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Сложные манипуляции с текстом]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=62696#p62696" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>F12::
FileRead, F, example.txt
loop {
   RegExMatch(F, &quot;O)(\d+)\+(\d+)&quot;, rez, rez.pos(1) ? rez.pos(1)+5 : 1)
   if !rez.Count()
      break
   sum := rez[1]+rez[2]
   Send, {F6}%sum%{Enter}
}
ExitApp</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Irbis]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27384</uri>
			</author>
			<updated>2012-08-12T15:55:53Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=62696#p62696</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Сложные манипуляции с текстом]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=62695#p62695" />
			<content type="html"><![CDATA[<p>В общем нужен скрипт который бы сканировал .txt документ на предмет определённого текста, а точнее на примеры типа: 5+5=?, 6+8=? в диапазоне от 0до 1000 . Далее при обнаружении выполнял решение примера и результат выводил в функцию </p><div class="codebox"><pre><code>Send, {F6}результат{enter}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[max01]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27356</uri>
			</author>
			<updated>2012-08-12T11:49:00Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=62695#p62695</id>
		</entry>
</feed>
