<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK: Как сделать чтобы действие производилось при 2 и более условиях?]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=13613</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=13613&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: Как сделать чтобы действие производилось при 2 и более условиях?».]]></description>
		<lastBuildDate>Sun, 15 Apr 2018 11:28:03 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: Как сделать чтобы действие производилось при 2 и более условиях?]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=124718#p124718</link>
			<description><![CDATA[<div class="codebox"><pre><code>
limit := 10000
hr := 0, dPart := 0
data := [[&quot;Число&quot;,&quot;Значение&quot;]]
Loop,% limit {
	hundred := hr // 100 * 100
	unit := hr - hundred
	(unit  &gt; 24 &amp;&amp; dPart := unit // 10 * 10)
	str := (unit == 1 + dPart || unit == 21 + dPart) ? &quot;час&quot; : (unit &gt; 1 + dPart &amp;&amp; unit &lt; 5 + dPart) || (unit &gt; 21 + dPart &amp;&amp; unit &lt; 25 + dPart) ? &quot;часа&quot; : &quot;часов&quot;
	data.Push( [hr, str] ), hr++
}

Gui,1: Add,ListView,w200 h400 NoSort vLVval +LV0x00010000 +HwndLV_H,Число|Значение
Gui,1: Show,,Список
CreateTable(data, &quot;LVval&quot;)
return
CreateTable(tableArr,ctrlNameValue) {
	Gui, 1: ListView, %ctrlNameValue%
	GuiControl, -ReDraw, %ctrlNameValue%
	LV_Delete()
	Loop, % LV_GetCount(&quot;Column&quot;)
		LV_DeleteCol(1)
	Loop,% tableArr[1].Length()
		LV_InsertCol(A_Index,&quot;&quot;, tableArr[1][A_Index])
	Loop,% tableArr.Length()-1 {
		rNmbr := LV_Add(&quot;&quot;, &quot;&quot;)
		Loop,% cCount := tableArr[rNmbr+1].Length()
			LV_Modify(rNmbr, &quot;Col&quot; . A_Index,tableArr[rNmbr+1][A_Index])
	} Loop, % tableArr[1].Length()
		LV_ModifyCol(A_Index, &quot;AutoHdr&quot;)
	GuiControl, +ReDraw, %ctrlNameValue%
}
GuiClose:
	ExitApp
</code></pre></div><p><strong>UPD 1:</strong> Поправка на сотни.<br /><strong>UPD 2:</strong> Поспешишь, людей насмешишь.<br />Прошу прощения, так будет правильно:<br /></p><div class="codebox"><pre><code>
limit := 10000
hr := 0, dPart := 0
data := [[&quot;Число&quot;,&quot;Значение&quot;]]
Loop,% limit {
	unit := hr - (hr // 100 * 100)
	unit &gt; 20 ? dPart := unit // 10 * 10 : dPart := 0
	str := (unit == 1 + dPart) ? &quot;час&quot; : (unit &gt; 1 + dPart &amp;&amp; unit &lt; 5 + dPart) ? &quot;часа&quot; : &quot;часов&quot;
	data.Push( [hr, str] ), hr++
}

Gui,1: Add,ListView,w200 h400 NoSort vLVval +LV0x00010000 +HwndLV_H,Число|Значение
Gui,1: Show,,Список
CreateTable(data, &quot;LVval&quot;)
return
CreateTable(tableArr,ctrlNameValue) {
	Gui, 1: ListView, %ctrlNameValue%
	GuiControl, -ReDraw, %ctrlNameValue%
	LV_Delete()
	Loop, % LV_GetCount(&quot;Column&quot;)
		LV_DeleteCol(1)
	Loop,% tableArr[1].Length()
		LV_InsertCol(A_Index,&quot;&quot;, tableArr[1][A_Index])
	Loop,% tableArr.Length()-1 {
		rNmbr := LV_Add(&quot;&quot;, &quot;&quot;)
		Loop,% cCount := tableArr[rNmbr+1].Length()
			LV_Modify(rNmbr, &quot;Col&quot; . A_Index,tableArr[rNmbr+1][A_Index])
	} Loop, % tableArr[1].Length()
		LV_ModifyCol(A_Index, &quot;AutoHdr&quot;)
	GuiControl, +ReDraw, %ctrlNameValue%
}
GuiClose:
	ExitApp
</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (KusochekDobra)]]></author>
			<pubDate>Sun, 15 Apr 2018 11:28:03 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=124718#p124718</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Как сделать чтобы действие производилось при 2 и более условиях?]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=124711#p124711</link>
			<description><![CDATA[<div class="quotebox"><cite>KusochekDobra пишет:</cite><blockquote><div class="codebox"><pre><code>
hr := 1

if (hr == 1 || hr == 21)
	str := &quot;час&quot;
else if (hr &gt; 1 &amp;&amp; hr &lt; 5) || (hr &gt; 21 &amp;&amp; hr &lt; 24)
	str := &quot;часа&quot;
else
	str := &quot;часов&quot;
MsgBox,,Время,% hr &quot; &quot; str
</code></pre></div></blockquote></div><p>Есть ли такой же вариант склонений для больших чисел — тысяч до 10 хотя бы?</p>]]></description>
			<author><![CDATA[null@example.com (DD)]]></author>
			<pubDate>Sun, 15 Apr 2018 07:58:52 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=124711#p124711</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Как сделать чтобы действие производилось при 2 и более условиях?]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=124566#p124566</link>
			<description><![CDATA[<p><strong>KusochekDobra</strong><br />Спасибо большое.<br />p.s. справку я прочитал</p>]]></description>
			<author><![CDATA[null@example.com (Chikko)]]></author>
			<pubDate>Mon, 09 Apr 2018 16:27:23 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=124566#p124566</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Как сделать чтобы действие производилось при 2 и более условиях?]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=124565#p124565</link>
			<description><![CDATA[<div class="codebox"><pre><code>
#Persistent
SetTimer, sch, 1000
Return

sch:
if(A_Hour &gt;= 19 &amp;&amp; A_Hour &lt; 20)
{
    Run C:\Users\Home\Desktop
    ExitApp
}
Return
</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (rowe)]]></author>
			<pubDate>Mon, 09 Apr 2018 16:23:28 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=124565#p124565</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Как сделать чтобы действие производилось при 2 и более условиях?]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=124564#p124564</link>
			<description><![CDATA[<p>if -&gt; else:<br /></p><div class="codebox"><pre><code>
hr := 1

if (hr == 1 || hr == 21)
	str := &quot;час&quot;
else if (hr &gt; 1 &amp;&amp; hr &lt; 5) || (hr &gt; 21 &amp;&amp; hr &lt; 24)
	str := &quot;часа&quot;
else
	str := &quot;часов&quot;
MsgBox,,Время,% hr &quot; &quot; str
</code></pre></div><p>Тернарный эквивалент:<br /></p><div class="codebox"><pre><code>
hr := 1
str := (hr == 1 || hr == 21) ? &quot;час&quot; : (hr &gt; 1 &amp;&amp; hr &lt; 5) || (hr &gt; 21 &amp;&amp; hr &lt; 24) ? &quot;часа&quot; : &quot;часов&quot;
MsgBox,,Время,% hr &quot; &quot; str
</code></pre></div><p>Проверить 24 часовой ряд:<br /></p><div class="codebox"><pre><code>
hr := 0
Loop 24 {
	str := (hr == 1 || hr == 21) ? &quot;час&quot; : (hr &gt; 1 &amp;&amp; hr &lt; 5) || (hr &gt; 21 &amp;&amp; hr &lt; 24) ? &quot;часа&quot; : &quot;часов&quot;
	MsgBox,,Время,% hr++ &quot; &quot; str
}
</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (KusochekDobra)]]></author>
			<pubDate>Mon, 09 Apr 2018 16:01:58 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=124564#p124564</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Как сделать чтобы действие производилось при 2 и более условиях?]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=124563#p124563</link>
			<description><![CDATA[<p>Справку читали?</p>]]></description>
			<author><![CDATA[null@example.com (KusochekDobra)]]></author>
			<pubDate>Mon, 09 Apr 2018 15:41:24 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=124563#p124563</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Как сделать чтобы действие производилось при 2 и более условиях?]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=124562#p124562</link>
			<description><![CDATA[<p><strong>KusochekDobra</strong><br />Вы наверное неправильно меня поняли. Я написал, что нужно это всё как-то поместить в If. Приведу другой пример.<br />Если на компьютере 11, 12, или 13 часОВ времени, то переменная var будет равна &quot;часов&quot;<br />А если же на компьютере 21 или 1 чаС времени, то переменная var будет равна &quot;час&quot;<br />Но я хочу как-то уместить все эти условия в одной строчке команды If<br /></p><div class="codebox"><pre><code>If(A_Hour=11,12,13)
{
var= часов
}
Else If(A_Hour=21,1)
{
var= час
}
</code></pre></div><p>Можно ли вообще поместить несколько условий в одних скобочках команды If</p>]]></description>
			<author><![CDATA[null@example.com (Chikko)]]></author>
			<pubDate>Mon, 09 Apr 2018 15:37:19 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=124562#p124562</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Как сделать чтобы действие производилось при 2 и более условиях?]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=124561#p124561</link>
			<description><![CDATA[<p>Чтобы понимать, как происходит логическое описание, для этого нужно почитать соответствующую литературу, или обратиться к <a href="http://www.script-coding.com/AutoHotkey/Variables.1.0.46.07.html">справке</a>. Но то, как Вы описываете задачу, может быть решено следующим:<br /></p><div class="codebox"><pre><code>
r::
g::
b::
	MsgBox RGB
return

h::
s::
v::
	MsgBox HSV
return
</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (KusochekDobra)]]></author>
			<pubDate>Mon, 09 Apr 2018 15:18:27 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=124561#p124561</guid>
		</item>
		<item>
			<title><![CDATA[AHK: Как сделать чтобы действие производилось при 2 и более условиях?]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=124557#p124557</link>
			<description><![CDATA[<p>Допустим, если я нажму клавишу R, G, или B то откроется MsgBox с надписью &quot;RGB&quot;.</p><p>А если я нажму H, S, или V, то откроется MsgBox с надписью &quot;HSV&quot;.</p><p>Мне надо всё это как-то поместить в If.</p>]]></description>
			<author><![CDATA[null@example.com (Chikko)]]></author>
			<pubDate>Mon, 09 Apr 2018 13:12:44 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=124557#p124557</guid>
		</item>
	</channel>
</rss>
