<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK: if * = * or * or * - как правильно составить?]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=14442</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=14442&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: if * = * or * or * - как правильно составить?».]]></description>
		<lastBuildDate>Wed, 26 Dec 2018 15:47:33 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: if * = * or * or * - как правильно составить?]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=130624#p130624</link>
			<description><![CDATA[<p>И для полноты картины, стоит упомянуть, что массивы - это объекты:<br /></p><div class="codebox"><pre><code>
list := &quot;Arthas|Stone|Tree&quot;, var := &quot;Stone&quot;

proto := []
proto.HasValue := Func(&quot;__HasValue&quot;)
proto.Split := Func(&quot;__Split&quot;)
proto.lastScan := {}

arr := New proto
;arr.Push(&quot;Arthas&quot;, &quot;Stone&quot;, &quot;Tree&quot;)
arr.Split(list)
arr.HasValue(&quot;Stone&quot;)

MsgBox % Format(&quot;Ключей с искомым значением найдено - {}`nПервый по порядку ключ - {}&quot;, arr.lastScan.count, arr.lastScan.keys[1])

__HasValue(this, value) {
	this.lastScan := {&quot;count&quot;: 0, &quot;keys&quot;: []}
	For key, item in this {
		if (item == value) {
			this.lastScan.count++
			this.lastScan.keys.Push(key)
		}
	}
}
__Split(this, string) {
	this.Push( StrSplit(string, &quot;|&quot;)* )
}
</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (KusochekDobra)]]></author>
			<pubDate>Wed, 26 Dec 2018 15:47:33 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=130624#p130624</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: if * = * or * or * - как правильно составить?]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=130621#p130621</link>
			<description><![CDATA[<p>Я когда ничего не знал о массивах делал так: <br /></p><div class="codebox"><pre><code>list := &quot;|Arthas|Stone|Tree|&quot;
var := &quot;Stone&quot;
If InStr(list, &quot;|&quot; var &quot;|&quot;)
   msgbox</code></pre></div><p>До сих пор использую. <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Wed, 26 Dec 2018 14:29:02 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=130621#p130621</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: if * = * or * or * - как правильно составить?]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=130618#p130618</link>
			<description><![CDATA[<p>Ну поэтому и пишу что правильнее через массив. Изящного пути тут нет.<br /></p><div class="codebox"><pre><code>list := &quot;Arthas|Stone|Tree&quot;, var := &quot;Stone&quot;
if HasValue(var, StrSplit(list, &quot;|&quot;))
	MsgBox ;% &quot;Ключей с искомым значением найдено - &quot; HasValue(&quot;Stone&quot;, arr).Length() &quot;,`nпервый по порядку ключ - &quot; HasValue(&quot;Stone&quot;, arr).1

HasValue(var, arr) {
	arrOfKeys := {}
	for key, value in arr
		if (value == var)
			arrOfKeys.Push(key)
	return (arrOfKeys.Length() = 0) ? false : arrOfKeyss
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (stealzy)]]></author>
			<pubDate>Wed, 26 Dec 2018 13:58:14 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=130618#p130618</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: if * = * or * or * - как правильно составить?]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=130617#p130617</link>
			<description><![CDATA[<div class="quotebox"><cite>stealzy пишет:</cite><blockquote><p>Для простых случаев можно использовать InStr:</p><div class="codebox"><pre><code>MsgBox % InStr(&quot;Arthas|Stone|Tree&quot;, &quot;Stone&quot;)</code></pre></div></blockquote></div><p>Я б так не делал:</p><div class="codebox"><pre><code>var := &quot;art&quot;
MsgBox % InStr(&quot;Arthas|Stone|Tree&quot;, var) </code></pre></div>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Wed, 26 Dec 2018 13:56:30 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=130617#p130617</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: if * = * or * or * - как правильно составить?]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=130614#p130614</link>
			<description><![CDATA[<p>Массивом самое верное:</p><div class="codebox"><pre><code>arr := [&quot;Arthas&quot;, &quot;Stone&quot;, &quot;Tree&quot;]
if HasValue(&quot;Stone&quot;, arr)
	MsgBox ;% &quot;Ключей с искомым значением найдено - &quot; HasValue(&quot;Stone&quot;, arr).Length() &quot;,`nпервый по порядку ключ - &quot; HasValue(&quot;Stone&quot;, arr).1

HasValue(var, arr) {
	arrOfKeys := {}
	for key, value in arr
		if (value == var)
			arrOfKeys.Push(key)
	return (arrOfKeys.Length() = 0) ? false : arrOfKeyss
}</code></pre></div><p>Для простых случаев можно использовать InStr:</p><div class="codebox"><pre><code>MsgBox % InStr(&quot;Arthas|Stone|Tree&quot;, &quot;Stone&quot;)</code></pre></div><p>или regex:</p><div class="codebox"><pre><code>if &quot;Arthas|Stone|Tree&quot; ~= &quot;Artha&quot;
	MsgBox</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (stealzy)]]></author>
			<pubDate>Wed, 26 Dec 2018 13:48:34 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=130614#p130614</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: if * = * or * or * - как правильно составить?]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=130583#p130583</link>
			<description><![CDATA[<p>Можно еще циклом по массиву.<br /></p><div class="codebox"><pre><code>array:=[&quot;Arthas&quot;,&quot;Stone&quot;,&quot;Tree&quot;]
text:=&quot;Stone&quot;
for i,value in array
	if(value=text) ;если нужно соблюдать регистр, то == 
		msgbox % &quot;i=&quot; i &quot;`n&quot; value
</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (MandarinKa02)]]></author>
			<pubDate>Tue, 25 Dec 2018 19:57:51 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=130583#p130583</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: if * = * or * or * - как правильно составить?]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=130579#p130579</link>
			<description><![CDATA[<p>Проще использовать in *,*,*</p>]]></description>
			<author><![CDATA[null@example.com (kangar)]]></author>
			<pubDate>Tue, 25 Dec 2018 17:18:15 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=130579#p130579</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: if * = * or * or * - как правильно составить?]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=130578#p130578</link>
			<description><![CDATA[<p>Самый простой способ заключать каждое выражение в скобки:<br /></p><div class="codebox"><pre><code>if (выражение1) or ((выражение2) and (выражение3)) or (!выражение4) {
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (belyankin12)]]></author>
			<pubDate>Tue, 25 Dec 2018 16:46:33 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=130578#p130578</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: if * = * or * or * - как правильно составить?]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=130575#p130575</link>
			<description><![CDATA[<p>А что справка по этому поводу говорит?</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Tue, 25 Dec 2018 11:58:52 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=130575#p130575</guid>
		</item>
		<item>
			<title><![CDATA[AHK: if * = * or * or * - как правильно составить?]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=130572#p130572</link>
			<description><![CDATA[<p>Приветствую читающего этот текст форумчанина.<br />Вопрос: как правильно составить условие if&#039;a, чтобы переменная могла = ТЕКСТУ1 или тексту2 или тексту3?</p><div class="codebox"><pre><code>
if Var = Arthas or Stone or Tree
{
msgbox, asd
}</code></pre></div><p>Надеюсь на вашу помощь.</p>]]></description>
			<author><![CDATA[null@example.com (kangar)]]></author>
			<pubDate>Tue, 25 Dec 2018 10:57:29 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=130572#p130572</guid>
		</item>
	</channel>
</rss>
