<?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=11664</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=11664&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: Переменный хоткей».]]></description>
		<lastBuildDate>Mon, 27 Jun 2016 13:30:02 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: Переменный хоткей]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=105604#p105604</link>
			<description><![CDATA[<p>Без процентов ведь надо.</p>]]></description>
			<author><![CDATA[null@example.com (yalanne)]]></author>
			<pubDate>Mon, 27 Jun 2016 13:30:02 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=105604#p105604</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Переменный хоткей]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=105585#p105585</link>
			<description><![CDATA[<p><strong>yalanne</strong><br />Возникла небольшая сложность, у меня почти все хоткеии читаются и пишутся в файл настроек, поэтому здесь необходимо задавать клавишу пройменной.<br /></p><div class="codebox"><pre><code>VariableH.Hkcombo(&quot;!F1&quot;	,	&quot;hotkey1&quot;,1)</code></pre></div><p>Пробовал так, не сработало.<br /></p><div class="codebox"><pre><code>VariableH.Hkcombo(%modkey1%	,	&quot;hotkey1&quot;,1)</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Sgy-x2)]]></author>
			<pubDate>Mon, 27 Jun 2016 04:29:32 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=105585#p105585</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Переменный хоткей]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=105578#p105578</link>
			<description><![CDATA[<p><strong>yalanne</strong><br />Ясно, спасибо.</p>]]></description>
			<author><![CDATA[null@example.com (Sgy-x2)]]></author>
			<pubDate>Sun, 26 Jun 2016 15:23:32 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=105578#p105578</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Переменный хоткей]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=105575#p105575</link>
			<description><![CDATA[<p>Команда Include Просто вставляет Содержимое другого скрипта в свой. При компиляции скрипт будет одним файлом.<br />Просто в место первой строчки вставь код.</p>]]></description>
			<author><![CDATA[null@example.com (yalanne)]]></author>
			<pubDate>Sun, 26 Jun 2016 15:04:59 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=105575#p105575</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Переменный хоткей]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=105574#p105574</link>
			<description><![CDATA[<p><strong>yalanne</strong><br />А как в одном скрипте сделать?</p>]]></description>
			<author><![CDATA[null@example.com (Sgy-x2)]]></author>
			<pubDate>Sun, 26 Jun 2016 14:58:37 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=105574#p105574</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Переменный хоткей]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=105569#p105569</link>
			<description><![CDATA[<div class="codebox"><pre><code>#include VariableH.ahk


VariableH.Hkcombo(&quot;!F1&quot;	,	&quot;hotkey1&quot;,1)  ; Alt+F1(один раз) будет переход на метку hotkey1.
VariableH.Hkcombo(&quot;!F1&quot;	,	&quot;hotkey2&quot;,2) ; Alt+F1(два раза) будет переход на метку hotkey2.
VariableH.Hkcombo(&quot;+F1&quot;	,	&quot;hotkey3&quot;,2) ; Shift+F1(два раза) будет переход на метку hotkey3.

Return

hotkey1:
hotkey2:
hotkey3:
ToolTip % A_ThisLabel
return

</code></pre></div><div class="fancy_spoiler_switcher"><div class="fancy_spoiler_switcher_header"><strong>+</strong>&nbsp;VariableH.ahk</div><div class="fancy_spoiler"><p>Положить рядом с скриптом<br /></p><div class="codebox"><pre><code>#Persistent
VariableH := new VariableH

Class VariableH
{
	Static List := {}
	
	Hkcombo(hk,LabelorFn=&quot;&quot;,pressed=1)
	{
		VariableH.List[hk &quot;_&quot; --pressed] := LabelorFn
		Hotkey,% hk, EventPressHk
	}
	
	PressHKCount(hk)
	{
		Loop 
		{
		   N++
		   KeyWait, %hk%, T.3
		   IfEqual,ErrorLevel,1,Break
		   KeyWait, %hk%, D T0.25
		} Until ErrorLevel
		KeyWait, %hk%
		Return N
	}

	_()
	{
	EventPressHk:
	CountP := VariableH.PressHKCount(	RegExReplace(	A_ThisHotkey,&quot;^\W&quot;)),	CountP--
	
	if  VariableH.List[A_ThisHotkey &quot;_&quot; CountP ]
		if IsFunc(VariableH.List[A_ThisHotkey &quot;_&quot; CountP ])
			func(VariableH.List[A_ThisHotkey &quot;_&quot; CountP ] ).call()
		Else if IsLabel(VariableH.List[A_ThisHotkey &quot;_&quot; CountP ])
			Gosub % VariableH.List[A_ThisHotkey &quot;_&quot; CountP ]
	Return
	}
}</code></pre></div></div></div><p>Можно больше двух нажатий делать.</p>]]></description>
			<author><![CDATA[null@example.com (yalanne)]]></author>
			<pubDate>Sun, 26 Jun 2016 13:52:50 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=105569#p105569</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Переменный хоткей]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=105558#p105558</link>
			<description><![CDATA[<p><strong>yalanne</strong><br />Срабатывает при зажатии.</p>]]></description>
			<author><![CDATA[null@example.com (Sgy-x2)]]></author>
			<pubDate>Sat, 25 Jun 2016 14:46:40 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=105558#p105558</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Переменный хоткей]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=105555#p105555</link>
			<description><![CDATA[<p>Просто не путайте &quot;Ответить&quot; и &quot;Цитировать&quot;. <img src="//forum.script-coding.com/img/smilies/wink.png" width="15" height="15" /></p>]]></description>
			<author><![CDATA[null@example.com (ypppu)]]></author>
			<pubDate>Sat, 25 Jun 2016 12:31:27 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=105555#p105555</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Переменный хоткей]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=105554#p105554</link>
			<description><![CDATA[<p>Вон оно что, я в обще пытался редактировать последние сообщение, но форум решил по другому. Или нажал не то, простите.</p>]]></description>
			<author><![CDATA[null@example.com (Sgy-x2)]]></author>
			<pubDate>Sat, 25 Jun 2016 12:24:00 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=105554#p105554</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Переменный хоткей]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=105553#p105553</link>
			<description><![CDATA[<p><span style="color: green">Это напоминание. Если захотите сказать &quot;Всё ещё актуально&quot;, не цитируйте <a href="http://forum.script-coding.com/viewtopic.php?pid=105206#p105206">такое</a> громоздкое сообщение целиком.</span></p>]]></description>
			<author><![CDATA[null@example.com (ypppu)]]></author>
			<pubDate>Sat, 25 Jun 2016 12:14:57 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=105553#p105553</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Переменный хоткей]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=105552#p105552</link>
			<description><![CDATA[<p>Это предупреждение заранее? Если я вдруг решу процитировать предыдущие сообщение и сказать спасибо?</p>]]></description>
			<author><![CDATA[null@example.com (Sgy-x2)]]></author>
			<pubDate>Sat, 25 Jun 2016 11:51:56 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=105552#p105552</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Переменный хоткей]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=105547#p105547</link>
			<description><![CDATA[<p><span style="color: green"><strong>Sgy-x2</strong>, избегайте избыточного цитирования.</span></p>]]></description>
			<author><![CDATA[null@example.com (ypppu)]]></author>
			<pubDate>Sat, 25 Jun 2016 09:56:29 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=105547#p105547</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Переменный хоткей]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=105543#p105543</link>
			<description><![CDATA[<div class="quotebox"><cite>Sgy-x2 пишет:</cite><blockquote><p>~hotkey1:</p></blockquote></div><p>Это уже не клавиша а метка. лишние символы как <strong>~</strong> уже ошибка.<br /></p><div class="quotebox"><cite>Sgy-x2 пишет:</cite><blockquote><p>&quot;~%hotkey1%&quot;</p></blockquote></div><p>Так же метка не содержит значения как переменная.</p><p>Вот вариант:</p><div class="codebox"><pre><code>modkey1 = !
modkey2 = F1
Hotkey,% modkey1 modkey2, hotkey1
Return

hotkey1:
if (A_ThisHotkey = A_PriorHotkey and A_TimeSincePriorHotkey &lt; 300)
{
	MsgBox, Test
}

KeyWait, % A_ThisHotkey
Return

</code></pre></div><div class="fancy_spoiler_switcher"><div class="fancy_spoiler_switcher_header"><strong>+</strong>&nbsp;с комментами</div><div class="fancy_spoiler"><div class="codebox"><pre><code>modkey1 = !	; Первая клавиша alt
modkey2 = F1 ; Вторая клавиша F1
Hotkey,% modkey1 modkey2, hotkey1 ; В первый параметр заносим &#039;!F1&#039;. Второй параметр это название метки, куда скрипт будет ссылаться при нажатии кнопок указанных в первом параметре.
Return ; убираем лишнее срабатывание при старте скрипта. 

hotkey1: ; метка.
if (A_ThisHotkey = A_PriorHotkey and A_TimeSincePriorHotkey &lt; 300) ; если текущая клавиша равна предыдущей и при этом прошло менее 300 мс, то срабатывает условие.
{
	MsgBox, Test
}

KeyWait, % A_ThisHotkey ; ждем отжатия клавиши. Это надо что бы избежать двойного нажатия при зажатии кнопки.
Return

</code></pre></div></div></div>]]></description>
			<author><![CDATA[null@example.com (yalanne)]]></author>
			<pubDate>Sat, 25 Jun 2016 09:05:23 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=105543#p105543</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Переменный хоткей]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=105542#p105542</link>
			<description><![CDATA[<p>Всё ещё актуально.</p>]]></description>
			<author><![CDATA[null@example.com (Sgy-x2)]]></author>
			<pubDate>Sat, 25 Jun 2016 08:40:56 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=105542#p105542</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Переменный хоткей]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=105206#p105206</link>
			<description><![CDATA[<p>Скажите пожалуйста, есть такой скрипт, действие от двойного нажатия. Можно ли сделать хоткей переменный?</p><p>Оригинал.<br /></p><div class="codebox"><pre><code>~Control::
if (A_PriorHotkey &lt;&gt; &quot;~Control&quot; or A_TimeSincePriorHotkey &gt; 300)
{
	KeyWait, Control
	Return
}
KeyWait, Control
MsgBox, Test
Return</code></pre></div><p>Пытался так, не работает.<br /></p><div class="codebox"><pre><code>modkey1 := Control
Hotkey, % modkey1, hotkey1
~hotkey1:
if (A_PriorHotkey &lt;&gt; &quot;~%hotkey1%&quot; or A_TimeSincePriorHotkey &gt; 300)
{
	KeyWait, % hotkey1
	Return
}
KeyWait, % hotkey1
MsgBox, Test
Return</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Sgy-x2)]]></author>
			<pubDate>Tue, 14 Jun 2016 03:04:57 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=105206#p105206</guid>
		</item>
	</channel>
</rss>
