<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK: Выбрать наименьшую переменную]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=15990</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=15990&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: Выбрать наименьшую переменную».]]></description>
		<lastBuildDate>Wed, 20 Jan 2021 10:24:09 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: Выбрать наименьшую переменную]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=145102#p145102</link>
			<description><![CDATA[<div class="quotebox"><cite>serzh82saratov пишет:</cite><blockquote><div class="quotebox"><cite>Malcev пишет:</cite><blockquote><p>Кому-то удобно читать подобный код?</p></blockquote></div><p> <br />Если аккуратнее написать, то вполне, если привычно.<br /></p><div class="codebox"><pre><code>Acc_ObjectFromPoint(ByRef _idChild_ = &quot;&quot;, x = &quot;&quot;, y = &quot;&quot;) {
	If DllCall(&quot;oleacc\AccessibleObjectFromPoint&quot;
	, &quot;Int64&quot;, x = &quot;&quot; || y = &quot;&quot; ? 0 * DllCall(&quot;GetCursorPos&quot;, &quot;Int64*&quot;, pt) + pt : x &amp; 0xFFFFFFFF | y &lt;&lt; 32
	, &quot;Ptr* &quot;, pacc, &quot;Ptr&quot;, VarSetCapacity(varChild, 8 + 2 * A_PtrSize, 0) * 0 + &amp;varChild) = 0
		Return ComObjEnwrap(9, pacc, 1), _idChild_ := NumGet(varChild, 8, &quot;UInt&quot;)
}</code></pre></div><p>Но можно и так.<br /></p><div class="codebox"><pre><code>
Acc_ObjectFromPoint(ByRef _idChild_ = &quot;&quot;, x = &quot;&quot;, y = &quot;&quot;) {
	VarSetCapacity(varChild, 8 + 2 * A_PtrSize, 0)
	If (x = &quot;&quot; || y = &quot;&quot;)  
		DllCall(&quot;GetCursorPos&quot;, &quot;Int64*&quot;, pt)
	Else 
		pt := x &amp; 0xFFFFFFFF | y &lt;&lt; 32
	If DllCall(&quot;oleacc\AccessibleObjectFromPoint&quot;, &quot;Int64&quot;, pt, &quot;Ptr* &quot;, pacc, &quot;Ptr&quot;, &amp;varChild) = 0
		Return ComObjEnwrap(9, pacc, 1), _idChild_ := NumGet(varChild, 8, &quot;UInt&quot;) 
}
</code></pre></div><p>Ты бы также написал?</p></blockquote></div><p>Я бы написал, как во втором варианте.<br />Ну и вообще комплексный код я бы описывал подробно с комментариями и отсылками - так, как описываются функции в исходниках автохотки.<br />Там описания больше, чем кода.<br />Потому что пройдет время, всё позабудется, и на понимание алгоритма своего кода без описания можно потратить больше времени, чем написать его заново.</p>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Wed, 20 Jan 2021 10:24:09 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=145102#p145102</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Выбрать наименьшую переменную]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=145100#p145100</link>
			<description><![CDATA[<p>Исправил тесты. Теперь всё наоборот. <img src="//forum.script-coding.com/img/smilies/big_smile.png" width="15" height="15" /><br />С кавычками немного дольше,&nbsp; If Else и * + одинаково.</p>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Wed, 20 Jan 2021 09:20:07 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=145100#p145100</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Выбрать наименьшую переменную]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=145099#p145099</link>
			<description><![CDATA[<p><strong>serzh82saratov</strong> Что за подстава, я 4-ый раз переобуваюсь).</p>]]></description>
			<author><![CDATA[null@example.com (Botsy)]]></author>
			<pubDate>Wed, 20 Jan 2021 09:17:28 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=145099#p145099</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Выбрать наименьшую переменную]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=145098#p145098</link>
			<description><![CDATA[<p>Не, ерунду написал, без кавычек нельзя, DllCall просто не вызывалось, так что все варианты остаются одинаковы. <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Wed, 20 Jan 2021 09:14:19 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=145098#p145098</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Выбрать наименьшую переменную]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=145097#p145097</link>
			<description><![CDATA[<p><strong>serzh82saratov</strong> Ага, когда писал еще не было. <br />2125<br />2281<br />672<br />2672<br />Без кавычек зарешало).</p>]]></description>
			<author><![CDATA[null@example.com (Botsy)]]></author>
			<pubDate>Wed, 20 Jan 2021 09:08:39 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=145097#p145097</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Выбрать наименьшую переменную]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=145095#p145095</link>
			<description><![CDATA[<p><strong>serzh82saratov</strong> Ну если не принципиально, то конечно читабельность решает, особенно для новичка.</p>]]></description>
			<author><![CDATA[null@example.com (Botsy)]]></author>
			<pubDate>Wed, 20 Jan 2021 09:02:46 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=145095#p145095</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Выбрать наименьшую переменную]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=145094#p145094</link>
			<description><![CDATA[<div class="codebox"><pre><code>
MsgBox
Start := A_TickCount
loop 200000
	f1()
MsgBox % A_TickCount - Start &quot;`n с кавычками&quot; 

Start := A_TickCount
loop 200000
	f2()
MsgBox % A_TickCount - Start &quot;`n с * и +&quot; 

Start := A_TickCount
loop 200000
	f3()
MsgBox % A_TickCount - Start &quot;`n с If Else &quot; 

f1() { 
	(1 = 1 ? (&quot;&quot;, DllCall(&quot;GetCursorPos&quot;, &quot;Int64*&quot;, pt)) . pt : 0)
	, (1 = 1 ? (&quot;&quot;, DllCall(&quot;GetCursorPos&quot;, &quot;Int64*&quot;, pt)) . pt : 0)
	, (1 = 1 ? (&quot;&quot;, DllCall(&quot;GetCursorPos&quot;, &quot;Int64*&quot;, pt)) . pt : 0)
	, (1 = 1 ? (&quot;&quot;, DllCall(&quot;GetCursorPos&quot;, &quot;Int64*&quot;, pt)) . pt : 0) 
	, (1 = 1 ? (&quot;&quot;, DllCall(&quot;GetCursorPos&quot;, &quot;Int64*&quot;, pt)) . pt : 0)   
}

f2() { 
	(1 = 1 ? 0*DllCall(&quot;GetCursorPos&quot;,&quot;Int64*&quot;,pt)+pt : 0)
	, (1 = 1 ? 0*DllCall(&quot;GetCursorPos&quot;,&quot;Int64*&quot;,pt)+pt : 0)
	, (1 = 1 ? 0*DllCall(&quot;GetCursorPos&quot;,&quot;Int64*&quot;,pt)+pt : 0)
	, (1 = 1 ? 0*DllCall(&quot;GetCursorPos&quot;,&quot;Int64*&quot;,pt)+pt : 0)
	, (1 = 1 ? 0*DllCall(&quot;GetCursorPos&quot;,&quot;Int64*&quot;,pt)+pt : 0)
} 


f3() { 
	If (1 = 1)
		DllCall(&quot;GetCursorPos&quot;, &quot;Int64*&quot;, pt)
	Else 
		MsgBox
	If (1 = 1)
		DllCall(&quot;GetCursorPos&quot;, &quot;Int64*&quot;, pt)
	Else 
		MsgBox
	If (1 = 1)
		DllCall(&quot;GetCursorPos&quot;, &quot;Int64*&quot;, pt)
	Else 
		MsgBox
	If (1 = 1)
		DllCall(&quot;GetCursorPos&quot;, &quot;Int64*&quot;, pt)
	Else 
		MsgBox
	If (1 = 1)
		DllCall(&quot;GetCursorPos&quot;, &quot;Int64*&quot;, pt)
	Else 
		MsgBox
}
</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Wed, 20 Jan 2021 09:01:42 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=145094#p145094</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Выбрать наименьшую переменную]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=145093#p145093</link>
			<description><![CDATA[<p>Теоретически это:<br /></p><div class="codebox"><pre><code>
Acc_ObjectFromPoint(ByRef _idChild_ = &quot;&quot;, x = &quot;&quot;, y = &quot;&quot;) {
	If DllCall(&quot;oleacc\AccessibleObjectFromPoint&quot;
	, &quot;Int64&quot;, x = &quot;&quot; || y = &quot;&quot; ? (&quot;&quot;, DllCall(&quot;GetCursorPos&quot;, &quot;Int64*&quot;, pt)) . pt : x &amp; 0xFFFFFFFF | y &lt;&lt; 32
	, &quot;Ptr* &quot;, pacc, &quot;Ptr&quot;, VarSetCapacity(varChild, 8 + 2 * A_PtrSize, 0) * 0 + &amp;varChild) = 0
		Return ComObjEnwrap(9, pacc, 1), _idChild_ := NumGet(varChild, 8, &quot;UInt&quot;)
}
</code></pre></div><p>Но тут не принципиально. И надо знать особенности парсера интерпретатора. Или провести простой тест.<br /></p><div class="codebox"><pre><code>
Start := A_TickCount
loop 1000000
	вызов функции
MsgBox % A_TickCount - Start
</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Wed, 20 Jan 2021 08:37:22 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=145093#p145093</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Выбрать наименьшую переменную]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=145092#p145092</link>
			<description><![CDATA[<p><strong>serzh82saratov</strong> Это?<br /></p><div class="codebox"><pre><code>
Acc_ObjectFromPoint(ByRef _idChild_ = &quot;&quot;, x = &quot;&quot;, y = &quot;&quot;) {
	If DllCall(&quot;oleacc\AccessibleObjectFromPoint&quot;, &quot;Int64&quot;, x==&quot;&quot;||y==&quot;&quot;?0*DllCall(&quot;GetCursorPos&quot;,&quot;Int64*&quot;,pt)+pt:x&amp;0xFFFFFFFF|y&lt;&lt;32
		, &quot;Ptr*&quot;, pacc, &quot;Ptr&quot;, VarSetCapacity(varChild,8+2*A_PtrSize,0)*0+&amp;varChild)=0
		Return ComObjEnwrap(9,pacc,1), _idChild_:=NumGet(varChild,8,&quot;UInt&quot;)
}
</code></pre></div><p>или это?<br /></p><div class="codebox"><pre><code>
Acc_ObjectFromPoint(ByRef _idChild_ = &quot;&quot;, x = &quot;&quot;, y = &quot;&quot;) {
	VarSetCapacity(varChild, 8 + 2 * A_PtrSize, 0)
	If (x = &quot;&quot; || y = &quot;&quot;)  
		DllCall(&quot;GetCursorPos&quot;, &quot;Int64*&quot;, pt)
	Else 
		pt := x &amp; 0xFFFFFFFF | y &lt;&lt; 32
	If DllCall(&quot;oleacc\AccessibleObjectFromPoint&quot;, &quot;Int64&quot;, pt, &quot;Ptr* &quot;, pacc, &quot;Ptr&quot;, &amp;varChild) = 0
		Return ComObjEnwrap(9, pacc, 1), _idChild_ := NumGet(varChild, 8, &quot;UInt&quot;) 
}
</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Botsy)]]></author>
			<pubDate>Wed, 20 Jan 2021 08:31:56 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=145092#p145092</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Выбрать наименьшую переменную]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=145091#p145091</link>
			<description><![CDATA[<p>Вы 4 и 20 сравниваете?</p>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Wed, 20 Jan 2021 08:29:21 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=145091#p145091</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Выбрать наименьшую переменную]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=145090#p145090</link>
			<description><![CDATA[<p><strong>serzh82saratov</strong> А что будет быстрее, изначальный вариант или ваш с if else?</p>]]></description>
			<author><![CDATA[null@example.com (Botsy)]]></author>
			<pubDate>Wed, 20 Jan 2021 08:27:58 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=145090#p145090</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Выбрать наименьшую переменную]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=145089#p145089</link>
			<description><![CDATA[<div class="quotebox"><cite>Botsy пишет:</cite><blockquote><p>что вернет функция ?</p></blockquote></div><p>Пустоту.</p>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Wed, 20 Jan 2021 08:21:03 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=145089#p145089</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Выбрать наименьшую переменную]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=145088#p145088</link>
			<description><![CDATA[<div class="quotebox"><cite>Botsy пишет:</cite><blockquote><p>я тут слышал мнение, что чем короче написан код, тем быстрее он будет выполняться.</p></blockquote></div><p>Не всегда, от алгоритма зависит. Например Min() переберёт и отсортирует список, StrSplit() переберёт список и создаст массив, и это можно записать в одну короткую строку. Так что в первую очередь надо понимать что написано, а не из скольки символов состоит.</p>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Wed, 20 Jan 2021 08:20:39 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=145088#p145088</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Выбрать наименьшую переменную]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=145087#p145087</link>
			<description><![CDATA[<p><strong>serzh82saratov</strong> А если тут не будет равно &quot;0&quot;, что вернет функция ?<br /></p><div class="codebox"><pre><code>
If DllCall(&quot;oleacc\AccessibleObjectFromPoint&quot;, &quot;Int64&quot;, pt, &quot;Ptr* &quot;, pacc, &quot;Ptr&quot;, &amp;varChild) = 0
		Return ComObjEnwrap(9, pacc, 1), _idChild_ := NumGet(varChild, 8, &quot;UInt&quot;) 
</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Botsy)]]></author>
			<pubDate>Wed, 20 Jan 2021 08:19:39 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=145087#p145087</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Выбрать наименьшую переменную]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=145086#p145086</link>
			<description><![CDATA[<div class="quotebox"><cite>Malcev пишет:</cite><blockquote><p>Кому-то удобно читать подобный код?</p></blockquote></div><p> <br />Если аккуратнее написать, то вполне, если привычно.<br /></p><div class="codebox"><pre><code>Acc_ObjectFromPoint(ByRef _idChild_ = &quot;&quot;, x = &quot;&quot;, y = &quot;&quot;) {
	If DllCall(&quot;oleacc\AccessibleObjectFromPoint&quot;
	, &quot;Int64&quot;, x = &quot;&quot; || y = &quot;&quot; ? 0 * DllCall(&quot;GetCursorPos&quot;, &quot;Int64*&quot;, pt) + pt : x &amp; 0xFFFFFFFF | y &lt;&lt; 32
	, &quot;Ptr* &quot;, pacc, &quot;Ptr&quot;, VarSetCapacity(varChild, 8 + 2 * A_PtrSize, 0) * 0 + &amp;varChild) = 0
		Return ComObjEnwrap(9, pacc, 1), _idChild_ := NumGet(varChild, 8, &quot;UInt&quot;)
}</code></pre></div><p>Но можно и так.<br /></p><div class="codebox"><pre><code>
Acc_ObjectFromPoint(ByRef _idChild_ = &quot;&quot;, x = &quot;&quot;, y = &quot;&quot;) {
	VarSetCapacity(varChild, 8 + 2 * A_PtrSize, 0)
	If (x = &quot;&quot; || y = &quot;&quot;)  
		DllCall(&quot;GetCursorPos&quot;, &quot;Int64*&quot;, pt)
	Else 
		pt := x &amp; 0xFFFFFFFF | y &lt;&lt; 32
	If DllCall(&quot;oleacc\AccessibleObjectFromPoint&quot;, &quot;Int64&quot;, pt, &quot;Ptr* &quot;, pacc, &quot;Ptr&quot;, &amp;varChild) = 0
		Return ComObjEnwrap(9, pacc, 1), _idChild_ := NumGet(varChild, 8, &quot;UInt&quot;) 
}
</code></pre></div><p>Ты бы также написал?</p><p>В данном случае создаётся излишне одна переменная, только если x y указаны, или убирается умножение и сложение если не указаны (там можно было и без них).<br /></p><div class="codebox"><pre><code>(&quot;&quot;, DllCall(&quot;GetCursorPos&quot;, &quot;Int64*&quot;, pt)) . pt</code></pre></div><p>Но когда результаты выражений сохраняются в переменную чтобы далее однажды применится, то это в целом не очень гуд, но это не про этот пример.</p>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Wed, 20 Jan 2021 07:44:45 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=145086#p145086</guid>
		</item>
	</channel>
</rss>
