<?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=10496&amp;type=atom" />
	<updated>2015-03-14T08:32:47Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=10496</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: хоткей по двойному нажатию с зажатым модификатором]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=92510#p92510" />
			<content type="html"><![CDATA[<p>Благодарю за ответы. Поколдую с вашими вариантами. Прошу прощения, если поднял уже многократно обсужденный вопрос. Треды, где обсуждалось обычное двойное нажатие, я нашел, но с зажатым модификатором вызвало у меня затруднение.</p>]]></content>
			<author>
				<name><![CDATA[Kamagi]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27024</uri>
			</author>
			<updated>2015-03-14T08:32:47Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=92510#p92510</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: хоткей по двойному нажатию с зажатым модификатором]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=92503#p92503" />
			<content type="html"><![CDATA[<div class="quotebox"><blockquote><p>произвожу двойное, тройное или длительное нажатие одной клавиши</p></blockquote></div><p>Вопрос поднимался неоднократно, думаю что <br />это поможет в большинстве случаев:<br /></p><div class="codebox"><pre><code>
#UseHook 

!1::
&lt;^!+#2::
    HK := RegExReplace(A_ThisHotkey, &quot;S)[\Q+^!#&lt;&gt;~*$\E]&quot;), i := 0  
    KeyWait, %HK%, T0.7
    If !ErrorLevel 
        Loop  {
            KeyWait, %HK%
            KeyWait, %HK%, D T0.3
        } Until !(++i) || ErrorLevel 
    Try Gosub % A_ThisHotkey &quot;_&quot; i 
    Return

!1_3:  
    MsgBox Alt+1+1+1 
    Return
    
!1_0:   
    MsgBox Удержание Alt+1 более 0.7 секунд
    Return
    
&lt;^!+#2_5: 
    MsgBox LCtrl+Alt+Shift+Win+2+2+2+2+2
    Return
</code></pre></div><br /><div class="fancy_spoiler_switcher"><div class="fancy_spoiler_switcher_header"><strong>+</strong>&nbsp;2 вариант, с регистрацией длительного удержания на любом этапе.</div><div class="fancy_spoiler"><div class="codebox"><pre><code>
#UseHook 

!1::
&lt;^!+#2::
    HK := RegExReplace(A_ThisHotkey, &quot;S)[\Q+^!#&lt;&gt;~*$\E]&quot;), i := 0   
    Loop  {
        KeyWait, %HK%, T0.7
        i := ErrorLevel ? -1 : i
        KeyWait, %HK%, D T0.2
    } Until !(++i) || ErrorLevel 
    Try Gosub % A_ThisHotkey &quot;_&quot; i 
    Return

!1_3:  
    MsgBox Alt+1+1+1 
    Return
    
!1_0:   
    MsgBox Удержание Alt+1 более 0.7 секунд
    Return
    
&lt;^!+#2_5: 
    MsgBox LCtrl+Alt+Shift+Win+2+2+2+2+2
    Return
</code></pre></div></div></div>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2015-03-13T19:17:20Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=92503#p92503</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: хоткей по двойному нажатию с зажатым модификатором]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=92502#p92502" />
			<content type="html"><![CDATA[<p>Спасибо за ответ! Скрипт работает на &quot;ура!&quot;. Со своей стороны могу предложить работающий вариант для тройного нажатия: </p><div class="codebox"><pre><code>!1::
if Alt1_presses &gt; 0
{
Alt1_presses += 1
SetTimer, KeyAlt1, 300
return
}
Alt1_presses = 1
SetTimer, KeyAlt1, 300
return

KeyAlt1:
SetTimer, KeyAlt1, off
KeyWait, Alt, L     ; then up &quot;Alt&quot;
if Alt1_presses = 1
    MsgBox 1
else
if Alt1_presses = 2
    MsgBox 2
else
if Alt1_presses &gt;=  3
    MsgBox 3
Alt1_presses = 0
return</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Kamagi]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27024</uri>
			</author>
			<updated>2015-03-13T17:51:45Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=92502#p92502</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: хоткей по двойному нажатию с зажатым модификатором]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=92501#p92501" />
			<content type="html"><![CDATA[<p>Что-то типа этого?<br /></p><div class="codebox"><pre><code>
!1::
    KeyWait, 1
    KeyWait, 1, D T0.3
    If ErrorLevel = 1
        MsgBox, Alt+1
    Else
        MsgBox, Alt+1+1
    Return
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[YMP]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=81</uri>
			</author>
			<updated>2015-03-13T15:42:04Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=92501#p92501</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: хоткей по двойному нажатию с зажатым модификатором]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=92500#p92500" />
			<content type="html"><![CDATA[<p>Приветствую!</p><p>Я работаю в программе, в которой Alt - основной модификатор. Мне уже не достаточно обычных хоткеев (Alt+1), есть намерение расширить функционал. К примеру, при зажатом Alt произвожу двойное, тройное или длительное нажатие одной клавиши - исполняется хоткей, отжимаю Alt. </p><p>Пробовал решить вопрос несколькими способами, и всё неудачно. <br />Буду рад помощи, совету. </p><p>Никак не реагирует на нажатие едички:</p><div class="codebox"><pre><code>Alt::

GetKeyState, state, Alt
    if State = D
        {
        KeyWait, 1, T1
        {
        if ErrorLevel = 1
            MsgBox 1
        Else 
            MsgBox 2
        }
        }
    else
        MsgBox Up</code></pre></div><p>KeyWait сразу идёт на else:<br /></p><div class="codebox"><pre><code>!1::
KeyWait, 1, D T1
if ErrorLevel = 1
MsgBox 1
else
MsgBox 2</code></pre></div><p>Редко и не понятно в какой ситуации выскакивает MsgBox 3:<br /></p><div class="codebox"><pre><code>Alt::
KeyWait, 1, D T1
if ErrorLevel = 1 
{
KeyWait, 1, D T1
if ErrorLevel = 1 
MsgBox 2
else
MsgBox 1

}
else 
MsgBox 3
Return</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Kamagi]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27024</uri>
			</author>
			<updated>2015-03-13T15:08:13Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=92500#p92500</id>
		</entry>
</feed>
