<?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=10907&amp;type=atom" />
	<updated>2018-03-06T09:33:41Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=10907</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Задание условия на нажатие клавиши]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123949#p123949" />
			<content type="html"><![CDATA[<p>Директивы выделяются символом #.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2018-03-06T09:33:41Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123949#p123949</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Задание условия на нажатие клавиши]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123941#p123941" />
			<content type="html"><![CDATA[<p><strong>Malcev</strong>, какие параметры данного скрипта являются директивами?</p>]]></content>
			<author>
				<name><![CDATA[becauseim]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33149</uri>
			</author>
			<updated>2018-03-05T21:44:42Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123941#p123941</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Задание условия на нажатие клавиши]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123884#p123884" />
			<content type="html"><![CDATA[<p>За компьютером буду нескоро. Можете попробовать вынести из функции переменную count в начало скрипта и обьявить ее глобальной. Ну и директивы тоже вынести.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2018-03-02T19:36:47Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123884#p123884</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Задание условия на нажатие клавиши]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123883#p123883" />
			<content type="html"><![CDATA[<p><strong>Malcev</strong>, он, по всей видимости, работает без учета нюансов, которые были описаны позже. Последний вариант невозможно заключить в ф-ию?</p>]]></content>
			<author>
				<name><![CDATA[becauseim]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33149</uri>
			</author>
			<updated>2018-03-02T19:16:44Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123883#p123883</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Задание условия на нажатие клавиши]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123882#p123882" />
			<content type="html"><![CDATA[<p>Используйте за основу код из 60 поста.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2018-03-02T19:11:27Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123882#p123882</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Задание условия на нажатие клавиши]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123880#p123880" />
			<content type="html"><![CDATA[<p><strong>Malcev</strong>, хочу назначить мультинажатие на множество клавиш, дабы не копировать многократно основную массу кода.</p>]]></content>
			<author>
				<name><![CDATA[becauseim]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33149</uri>
			</author>
			<updated>2018-03-02T07:22:12Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123880#p123880</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Задание условия на нажатие клавиши]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123878#p123878" />
			<content type="html"><![CDATA[<p>Не подскажу, так как не понимаю, что вы хотите добиться и чем вас не устраивает вариант без функции.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2018-03-01T23:42:12Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123878#p123878</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Задание условия на нажатие клавиши]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123877#p123877" />
			<content type="html"><![CDATA[<p><strong>Malcev</strong>, подскажите, пожалуйста, как добавить последний вариант в ф-ию? Ниже нерабочая попытка.<br /></p><div class="codebox"><pre><code>#SingleInstance Force

f2:: 
MultikeyReset(&quot;{vk4B}&quot;, &quot;{vk44}+{5}+{9}+{3}&quot;, &quot;{vk58}^+{vk41}&quot;)
return

MultikeyReset(arr1, arr2, arr3){
#InstallKeybdHook
#InstallMouseHook
   count := 0
arr:=[arr1, arr2, arr3]
If (A_PriorKey != A_ThisHotkey)
   count := 0
array := arr[Count := Count*((A_PriorHotkey = A_ThisHotkey))+1]
loop, parse, array, `,
{
   SendInput % A_LoopField
   sleep 200
}
if (count  = arr.Length())
{
   count := 0
   KeyWait % A_ThisHotkey
   return
}
}
return</code></pre></div>]]></content>
			<author>
				<name><![CDATA[becauseim]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33149</uri>
			</author>
			<updated>2018-03-01T21:02:19Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123877#p123877</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Задание условия на нажатие клавиши]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=105267#p105267" />
			<content type="html"><![CDATA[<p><strong>Malcev</strong>, спасибо, работает!<br /></p><div class="quotebox"><blockquote><p>А зачем нужна эта строчка?</p></blockquote></div><p>К сожалению, не знаю.</p>]]></content>
			<author>
				<name><![CDATA[becauseim]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33149</uri>
			</author>
			<updated>2016-06-15T22:15:49Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=105267#p105267</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Задание условия на нажатие клавиши]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=104915#p104915" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>#SingleInstance Force
#InstallKeybdHook
#InstallMouseHook
Count := 0
f1::
arr:=[&quot;1,1_1,1_2&quot;, &quot;2,2_1&quot;, &quot;3&quot;]
If (A_PriorKey != A_ThisHotkey)
   count := 0
array := arr[Count := Count*((A_PriorHotkey = A_ThisHotkey))+1]
loop, parse, array, `,
{
   gosub % A_LoopField
   sleep 200
}
if (count  = arr.Length())
{
   count := 0
   KeyWait % A_ThisHotkey
   return
}
return

1:
ToolTip % a_thislabel
return
1_1:
ToolTip % a_thislabel
return
1_2:
ToolTip % a_thislabel
return
2:
ToolTip % a_thislabel
return
2_1:
ToolTip % a_thislabel
return
3:
ToolTip % a_thislabel
return</code></pre></div><p>А зачем нужна эта строчка?<br /></p><div class="codebox"><pre><code>if (A_TimeSincePriorHotkey &lt; 50) and (A_TimeSincePriorHotkey != -1) and (count = arr.Length())
   return</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2016-06-07T20:27:08Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=104915#p104915</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Задание условия на нажатие клавиши]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=104895#p104895" />
			<content type="html"><![CDATA[<p><strong>Malcev</strong>, спасибо! Только при зажатии клавиши метки проверяются циклично. Необходимо остановится на последней, т.е. в данном случае, на метке &quot;3&quot;.</p>]]></content>
			<author>
				<name><![CDATA[becauseim]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33149</uri>
			</author>
			<updated>2016-06-07T18:34:52Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=104895#p104895</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Задание условия на нажатие клавиши]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=104886#p104886" />
			<content type="html"><![CDATA[<p>Если брать за основу код из 69 поста, то можно так:<br /></p><div class="codebox"><pre><code>#SingleInstance Force
#InstallKeybdHook
#InstallMouseHook
Count := 0
f1::
arr:=[&quot;1,1_1,1_2&quot;, &quot;2,2_1&quot;, &quot;3&quot;]
if (A_TimeSincePriorHotkey &lt; 50) and (A_TimeSincePriorHotkey != -1) and (count = arr.Length())
   return
If (A_PriorKey != A_ThisHotkey) or (count = arr.Length())
   count := 0
array := arr[Count := Count*((A_PriorHotkey = A_ThisHotkey))+1]
loop, parse, array, `,
{
   gosub % A_LoopField
   sleep 500
}
return

1:
ToolTip % a_thislabel
return
1_1:
ToolTip % a_thislabel
return
1_2:
ToolTip % a_thislabel
return
2:
ToolTip % a_thislabel
return
2_1:
ToolTip % a_thislabel
return
3:
ToolTip % a_thislabel
return</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2016-06-07T15:52:35Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=104886#p104886</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Задание условия на нажатие клавиши]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=104885#p104885" />
			<content type="html"><![CDATA[<p><strong>Malcev</strong>, в приведенном варианте каждое нажатие горячей клавиши переходит к определенной (одной) метке. Необходима возможность устанавливать неограниченное кол-во меток на каждое нажатие. При этом, по-прежнему, при зажатии горячей клавиши, сценарий должен пройти поочередно все метки и остановиться на последней.</p><p>Gosub не подходит, т.к. в моем случае будет множество дублирований практически одного и того же. Т.к. для каждой мультизадачной горячей клавиши будет необходимо создавать уникальные метки. Хотелось бы, чтобы метки универсально использовались для разных горячих клавиш.</p>]]></content>
			<author>
				<name><![CDATA[becauseim]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33149</uri>
			</author>
			<updated>2016-06-07T15:22:46Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=104885#p104885</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Задание условия на нажатие клавиши]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=104883#p104883" />
			<content type="html"><![CDATA[<p>Мне лично ничего не понятно.<br />Почему не подходит GoSub?</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2016-06-07T14:47:46Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=104883#p104883</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Задание условия на нажатие клавиши]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=104857#p104857" />
			<content type="html"><![CDATA[<p>Подскажите, пожалуйста, как, например, ко второму нажатию горячей клавиши добавить выполнение метки &quot;4&quot;, следом за меткой &quot;2&quot;?<br /></p><div class="codebox"><pre><code>#SingleInstance Force
#InstallKeybdHook
#InstallMouseHook
1::
arr:=[&quot;1&quot;, &quot;2&quot;, &quot;3&quot;]
if (A_TimeSincePriorHotkey &lt; 50) and (A_TimeSincePriorHotkey != -1) and (count = arr.Length())
   return
If (A_PriorKey != A_ThisHotkey) or (count = arr.Length())
   count := 0
gosub % arr[Count := Count*((A_PriorHotkey = A_ThisHotkey))+1]
return

1:
2:
3:
ToolTip % a_thislabel
return

4:
MsgBox % a_thislabel
return</code></pre></div><p>Такой вариант не подходит:<br /></p><div class="codebox"><pre><code>2:
gosub 4
ToolTip % a_thislabel
return</code></pre></div><div class="fancy_spoiler_switcher"><div class="fancy_spoiler_switcher_header"><strong>+</strong>&nbsp;Для чего это нужно:</div><div class="fancy_spoiler"><p>В следующем примере в результате зажатия горячей клавиши, как и задумывалось, выполнение сценария останавливается на последней метке:<br /></p><div class="codebox"><pre><code>1::
arr:= [&quot;1&quot;, &quot;2&quot;, &quot;3&quot;]
if (A_TimeSincePriorHotkey &lt; 50) and (A_TimeSincePriorHotkey != -1) and (count = arr.Length())
   return
If (A_PriorKey != A_ThisHotkey) or (count = arr.Length())
   count := 0
gosub % arr[Count := Count*((A_PriorHotkey = A_ThisHotkey))+1]
return

1:
2:
3:
ToolTip % a_thislabel
return</code></pre></div><p>А так в результате зажатия метки выполняются по кругу (где метка &quot;Analyze&quot; должна выполняться на ряду с меткой &quot;1&quot;):<br /></p><div class="codebox"><pre><code>1::
arr:= [&quot;1&quot;, &quot;2&quot;, &quot;3&quot;]
if (A_TimeSincePriorHotkey &lt; 50) and (A_TimeSincePriorHotkey != -1) and (count = arr.Length())
   return
If (A_PriorKey != A_ThisHotkey) or (count = arr.Length())
   count := 0
gosub % arr[Count := Count*((A_PriorHotkey = A_ThisHotkey))+1]
gosub Analyze
return

1:
2:
3:
ToolTip % a_thislabel
return

Analyze:
MouseGetPos, FXClipX, FXClipY
ImageSearch, AnalyzeX, AnalyzeY, 0, 0, A_ScreenWidth, A_ScreenHeight, %A_ScriptDir%\Analyze.png
If ErrorLevel = 0
	MouseClick, , %AnalyzeX%, %AnalyzeY%, 1 ,0.5
MouseMove, %FXClipX%, %FXClipY%, 0.5
return</code></pre></div></div></div>]]></content>
			<author>
				<name><![CDATA[becauseim]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33149</uri>
			</author>
			<updated>2016-06-06T19:21:39Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=104857#p104857</id>
		</entry>
</feed>
