<?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=11635&amp;type=atom" />
	<updated>2016-05-27T20:05:39Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=11635</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Округление в минус.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=104337#p104337" />
			<content type="html"><![CDATA[<p><strong>yalanne</strong> спасибо, помогло. Видимо использовал Ceil неправильно. Тему можно закрывать.</p>]]></content>
			<author>
				<name><![CDATA[Alex_Lexon]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32135</uri>
			</author>
			<updated>2016-05-27T20:05:39Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=104337#p104337</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Округление в минус.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=104333#p104333" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Alex_Lexon пишет:</cite><blockquote><p>Не помогло.</p></blockquote></div><p>Ну, не только прочитать нужно было, ещё и выводы сделать. Вот в предыдущем посте есть разъяснения, почитайте тоже. Если не помогает, приведите свой вариант, который не работает.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2016-05-27T17:28:35Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=104333#p104333</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Округление в минус.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=104332#p104332" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>Читайте <a href="http://forum.script-coding.com/viewtopic.php?pid=104286#p104286">этот</a> пост. Ну, и главное, <a href="https://autohotkey.com/docs/Variables.htm#Variable_names">эту</a> статью.</p></blockquote></div><div class="quotebox"><cite>Alex_Lexon пишет:</cite><blockquote><div class="codebox"><pre><code>
Numpad4::
3 = 16
2 := 138
2/=10
Ceil(%2%)
3-=%2%
Sendinput {F6}/usedrugs %3%{Enter}
return</code></pre></div><p>После такого скрипта перменная 3 становится 3, а мне в общем то надо 2...</p></blockquote></div><p>Не помогло.</p>]]></content>
			<author>
				<name><![CDATA[Alex_Lexon]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32135</uri>
			</author>
			<updated>2016-05-27T17:07:08Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=104332#p104332</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Округление в минус.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=104327#p104327" />
			<content type="html"><![CDATA[<p>Используя чисто числовые переменные могут возникнуть проблемы с передачей в функции. Еще использовать имя переменной как одну цифру может вызвать путаницу в прочтении кода, особенно если еще использовать математические действия.<br /></p><div class="fancy_spoiler_switcher"><div class="fancy_spoiler_switcher_header"><strong>+</strong>&nbsp;Вот пример где скрипт получает параметры(из вне) в цифровые переменные</div><div class="fancy_spoiler"><div class="codebox"><pre><code>1 = Из_скрипта
msgbox %1% %2%</code></pre></div><p>Без передачи параметров, текст окна будет такой:<br /><span class="postimg"><img src="http://i.imgur.com/bhkKuSG.png" alt="http://i.imgur.com/bhkKuSG.png" /></span><br /> Самый простой способ передать сюда параметры, это создать ярлык и в свойствах указать эти параметры:<br /><span class="postimg"><img src="http://i.imgur.com/sFDdjCf.gif" alt="http://i.imgur.com/sFDdjCf.gif" /></span><br />Вот так будет выглядеть окно:<br /><span class="postimg"><img src="http://i.imgur.com/LZ5HQdd.png" alt="http://i.imgur.com/LZ5HQdd.png" /></span><br /><strong>Параметр1</strong> было уже в скрипте установлено новое значение. </p><p>Что бы так же не было путаницы, желательно в свою переменную заносить передаваемые параметры. Например:<br />Param1 = %1%</p></div></div><br /><br /><div class="quotebox"><cite>Alex_Lexon пишет:</cite><blockquote><p>После такого скрипта перменная 3 становится 3, а мне в общем то надо 2...</p></blockquote></div><p><span style="color: blue">У переменной под названием 3 значение равно 16.</span><br /><span style="color: red">У переменной под названием 2 Значение 138.</span><br /><span style="color: blue">Устанавливаем то что во второй переменной значение должно поделится на 10(Но этот оператор работает немного неправильно, но подходит к этому случаю. <a href="https://autohotkey.com/docs/Variables.htm#AssignOp">в англ справке это сказано.[кликабельно]</a> Так как число не с плавающей точкой, то оператор сам округляет до минимально возможного числа) - Получаем число 13</span><br /><span style="color: red">Ceil тут вообще не работает, тут допущены 3 ошибки. </span><br /><span style="color: blue">Так как в переменной по имени 3 значение 16, а в переменной 2 значение 13 получаем 16 - 13 = 3</span><br /></p><div class="quotebox"><blockquote><p><span style="color: blue">3 = 16</span><br /><span style="color: red">2 := 138</span><br /><span style="color: blue">2/=10</span><br /><span style="color: red">Ceil(%2%)</span><br /><span style="color: blue">3-=%2%</span></p></blockquote></div><div class="fancy_spoiler_switcher"><div class="fancy_spoiler_switcher_header"><strong>+</strong>&nbsp;Ошибки в Ceil</div><div class="fancy_spoiler"><p>1) Значение никуда не заносится, просто уходит в пустоту. Нужно перед началом подставлять имя переменной и оператор <strong>:=</strong>.<br />2) Указав %% в функции это значит что имя переменной должно взяться из другой переменной.Пример:<br /></p><div class="codebox"><pre><code>var = 123
VarParent = var
fn(%VarParent%)

fn(v)
{
	msgbox % v
}</code></pre></div><p>3) Если указать без процентов скрипт посчитает это не как переменную а как простое число, если указать правильное имя&nbsp; переменной, то это сработает:<br /></p><div class="codebox"><pre><code>var := 123 / 10
varNew:= Ceil(var)
msgbox %  varNew</code></pre></div></div></div><p>Вот как будет правильно используя не цифровые имена переменных и с правильным ceil<br /></p><div class="codebox"><pre><code>var1 := 16
var2 := 138
var2 := Ceil(var2 / 10)
var1 -= var2
msgbox % var1</code></pre></div><p>Так же результат вычитания можно выводить в 3ю переменную:<br />(вместо предпоследней строки)<br /></p><div class="codebox"><pre><code>var3 := var1- var2</code></pre></div>]]></content>
			<author>
				<name><![CDATA[yalanne]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32850</uri>
			</author>
			<updated>2016-05-27T16:02:31Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=104327#p104327</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Округление в минус.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=104310#p104310" />
			<content type="html"><![CDATA[<p>Читайте <a href="http://forum.script-coding.com/viewtopic.php?pid=104286#p104286">этот</a> пост. Ну, и главное, <a href="https://autohotkey.com/docs/Variables.htm#Variable_names">эту</a> статью.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2016-05-27T14:39:51Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=104310#p104310</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Округление в минус.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=104307#p104307" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong> а что, есть разница?</p>]]></content>
			<author>
				<name><![CDATA[Alex_Lexon]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32135</uri>
			</author>
			<updated>2016-05-27T14:13:46Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=104307#p104307</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Округление в минус.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=104303#p104303" />
			<content type="html"><![CDATA[<p>Также не нужно цитировать предыдущий пост полностью. Для скриптов используйте буквенные или буквенно-цифровые переменные: MyVar, x, y, Var1 и т. п.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2016-05-27T12:47:29Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=104303#p104303</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Округление в минус.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=104300#p104300" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong> Выполнено!</p>]]></content>
			<author>
				<name><![CDATA[Alex_Lexon]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32135</uri>
			</author>
			<updated>2016-05-27T11:08:59Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=104300#p104300</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Округление в минус.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=104294#p104294" />
			<content type="html"><![CDATA[<p><span style="color: green"><strong>Alex_Lexon</strong>, ознакомьтесь с <a href="http://forum.script-coding.com/viewtopic.php?id=6148">этой</a> темой, отредактируйте свой пост.</span></p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2016-05-27T07:19:24Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=104294#p104294</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Округление в минус.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=104292#p104292" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>Переменные, состоящие из одних цифр, используются только как параметры, передаваемые скрипту, в остальных случаях использовать не нужно.</p></blockquote></div><p>К сожалению не знаю как написать скрипт без них.</p>]]></content>
			<author>
				<name><![CDATA[Alex_Lexon]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32135</uri>
			</author>
			<updated>2016-05-27T04:58:49Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=104292#p104292</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Округление в минус.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=104286#p104286" />
			<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>2016-05-26T18:08:36Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=104286#p104286</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Округление в минус.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=104285#p104285" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>
Numpad4::
3 = 16
2 := 138
2/=10
Ceil(%2%)
3-=%2%
Sendinput {F6}/usedrugs %3%{Enter}
return</code></pre></div><p>После такого скрипта перменная 3 становится 3, а мне в общем то надо 2...</p>]]></content>
			<author>
				<name><![CDATA[Alex_Lexon]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32135</uri>
			</author>
			<updated>2016-05-26T16:22:59Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=104285#p104285</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Округление в минус.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=104263#p104263" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>n := 14.8
MsgBox, % Floor(n)

n := 1.2
MsgBox, % Ceil(n)</code></pre></div>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2016-05-26T09:44:23Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=104263#p104263</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Округление в минус.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=104260#p104260" />
			<content type="html"><![CDATA[<p>4Окей. А как округлить в плюс? К примеру 1.2 что бы было 2</p>]]></content>
			<author>
				<name><![CDATA[Alex_Lexon]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32135</uri>
			</author>
			<updated>2016-05-26T08:46:04Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=104260#p104260</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Округление в минус.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=104259#p104259" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>YMP пишет:</cite><blockquote><p>n := Floor(12.9)<br />MsgBox, %n%</p></blockquote></div><p>Попробовал, 14.8 округляет все равно до 15.</p>]]></content>
			<author>
				<name><![CDATA[Alex_Lexon]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32135</uri>
			</author>
			<updated>2016-05-26T08:44:56Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=104259#p104259</id>
		</entry>
</feed>
