<?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=15990&amp;type=atom" />
	<updated>2021-01-20T10:24:09Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=15990</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Выбрать наименьшую переменную]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=145102#p145102" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2021-01-20T10:24:09Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=145102#p145102</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Выбрать наименьшую переменную]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=145100#p145100" />
			<content type="html"><![CDATA[<p>Исправил тесты. Теперь всё наоборот. <img src="//forum.script-coding.com/img/smilies/big_smile.png" width="15" height="15" /><br />С кавычками немного дольше,&nbsp; If Else и * + одинаково.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2021-01-20T09:20:07Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=145100#p145100</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Выбрать наименьшую переменную]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=145099#p145099" />
			<content type="html"><![CDATA[<p><strong>serzh82saratov</strong> Что за подстава, я 4-ый раз переобуваюсь).</p>]]></content>
			<author>
				<name><![CDATA[Botsy]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=41069</uri>
			</author>
			<updated>2021-01-20T09:17:28Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=145099#p145099</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Выбрать наименьшую переменную]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=145098#p145098" />
			<content type="html"><![CDATA[<p>Не, ерунду написал, без кавычек нельзя, DllCall просто не вызывалось, так что все варианты остаются одинаковы. <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2021-01-20T09:14:19Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=145098#p145098</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Выбрать наименьшую переменную]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=145097#p145097" />
			<content type="html"><![CDATA[<p><strong>serzh82saratov</strong> Ага, когда писал еще не было. <br />2125<br />2281<br />672<br />2672<br />Без кавычек зарешало).</p>]]></content>
			<author>
				<name><![CDATA[Botsy]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=41069</uri>
			</author>
			<updated>2021-01-20T09:08:39Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=145097#p145097</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Выбрать наименьшую переменную]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=145095#p145095" />
			<content type="html"><![CDATA[<p><strong>serzh82saratov</strong> Ну если не принципиально, то конечно читабельность решает, особенно для новичка.</p>]]></content>
			<author>
				<name><![CDATA[Botsy]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=41069</uri>
			</author>
			<updated>2021-01-20T09:02:46Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=145095#p145095</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Выбрать наименьшую переменную]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=145094#p145094" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2021-01-20T09:01:42Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=145094#p145094</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Выбрать наименьшую переменную]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=145093#p145093" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2021-01-20T08:37:22Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=145093#p145093</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Выбрать наименьшую переменную]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=145092#p145092" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[Botsy]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=41069</uri>
			</author>
			<updated>2021-01-20T08:31:56Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=145092#p145092</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Выбрать наименьшую переменную]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=145091#p145091" />
			<content type="html"><![CDATA[<p>Вы 4 и 20 сравниваете?</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2021-01-20T08:29:21Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=145091#p145091</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Выбрать наименьшую переменную]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=145090#p145090" />
			<content type="html"><![CDATA[<p><strong>serzh82saratov</strong> А что будет быстрее, изначальный вариант или ваш с if else?</p>]]></content>
			<author>
				<name><![CDATA[Botsy]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=41069</uri>
			</author>
			<updated>2021-01-20T08:27:58Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=145090#p145090</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Выбрать наименьшую переменную]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=145089#p145089" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Botsy пишет:</cite><blockquote><p>что вернет функция ?</p></blockquote></div><p>Пустоту.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2021-01-20T08:21:03Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=145089#p145089</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Выбрать наименьшую переменную]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=145088#p145088" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Botsy пишет:</cite><blockquote><p>я тут слышал мнение, что чем короче написан код, тем быстрее он будет выполняться.</p></blockquote></div><p>Не всегда, от алгоритма зависит. Например Min() переберёт и отсортирует список, StrSplit() переберёт список и создаст массив, и это можно записать в одну короткую строку. Так что в первую очередь надо понимать что написано, а не из скольки символов состоит.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2021-01-20T08:20:39Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=145088#p145088</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Выбрать наименьшую переменную]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=145087#p145087" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[Botsy]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=41069</uri>
			</author>
			<updated>2021-01-20T08:19:39Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=145087#p145087</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Выбрать наименьшую переменную]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=145086#p145086" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2021-01-20T07:44:45Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=145086#p145086</id>
		</entry>
</feed>
