<?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=13223&amp;type=atom" />
	<updated>2018-03-04T10:39:57Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=13223</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вопросы по объектам]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123903#p123903" />
			<content type="html"><![CDATA[<p>Так?<br /></p><div class="codebox"><pre><code>
var := 3
MsgBox, % Format(&quot;p{1:.4f}&quot;, var)
</code></pre></div><p><strong>UPD:</strong> Не так. Это ставит нули после.<br />Тогда у Вас верно:<br /></p><div class="codebox"><pre><code>
var := 3
MsgBox, % Format(&quot;p{1:.4i}&quot;, var)
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[KusochekDobra]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33846</uri>
			</author>
			<updated>2018-03-04T10:39:57Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123903#p123903</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вопросы по объектам]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123901#p123901" />
			<content type="html"><![CDATA[<p>Вчера была идея, но что-то не продумал и поспешил отказываться от неё. Сейчас проверил - работает:<br /></p><div class="codebox"><pre><code>MyObject := {}
MyObject := {p01: 1, p02: 2, p10: 10}

FOR k in MyObject
MsgBox, %k%</code></pre></div><p>Если есть возможность именовать ключи в алфавитном порядке, то этого достаточно.</p><br /><p>OFF: не очень разобрался в функции Format(). Проверьте,&nbsp; так правильно?<br /></p><div class="codebox"><pre><code>var := 3
var := noliki(var)
MsgBox, % var

noliki(input) ;функция добавляет нули (чтобы стояло 4 знака перед запятой) и букву &quot;p&quot;
{
output := &quot;p&quot;
output .= Format(&quot;{1:.4i}&quot;, input)
Return, output
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2018-03-04T08:39:24Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123901#p123901</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вопросы по объектам]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123894#p123894" />
			<content type="html"><![CDATA[<p>Правильно, только лучше так:<br /></p><div class="codebox"><pre><code>MyObject := [{p1: 1}, {p2: 2}, {p10: 10}]

for k, v in MyObject
   for k, v in v
      MsgBox % k &quot;: &quot; v</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2018-03-03T12:48:40Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123894#p123894</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вопросы по объектам]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123893#p123893" />
			<content type="html"><![CDATA[<p>У массива нет такого свойства как порядок.<br />Когда вы присваиваете в коде &quot;обычный&quot; массив, расположение элементов играет роль только потому, что ключами элементов автоматически назначаются числа в соответсвии с расположением элементов в записи массива.<br /></p><div class="codebox"><pre><code>MyObject := [{p1: 1}, {p2: 2}, {p10: 10}]

FOR k in MyObject
	FOR k, v in MyObject[k]
		MsgBox % k &quot;: &quot; v</code></pre></div>]]></content>
			<author>
				<name><![CDATA[stealzy]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=31937</uri>
			</author>
			<updated>2018-03-03T12:43:55Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123893#p123893</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вопросы по объектам]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123892#p123892" />
			<content type="html"><![CDATA[<p>Если нужен цифровой порядок, используется обычный массив.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2018-03-03T12:13:08Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123892#p123892</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вопросы по объектам]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123888#p123888" />
			<content type="html"><![CDATA[<p>Вопрос о порядке чередования данных в объекте.</p><p>Я помещаю пары &quot;ключ-значение&quot; в объект в нужном мне порядке. При использовании цикла FOR-loop данные извлекаются в алфавитном порядке.<br />А хотелось бы, чтобы данные извлекались в том же порядке, в котором я их помещал в объект. Как это лучше осуществить? Может имеется стандартный способ?</p><div class="codebox"><pre><code>MyObject := {}
MyObject := {p1: 1, p2: 2, p10: 10}

FOR k in MyObject
MsgBox, %k%</code></pre></div>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2018-03-03T09:59:56Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123888#p123888</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вопросы по объектам]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123006#p123006" />
			<content type="html"><![CDATA[<p><strong>serzh82saratov</strong>, но Ваш <a href="http://forum.script-coding.com/viewtopic.php?pid=123001#p123001">пример</a>&nbsp; не доказывает, что можно<br /></p><div class="quotebox"><blockquote><p>без ByRef изменить внешний объект изнутри ф-ии присваивая переменной (объекта) другое значение (другой объект)</p></blockquote></div><p>И до f(x), и после f(x) значение o.Property1 равно 111. <br />o.Property1 изменится на 222, если раскомментировать&nbsp; «; x.Property1 := 222». Но ведь это уже не есть присваивание переменной объекта другого значения (другого объекта), не так ли?</p>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2018-01-12T03:56:32Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123006#p123006</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вопросы по объектам]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123004#p123004" />
			<content type="html"><![CDATA[<p>Обсуждение объектов и указателей:<br /><a href="https://autohotkey.com/boards/viewtopic.php?t=316">https://autohotkey.com/boards/viewtopic.php?t=316</a><br /></p><div class="quotebox"><cite>lexikos пишет:</cite><blockquote><p>obj is also not the name of an object; it is the name of a variable containing [a reference to] an object.</p></blockquote></div><p>— объекты не имеют имен.<br /><a href="https://autohotkey.com/boards/viewtopic.php?t=5868">https://autohotkey.com/boards/viewtopic.php?t=5868</a><br /><a href="https://autohotkey.com/boards/viewtopic.php?t=6916">https://autohotkey.com/boards/viewtopic.php?t=6916</a></p><p>Новейшая документация по теме:<br /><a href="https://autohotkey.com/docs/Concepts.htm#objects">https://autohotkey.com/docs/Concepts.htm#objects</a></p>]]></content>
			<author>
				<name><![CDATA[stealzy]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=31937</uri>
			</author>
			<updated>2018-01-11T22:55:06Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123004#p123004</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вопросы по объектам]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123003#p123003" />
			<content type="html"><![CDATA[<p>Ок. <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>2018-01-11T21:47:41Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123003#p123003</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вопросы по объектам]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123001#p123001" />
			<content type="html"><![CDATA[<p>Приводить такой код, не так приятно для самолюбия как, не дочитали не вникли.<br /></p><div class="codebox"><pre><code>
f2()

f(x) {  
	x := {Property1: 222}
	 ; x.Property1 := 222 
	
}
f2() {
	o := {Property1: 111}
	MsgBox % o.Property1
	f(o)
	MsgBox % o.Property1
}
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2018-01-11T19:22:04Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123001#p123001</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вопросы по объектам]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123000#p123000" />
			<content type="html"><![CDATA[<p>Наверное имеется в виду <br /></p><div class="quotebox"><blockquote><p>Без ByRef нельзя изменить внешний объект изнутри ф-ии <span style="color: grey"><strong>таким способом как&nbsp; &nbsp;x := {Property1: 200, Property2: 300}</strong></span></p></blockquote></div>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2018-01-11T19:14:37Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123000#p123000</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вопросы по объектам]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=122999#p122999" />
			<content type="html"><![CDATA[<p>Дочитал, не вник, предложил привести пример. Если бы вник, то (оказалось не для всех это очевидно) пример бы не спрашивал.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2018-01-11T18:55:38Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=122999#p122999</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вопросы по объектам]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=122995#p122995" />
			<content type="html"><![CDATA[<div class="quotebox"><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>2018-01-11T16:29:06Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=122995#p122995</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вопросы по объектам]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=122994#p122994" />
			<content type="html"><![CDATA[<p>Без ByRef нельзя изменить внешний объект изнутри ф-ии присваивая переменной (объекта) другое значение (другой объект). Но можно редактировать переданный объект и его элементы.</p>]]></content>
			<author>
				<name><![CDATA[stealzy]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=31937</uri>
			</author>
			<updated>2018-01-11T16:24:00Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=122994#p122994</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вопросы по объектам]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=122992#p122992" />
			<content type="html"><![CDATA[<p>Почему глобальный, любой.<br /></p><div class="codebox"><pre><code>
f2()

f(x) { 
	x.RemoveAt(1)
}
f2() {
	o := [1, 2] 
	MsgBox % o[1]
	f(o)
	MsgBox % o[1]
}
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2018-01-11T16:14:16Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=122992#p122992</id>
		</entry>
</feed>
