<?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="http://forum.script-coding.com/extern.php?action=feed&amp;tid=14701&amp;type=atom" />
	<updated>2019-04-08T12:49:18Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.script-coding.com/viewtopic.php?id=14701</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: массовое Сравнение переменных]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=133446#p133446" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>StringCaseSense, Locale

text1 = Текст последнего сообщения
idsms1 = idsms1
text2 = Текст последнего сообщения
idsms2 = idsms2
text3 = Текст последнего Помощь сообщения
idsms3 = idsms3
text4 = Текст последнего сообщения
idsms4 = idsms4
text5 = Текст последнего сообщения Помощь
idsms5 = idsms5

LastMatch := 0  ;	True - Последнее совпадение.
While (A_Index &lt;= 5) &amp;&amp; (!InStr(text%A_Index%, &quot;помощь&quot;) || (LastMatch, idsms := idsms%A_Index%))
	Continue 
MsgBox % idsms</code></pre></div>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2019-04-08T12:49:18Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=133446#p133446</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: массовое Сравнение переменных]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=133445#p133445" />
			<content type="html"><![CDATA[<p>Привет еще раз форумчане, пишу простенького бота для беседы вк, и столкнулся с проблемой в написании кода:<br /></p><div class="codebox"><pre><code>

Token := &quot;VKTOKEN&quot;
ID := &quot;147&quot; ;- Айди переписки беседы
count := &quot;5&quot; ; сколько сообщений возвращать , мне нужно 5 последних


start: 
loop {
ComObjError(false) 
whr := ComObjCreate(&quot;WinHttp.WinHttpRequest.5.1&quot;) 
whr.Open(&quot;POST&quot;, &quot;https://api.vk.com/method/messages.getHistory?count=&quot; count &quot;&amp;chat_id=&quot; ID &quot;&amp;access_token=&quot; Token &quot;&amp;v=5.85&quot;, true) 
whr.SetRequestHeader(&quot;User-Agent&quot;, &quot;Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36&quot;) 
whr.SetRequestHeader(&quot;Content-Type&quot;,&quot;application/x-www-form-urlencoded&quot;) 
whr.Send() 
whr.WaitForResponse() 
jsontext := % whr.ResponseText
JSON = 
(LTrim Join 
%jsontext% 
) 
htmldoc := ComObjCreate(&quot;htmlfile&quot;) 
Script := htmldoc.Script 
Script.execScript(&quot; &quot;, &quot;JScript&quot;) 
oJSON := Script.eval(&quot;(&quot; . JSON . &quot;)&quot;)
;-----последнее
text := % oJSON.response.items.0.text ; - Текст последнего сообщения
from := % oJSON.response.items.0.from_id ; - Кто написал (его айди) последнее сообщене
idsms := % oJSON.response.items.0.id ; - айди последнего сообщения
;-----последнее перед ним 1
text1 := % oJSON.response.items.1.text ; - Текст последнего сообщения
from1 := % oJSON.response.items.1.from_id ; - Кто написал (его айди) последнее сообщене
idsms1 := % oJSON.response.items.1.id ; - айди последнего сообщения
;-----последнее перед ним 2
text2 := % oJSON.response.items.2.text ; - Текст последнего сообщения
from2 := % oJSON.response.items.2.from_id ; - Кто написал (его айди) последнее сообщене
idsms2 := % oJSON.response.items.2.id ; - айди последнего сообщения
;-----последнее перед ним 3
text3 := % oJSON.response.items.3.text ; - Текст последнего сообщения
from3 := % oJSON.response.items.3.from_id ; - Кто написал (его айди) последнее сообщене
idsms3 := % oJSON.response.items.3.id ; - айди последнего сообщения
;-----последнее перед ним 4
text4 := % oJSON.response.items.4.text ; - Текст последнего сообщения
from4 := % oJSON.response.items.4.from_id ; - Кто написал (его айди) последнее сообщене
idsms4 := % oJSON.response.items.4.id ; - айди последнего сообщения

; И так есть у нас 5 сообщений их авторы и текста сообщений
; Как проверить каждый TextN и если нашел слово &quot;Помощь&quot; то выбрать именно айди этого сообщения idsmsN

if text contains то омощь,/help
{
goto helpme
}
goto start

helpme:
msgbox 123
goto start

</code></pre></div><p>И так есть у нас 5 сообщений их авторы и текста сообщений,<br />как проверить каждый TextN и если нашел слово &quot;Помощь&quot; то выбрать именно айди этого сообщения idsmsN, затратив на это меньше кода?</p><p>ps. Скрипт json идеален! :-)</p>]]></content>
			<author>
				<name><![CDATA[wladkokopops]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=34240</uri>
			</author>
			<updated>2019-04-08T12:33:06Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=133445#p133445</id>
		</entry>
</feed>
