<?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=17128&amp;type=atom" />
	<updated>2022-05-20T18:46:09Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=17128</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как объединить два скрипта в один?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=153306#p153306" />
			<content type="html"><![CDATA[<p>Всё-таки можно и без таймера:</p><div class="codebox"><pre><code>M := 0		; Режим отправки: 0:Обычный, 1:Реверс.
Keys := &quot;wdsasdw&quot;	; Клавиши для отправки.
I := 0		; Индекс текущей клавиши.
R := 0		; Флаг: 1:Нужно начать заново отправку клавиш.
Wait := 25	; Задержка между посылом клавиши.
Pause

Loop{
 I := (R ? 1 : (I &gt; 3 ? 1 : I+1), R=0)
 MM := SubStr(Keys, I+(M*3),1)
 Send, {%MM%}
 Sleep, % Wait
}
Return

F2:: M := !M, R := 1	; Переключить режим: 0:Обычный, 1:Реверс.
F3:: Pause		; Приостановить / Возобновить работу скрипта.
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[__Михаил__]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40928</uri>
			</author>
			<updated>2022-05-20T18:46:09Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=153306#p153306</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как объединить два скрипта в один?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=153299#p153299" />
			<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>2022-05-20T16:31:42Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=153299#p153299</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как объединить два скрипта в один?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=153297#p153297" />
			<content type="html"><![CDATA[<p>Почему в один цикл нельзя?</p><div class="codebox"><pre><code>
mode = 0
loop {
	if (mode = 1)
		GoSub lb1
	if (mode = 2)
		GoSub lb2
}

Label1:
mode = 1
Return

Label2:
mode = 2
Return

Numpad1::GoSub, Label1
Numpad2::GoSub, Label2

lb1:
Send {a}
Sleep 100
return

lb2:
Send {b}
Sleep 100
return


Numpad0::ExitApp</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Vsevolod]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40918</uri>
			</author>
			<updated>2022-05-20T16:19:04Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=153297#p153297</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как объединить два скрипта в один?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=153267#p153267" />
			<content type="html"><![CDATA[<p>Ура! А то я уже упаковал. <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2022-05-18T18:35:55Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=153267#p153267</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как объединить два скрипта в один?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=153266#p153266" />
			<content type="html"><![CDATA[<p>Значит оба компа <strong>teadrinker</strong> может не выкидывать.</p>]]></content>
			<author>
				<name><![CDATA[__Михаил__]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40928</uri>
			</author>
			<updated>2022-05-18T17:26:28Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=153266#p153266</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как объединить два скрипта в один?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=153265#p153265" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>Проблема кода, который выложил коллега <strong>Foma</strong> в том, что переключиться он может только один раз</p></blockquote></div><p> Проверил. Вы правы.</p>]]></content>
			<author>
				<name><![CDATA[Foma]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=31521</uri>
			</author>
			<updated>2022-05-18T17:07:50Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=153265#p153265</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как объединить два скрипта в один?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=153254#p153254" />
			<content type="html"><![CDATA[<p><strong>isxodnik</strong><br />Перезапуск скрипта, ну да - отличный костыль. На таймеры обиделись?</p>]]></content>
			<author>
				<name><![CDATA[__Михаил__]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40928</uri>
			</author>
			<updated>2022-05-18T15:55:20Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=153254#p153254</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как объединить два скрипта в один?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=153251#p153251" />
			<content type="html"><![CDATA[<p>Если уж использовать перезагрузку, то можно обойтись без нажатия лишней клавиши:<br /></p><div class="codebox"><pre><code>#SingleInstance, Force 

if (A_Args[1] = 0) {
   Loop
   {
      ToolTip a
      Sleep, 100
   }
}
if A_Args[1] {
   Loop
   {
      ToolTip b
      Sleep, 100
   }
}
NumPad1:: Run, % A_ScriptFullPath . &quot; &quot; . 0
NumPad2:: Run, % A_ScriptFullPath . &quot; &quot; . 1</code></pre></div><p>Но я уверен, что форумчане способны придумать красивые решения без перезагрузки.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2022-05-18T13:49:29Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=153251#p153251</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как объединить два скрипта в один?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=153244#p153244" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>e::

Loop
	{
	Send {a}
	Sleep, 100
	}

r::

Loop
	{
	Send {b}
	Sleep, 100
	}

q::Reload</code></pre></div><p>Чтобы с &quot;b&quot; переключиться на &quot;a&quot;, нужно нажать &quot;q&quot;, &quot;e&quot;. Как костыль на время поиска более изящного решения...</p>]]></content>
			<author>
				<name><![CDATA[isxodnik]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=41364</uri>
			</author>
			<updated>2022-05-18T01:55:52Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=153244#p153244</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как объединить два скрипта в один?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=153243#p153243" />
			<content type="html"><![CDATA[<p><strong>__Михаил__</strong>, я думаю, задача не в том, чтобы выполнять оба цикла одновременно, а в том, чтобы переключать с одного на другой по горячей клавише. Проблема кода, который выложил коллега <strong>Foma</strong> в том, что переключиться он может только один раз. Можете проверить сами, замените символы, как я советовал выше. Только не на заглавные.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2022-05-17T18:45:57Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=153243#p153243</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как объединить два скрипта в один?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=153242#p153242" />
			<content type="html"><![CDATA[<p><strong>Foma</strong><br />АХК не может выполнять две и более задачи одновременно таким кодом - цикл прерывается новым.<br />Не первый год уже программируете всё еще не запомнили?</p>]]></content>
			<author>
				<name><![CDATA[__Михаил__]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40928</uri>
			</author>
			<updated>2022-05-17T18:40:52Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=153242#p153242</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как объединить два скрипта в один?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=153239#p153239" />
			<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>2022-05-17T17:44:16Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=153239#p153239</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как объединить два скрипта в один?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=153238#p153238" />
			<content type="html"><![CDATA[<p>Я менял последние на &quot;U&quot; и &quot;O&quot;, перед тем как ответить. Работает. Во время выполнения &quot;Sleep&quot; идёт перехват и прекрасно работает.</p>]]></content>
			<author>
				<name><![CDATA[Foma]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=31521</uri>
			</author>
			<updated>2022-05-17T17:38:58Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=153238#p153238</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как объединить два скрипта в один?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=153236#p153236" />
			<content type="html"><![CDATA[<p>Поменяйте символы из первого цикла на &quot;а&quot;, из второго на &quot;b&quot;, попереключайте несколько раз.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2022-05-17T16:22:38Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=153236#p153236</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как объединить два скрипта в один?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=153235#p153235" />
			<content type="html"><![CDATA[<p>А почему у меня работает? Может не так, как задумано автором, но работает.<br />Если он хочет их включать по очереди в идеально подходящий момент, то пусть напишет.<br /> У меня оба включаются и выход срабатывает, пусть иногда с задержкой.</p>]]></content>
			<author>
				<name><![CDATA[Foma]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=31521</uri>
			</author>
			<updated>2022-05-17T15:19:48Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=153235#p153235</id>
		</entry>
</feed>
