<?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=8836</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=8836&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: Как в переменную заключить целый скрипт?».]]></description>
		<lastBuildDate>Wed, 30 Oct 2013 08:28:09 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: Как в переменную заключить целый скрипт?]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=76694#p76694</link>
			<description><![CDATA[<p>Это жестоко, честное слово, потом же будешь на свои же грабли наступать, лучше так:<br /></p><div class="codebox"><pre><code>Gosub Block1
;-----код
ExitApp

Block1:
; Выполняем то что нужно
return</code></pre></div><p> а проще ещё так<br /></p><div class="codebox"><pre><code>Block1()
;-----код
ExitApp


Block1(){
global ;======убрать если нужно локализовать переменные функции
;----Тело функции
return
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Indomito)]]></author>
			<pubDate>Wed, 30 Oct 2013 08:28:09 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=76694#p76694</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Как в переменную заключить целый скрипт?]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=76693#p76693</link>
			<description><![CDATA[<p>Справился с проблемой при помощи <br /></p><div class="codebox"><pre><code>block1:</code></pre></div><p>и<br /></p><div class="codebox"><pre><code>Goto, block1</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (gydzibity)]]></author>
			<pubDate>Wed, 30 Oct 2013 08:19:19 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=76693#p76693</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Как в переменную заключить целый скрипт?]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=76687#p76687</link>
			<description><![CDATA[<p>Пример обычного числового объекта в виде двухмерного массива </p><div class="codebox"><pre><code>Test := {sasa:{KeyA: 1, KeyB: 2, KeyB: 3}, tata:{KeyC: 10, KeyD: 20, KeyE: 30}}</code></pre></div><p>Читать a:=Test.sasa.KeyB получим 2<br />Писать Test.тата.KeyЕ++ значение увеличители на +1 было 30 стало 31</p><p>В ключи можно подставить функции или же ключи заменить на вызовы функций которые действительны только в рамках объекта, а как описывать см. мой пост выше.</p>]]></description>
			<author><![CDATA[null@example.com (Indomito)]]></author>
			<pubDate>Wed, 30 Oct 2013 07:41:33 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=76687#p76687</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Как в переменную заключить целый скрипт?]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=76685#p76685</link>
			<description><![CDATA[<p>Может стоит справку прочесть? <img src="//forum.script-coding.com/img/smilies/wink.png" width="15" height="15" /></p><p><strong>Custom Objects</strong></p><div class="fancy_spoiler_switcher"><div class="fancy_spoiler_switcher_header" data-lang-open="открыть спойлер" data-lang-close="скрыть спойлер"><strong>+</strong>&nbsp;открыть спойлер</div><div class="fancy_spoiler"><div class="quotebox"><blockquote><p>Objects in AutoHotkey are prototype-based rather than class-based. That is, an object can inherit properties and methods from its prototype or base object, but do not need to have a pre-defined structure. Properties and methods can also be added to (or removed from) an object or any of the objects it derives from at any time. However, AutoHotkey emulates classes by translating class definitions into ordinary objects. For more complex or specialized situations, the base object can override the standard behaviour by defining meta-functions.</p><p>To create an object derived from another object, scripts can assign a base or use the new keyword:</p></blockquote></div><div class="codebox"><pre><code>baseObject := {foo: &quot;bar&quot;}
obj1 := Object(), obj1.base := baseObject
obj2 := {base: baseObject}
obj3 := new baseObject
MsgBox % obj1.foo &quot; &quot; obj2.foo &quot; &quot; obj3.foo</code></pre></div></div></div><p>ИЛИ</p><p><strong>Prototypes</strong></p><div class="fancy_spoiler_switcher"><div class="fancy_spoiler_switcher_header" data-lang-open="открыть спойлер" data-lang-close="скрыть спойлер"><strong>+</strong>&nbsp;открыть спойлер</div><div class="fancy_spoiler"><div class="quotebox"><blockquote><p>Prototype or base objects are constructed and manipulated the same as any other object. For example, an ordinary object with one property and one method might be constructed like this:</p></blockquote></div><div class="codebox"><pre><code>; Create an object.
thing := {}
; Store a value.
thing.foo := &quot;bar&quot;
; Create a method by storing a function reference.
thing.test := Func(&quot;thing_test&quot;)
; Call the method.
thing.test()

thing_test(this) {
   MsgBox % this.foo
}</code></pre></div><div class="quotebox"><blockquote><p>When thing.test() is called, thing is automatically inserted at the beginning of the parameter list. However, for backward-compatibility, this does not occur when a function is stored by name (rather than by reference) directly in the object (rather than being inherited from a base object). By convention, the function is named by combining the &quot;type&quot; of object and the method name.</p><p>An object is a prototype or base if another object derives from it:</p></blockquote></div><div class="codebox"><pre><code>other := {}
other.base := thing
other.test()</code></pre></div><div class="quotebox"><blockquote><p>In this case, other inherits foo and test from thing. This inheritance is dynamic, so if thing.foo is modified, the change will be reflected by other.foo. If the script assigns to other.foo, the value is stored in other and any further changes to thing.foo will have no effect on other.foo. When other.test() is called, its this parameter contains a reference to other instead of thing.</p></blockquote></div></div></div><p>P.S. Переводить я не стал, т.к. могу не соблюсти точность терминологии.</p>]]></description>
			<author><![CDATA[null@example.com (Indomito)]]></author>
			<pubDate>Wed, 30 Oct 2013 07:24:11 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=76685#p76685</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Как в переменную заключить целый скрипт?]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=76684#p76684</link>
			<description><![CDATA[<div class="quotebox"><cite>Indomito пишет:</cite><blockquote><div class="quotebox"><cite>gydzibity пишет:</cite><blockquote><p>Как в переменную заключить целый скрипт?</p></blockquote></div><p> воспользуйся ООП(Object-oriented programming).</p><p>Создай объект и определи его метод(ы), можно в одну переменную/массив &quot;засунуть&quot; кучу действий, причём взаимосвязанных, там и данные будут и функции.</p><p>Почитай англ. справку в формате CHM, твой вариант/твоё желание весьма легко воплощается/реализуется.</p><p>P.S. Для начала прочти мою тему, правда у меня проблемы совсем другие, хотя решаемые, но надо лезть в классы, а мне не хочется <a href="http://forum.script-coding.com/viewtopic.php?id=8835">AHK: Ассоциативные массивы около трёх вопросов.</a></p></blockquote></div><p>Можете подробнее описать.</p>]]></description>
			<author><![CDATA[null@example.com (gydzibity)]]></author>
			<pubDate>Wed, 30 Oct 2013 07:05:35 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=76684#p76684</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Как в переменную заключить целый скрипт?]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=76683#p76683</link>
			<description><![CDATA[<div class="quotebox"><cite>gydzibity пишет:</cite><blockquote><p>Как в переменную заключить целый скрипт?</p></blockquote></div><p> воспользуйся ООП(Object-oriented programming).</p><p>Создай объект и определи его метод(ы), можно в одну переменную/массив &quot;засунуть&quot; кучу действий, причём взаимосвязанных, там и данные будут и функции.</p><p>Почитай англ. справку в формате CHM, твой вариант/твоё желание весьма легко воплощается/реализуется.</p><p>P.S. Для начала прочти мою тему, правда у меня проблемы совсем другие, хотя решаемые, но надо лезть в классы, а мне не хочется <a href="http://forum.script-coding.com/viewtopic.php?id=8835">AHK: Ассоциативные массивы около трёх вопросов.</a></p><p><strong>UPD</strong></p><div class="quotebox"><cite>Irbis пишет:</cite><blockquote><p>то его можно оформить в виде процедуры.</p></blockquote></div><p> а лучше в виде функции, что бы локализовать переменные, ну и уже не обращать больше на неё внимания - на вход <strong>ТО-то</strong>, а на выходе <strong>ЭТО</strong>.</p>]]></description>
			<author><![CDATA[null@example.com (Indomito)]]></author>
			<pubDate>Wed, 30 Oct 2013 06:59:59 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=76683#p76683</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Как в переменную заключить целый скрипт?]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=76666#p76666</link>
			<description><![CDATA[<p>Если цель состоит <span class="bbu">именно</span> в том, чтобы в переменной был скрипт(???), то вряд ли кто может помочь.<br />Если же нужно вынести первый скрипт за пределы хоткея <strong>F1</strong>, то его можно оформить в виде процедуры.</p>]]></description>
			<author><![CDATA[null@example.com (Irbis)]]></author>
			<pubDate>Tue, 29 Oct 2013 14:26:03 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=76666#p76666</guid>
		</item>
		<item>
			<title><![CDATA[AHK: Как в переменную заключить целый скрипт?]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=76664#p76664</link>
			<description><![CDATA[<p>Ребят, вот у меня есть некий скрипт<br /></p><div class="codebox"><pre><code>
  PixelSearch,,, 681-451
                , 571-321
                , 681+451
                , 571+321
                , 0x23DC23,, Fast
If Errorlevel
{
Sleep 1000
MouseClick, L, 582, 302, 1, 10
}
Else
{
PixelSearch, Px, Py, 0, 0, 1280, 1024, 0x23DC23, 0, fast
MouseClick, left, %Px%, %Py%, 1, 30
}
</code></pre></div><p>Я хочу этот скрипт заключить в переменную Var1! Если вы подскажите как это сделать, то сразу подскажите как мне его выполнять. Ну например: <br /></p><div class="codebox"><pre><code>
F1::
MsgBox, Привет =)
Var1
MsgBox? Пока =(
Return
</code></pre></div><p>И можно ли будет эту переменную использовать в ней самой!?<br />Пример:<br /></p><div class="codebox"><pre><code>
  PixelSearch,,, 681-451
                , 571-321
                , 681+451
                , 571+321
                , 0x23DC23,, Fast
If Errorlevel
{
Sleep 1000
MouseClick, L, 582, 302, 1, 10
Var1
}
Else
{
PixelSearch, Px, Py, 0, 0, 1280, 1024, 0x23DC23, 0, fast
MouseClick, left, %Px%, %Py%, 1, 30
}
</code></pre></div><p>Зарание спасибо.</p>]]></description>
			<author><![CDATA[null@example.com (gydzibity)]]></author>
			<pubDate>Tue, 29 Oct 2013 14:02:26 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=76664#p76664</guid>
		</item>
	</channel>
</rss>
