<?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=11664&amp;type=atom" />
	<updated>2016-06-27T13:30:02Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=11664</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Переменный хоткей]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=105604#p105604" />
			<content type="html"><![CDATA[<p>Без процентов ведь надо.</p>]]></content>
			<author>
				<name><![CDATA[yalanne]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32850</uri>
			</author>
			<updated>2016-06-27T13:30:02Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=105604#p105604</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Переменный хоткей]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=105585#p105585" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[Sgy-x2]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32753</uri>
			</author>
			<updated>2016-06-27T04:29:32Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=105585#p105585</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Переменный хоткей]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=105578#p105578" />
			<content type="html"><![CDATA[<p><strong>yalanne</strong><br />Ясно, спасибо.</p>]]></content>
			<author>
				<name><![CDATA[Sgy-x2]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32753</uri>
			</author>
			<updated>2016-06-26T15:23:32Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=105578#p105578</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Переменный хоткей]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=105575#p105575" />
			<content type="html"><![CDATA[<p>Команда Include Просто вставляет Содержимое другого скрипта в свой. При компиляции скрипт будет одним файлом.<br />Просто в место первой строчки вставь код.</p>]]></content>
			<author>
				<name><![CDATA[yalanne]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32850</uri>
			</author>
			<updated>2016-06-26T15:04:59Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=105575#p105575</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Переменный хоткей]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=105574#p105574" />
			<content type="html"><![CDATA[<p><strong>yalanne</strong><br />А как в одном скрипте сделать?</p>]]></content>
			<author>
				<name><![CDATA[Sgy-x2]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32753</uri>
			</author>
			<updated>2016-06-26T14:58:37Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=105574#p105574</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Переменный хоткей]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=105569#p105569" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[yalanne]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32850</uri>
			</author>
			<updated>2016-06-26T13:52:50Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=105569#p105569</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Переменный хоткей]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=105558#p105558" />
			<content type="html"><![CDATA[<p><strong>yalanne</strong><br />Срабатывает при зажатии.</p>]]></content>
			<author>
				<name><![CDATA[Sgy-x2]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32753</uri>
			</author>
			<updated>2016-06-25T14:46:40Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=105558#p105558</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Переменный хоткей]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=105555#p105555" />
			<content type="html"><![CDATA[<p>Просто не путайте &quot;Ответить&quot; и &quot;Цитировать&quot;. <img src="//forum.script-coding.com/img/smilies/wink.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2016-06-25T12:31:27Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=105555#p105555</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Переменный хоткей]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=105554#p105554" />
			<content type="html"><![CDATA[<p>Вон оно что, я в обще пытался редактировать последние сообщение, но форум решил по другому. Или нажал не то, простите.</p>]]></content>
			<author>
				<name><![CDATA[Sgy-x2]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32753</uri>
			</author>
			<updated>2016-06-25T12:24:00Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=105554#p105554</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Переменный хоткей]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=105553#p105553" />
			<content type="html"><![CDATA[<p><span style="color: green">Это напоминание. Если захотите сказать &quot;Всё ещё актуально&quot;, не цитируйте <a href="http://forum.script-coding.com/viewtopic.php?pid=105206#p105206">такое</a> громоздкое сообщение целиком.</span></p>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2016-06-25T12:14:57Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=105553#p105553</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Переменный хоткей]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=105552#p105552" />
			<content type="html"><![CDATA[<p>Это предупреждение заранее? Если я вдруг решу процитировать предыдущие сообщение и сказать спасибо?</p>]]></content>
			<author>
				<name><![CDATA[Sgy-x2]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32753</uri>
			</author>
			<updated>2016-06-25T11:51:56Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=105552#p105552</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Переменный хоткей]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=105547#p105547" />
			<content type="html"><![CDATA[<p><span style="color: green"><strong>Sgy-x2</strong>, избегайте избыточного цитирования.</span></p>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2016-06-25T09:56:29Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=105547#p105547</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Переменный хоткей]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=105543#p105543" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[yalanne]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32850</uri>
			</author>
			<updated>2016-06-25T09:05:23Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=105543#p105543</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Переменный хоткей]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=105542#p105542" />
			<content type="html"><![CDATA[<p>Всё ещё актуально.</p>]]></content>
			<author>
				<name><![CDATA[Sgy-x2]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32753</uri>
			</author>
			<updated>2016-06-25T08:40:56Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=105542#p105542</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Переменный хоткей]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=105206#p105206" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[Sgy-x2]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32753</uri>
			</author>
			<updated>2016-06-14T03:04:57Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=105206#p105206</id>
		</entry>
</feed>
