<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Сочетания Shift и Alt в разных порядках]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=15534&amp;type=atom" />
	<updated>2020-07-26T15:08:09Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=15534</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Сочетания Shift и Alt в разных порядках]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=141124#p141124" />
			<content type="html"><![CDATA[<p><strong>stealzy</strong><br /><strong>teadrinker</strong><br />Ваши ответы навели меня на более простое, хоть и менее элегантное решение. Спасибо!<br /></p><div class="codebox"><pre><code>
~$LAlt::
while GetKeyState(&quot;LAlt&quot;, &quot;P&quot;)
{
    while (GetKeyState(&quot;LAlt&quot;, &quot;P&quot;) &amp;&amp; !GetKeyState(&quot;LShift&quot;, &quot;P&quot;))
        Sleep, 30

    if GetKeyState(&quot;LShift&quot;,&quot;P&quot;)
    {
        sh_down_time := A_TimeSinceThisHotkey
        while (GetKeyState(&quot;LAlt&quot;, &quot;P&quot;) &amp;&amp; GetKeyState(&quot;LShift&quot;, &quot;P&quot;))
            Sleep, 30

        if (GetKeyState(&quot;LAlt&quot;), &quot;P&quot;)
        {
            if ( (A_TimeSinceThisHotkey - sh_down_time) &lt; single_press_time )
            {
                if ( WinActive(&quot;ahk_class SunAwtFrame&quot;) || WinActive(&quot;ahk_class SunAwtDialog&quot;) )
                {
                    key_seq := [&quot;{RAlt Down}&quot;, &quot;{LShift Down}&quot;, &quot;{VKBF Down}&quot;
                                   , &quot;{VKBF Up}&quot;, &quot;{LShift Up}&quot;, &quot;{RAlt Up}&quot;]
                    for i, key in key_seq
                    {
                        Send, %key%
                        Sleep, %key_delay%
                    }
                }
            }
        }
        else
        {
            KeyWait, LShift
            SetLayout(dvolemak_code)
        }
    }
    else
    {
        KeyWait, LAlt
        if (A_PriorKey == &quot;LAlt&quot; &amp;&amp; A_TimeSinceThisHotkey &lt; single_press_time)
        {
            if ( WinActive(&quot;ahk_class SunAwtFrame&quot;) || WinActive(&quot;ahk_class SunAwtDialog&quot;) )
            {
                key_seq := [&quot;{LAlt Down}&quot;, &quot;{VKBF Down}&quot;, &quot;{VKBF Up}&quot;, &quot;{LAlt Up}&quot;]
                for i, key in key_seq
                {
                    Send, %key%
                    Sleep, %key_delay%
                }
            }
        }
    }
}
return

~$LShift::
while GetKeyState(&quot;LShift&quot;, &quot;P&quot;)
{
    while (GetKeyState(&quot;LShift&quot;, &quot;P&quot;) &amp;&amp; !GetKeyState(&quot;LAlt&quot;, &quot;P&quot;))
        Sleep, 30

    if GetKeyState(&quot;LAlt&quot;,&quot;P&quot;)
    {
        lalt_down_time := A_TimeSinceThisHotkey
        while (GetKeyState(&quot;LShift&quot;, &quot;P&quot;) &amp;&amp; GetKeyState(&quot;LAlt&quot;, &quot;P&quot;))
            Sleep, 30

        if (GetKeyState(&quot;LShift&quot;), &quot;P&quot;)
        {
            if ( (A_TimeSinceThisHotkey - lalt_down_time) &lt; 300 )
            {
                ; TODO: Single Press LAlt With Hold LShift
            }
        }
        else
        {
            KeyWait, LAlt
            SetLayout(dictor_code)
        }
    }
    else
    {
        KeyWait, LShift
        if (A_PriorKey == &quot;LShift&quot; &amp;&amp; A_TimeSinceThisHotkey &lt; single_press_time)
        {
            Send, {Esc}
        }
    }
}
return</code></pre></div>]]></content>
			<author>
				<name><![CDATA[mkone112]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40951</uri>
			</author>
			<updated>2020-07-26T15:08:09Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=141124#p141124</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Сочетания Shift и Alt в разных порядках]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=141122#p141122" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>__Михаил__ пишет:</cite><blockquote><p>Такие сложности, не легче ли будет установить одну клавишу для переключения языка, от двойного - второе действие, а если её удерживаешь третье? Так же можно сделать проверку тех же Shift, Alt, Win, Ctrl.</p></blockquote></div><p>Одиночное нажатие уже посылает Esc или DeadKey, следовательно двойное нажатие либо не сделать, либо предется городить задержки.<br />Удержание уже занято.<br />Все Shift, Alt, Win и Ctrl уже заняты.</p>]]></content>
			<author>
				<name><![CDATA[mkone112]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40951</uri>
			</author>
			<updated>2020-07-26T15:04:31Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=141122#p141122</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Сочетания Shift и Alt в разных порядках]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=140809#p140809" />
			<content type="html"><![CDATA[<p><strong>mkone112</strong>, сначала нужно будет создать инструмент для установки таких <em>произвольных горячих клавиш</em>.<br />Алгоритм такой:<br />• записываем в память скрипта лог всех нажатий и отпусканий клавиш,<br />• устанавливаем последовательности, которые будут служить хоткеями,<br />• по нажатию любой их конечных клавиш хоткеев проводим проверку: совпадает ли лог нажатий с последовательностью хоткея, если совпадает выполняем действие.</p><p>Результат выглядеть будет как-то так (без кода самого инструмента):<br /></p><div class="codebox"><pre><code>ohk := New OptionalHotKey
ohk.SetHotkey(&quot;{LAlt Down}{LShift Down}{LAlt Up}{LShift Up}&quot;, Func(&quot;SetLayout&quot;).Bind(&quot;ru&quot;))
ohk.SetHotkey(&quot;{LShift Down}{LAlt Down}{LShift Up}{LAlt Up}&quot;, Func(&quot;SetLayout&quot;).Bind(&quot;en&quot;))
ohk.SetHotkey(&quot;{LAlt Down}{LShift Down}{LShift Up}{LAlt Up}&quot;, Func(&quot;Send&quot;).Bind(&quot;+!{vkBF}&quot;))
ohk.SetHotkey(&quot;{LShift Down}{LAlt Down}{LAlt Up}{LShift Up}&quot;, Func(&quot;Send&quot;).Bind(&quot;{F13}&quot;))
ohk.SetHotkey(&quot;{LAlt Down}{LAlt Up}&quot;, Func(&quot;Send&quot;).Bind(&quot;!{vkBF}&quot;))
ohk.SetHotkey(&quot;{LShift Down}{LShift Up}&quot;, Func(&quot;Send&quot;).Bind(&quot;{Esc}&quot;))</code></pre></div><p>Кстати говоря, хоткеи на одиночные нажатия можно реализовать и традиционным путем: после нажатия ставя KeyWait на ее же отжатие, после чего проверяя чтобы в A_PriorKey было нажатие этой же клавиши (т.е. никаких других клавиш между нажатием и отжатием данной клавиши не было).</p>]]></content>
			<author>
				<name><![CDATA[stealzy]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=31937</uri>
			</author>
			<updated>2020-07-21T14:18:06Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=140809#p140809</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Сочетания Shift и Alt в разных порядках]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=140803#p140803" />
			<content type="html"><![CDATA[<p><strong>mkone112</strong>, тут довольно сложная логика получится, я бы с таким не заморачивался. Думаю, лучше всего использовать клавиатурный хук для отслеживания порядка нажатий клавиш. <a href="https://www.autohotkey.com/docs/commands/InputHook.htm">InputHook()</a><br /></p><div class="codebox"><pre><code>Hook := InputHook(&quot;V&quot;)
Hook.KeyOpt(&quot;{LAlt}{LShift}&quot;, &quot;VN&quot;)
Hook.OnKeyDown := Func(&quot;KeyDown&quot;)
Hook.OnKeyUp := Func(&quot;KeyUp&quot;)
Hook.Start()
Return

KeyDown(Hook, vk, sc) {
   keyName := GetKeyName(Format(&quot;vk{:x}sc{:x}&quot;, vk, sc))
   ToolTip % keyName . &quot; Down&quot;
}

KeyUp(Hook, vk, sc) {
   keyName := GetKeyName(Format(&quot;vk{:x}sc{:x}&quot;, vk, sc))
   ToolTip % keyName . &quot; Up&quot;
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2020-07-20T19:20:38Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=140803#p140803</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Сочетания Shift и Alt в разных порядках]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=140801#p140801" />
			<content type="html"><![CDATA[<p><strong>__Михаил__</strong><br />Он ее не переключает, а устанавливает на конкретную(модифицированный colemak). В вашей системе ее нет поэтому код ничего не делает, узнать номер текущей раскладки можно так.</p><div class="fancy_spoiler_switcher"><div class="fancy_spoiler_switcher_header" data-lang-open="открыть спойлер" data-lang-close="скрыть спойлер"><strong>+</strong>&nbsp;открыть спойлер</div><div class="fancy_spoiler"><div class="codebox"><pre><code>DllCall(&quot;GetKeyboardLayout&quot;, &quot;Int&quot;, DllCall(&quot;GetWindowThreadProcessId&quot;, &quot;Int&quot;, WinActive(&quot;A&quot;), &quot;Int&quot;, 0))</code></pre></div></div></div><p> И проблема в любом случае не в установке языка, а данном коде проблемы в том что LAlt при нажатии залипает посылая +{/} многократно и срабатывает при нажатии LAlt &amp; LShift.</p>]]></content>
			<author>
				<name><![CDATA[mkone112]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40951</uri>
			</author>
			<updated>2020-07-20T19:15:21Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=140801#p140801</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Сочетания Shift и Alt в разных порядках]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=140799#p140799" />
			<content type="html"><![CDATA[<p>Лично у меня подобный код не переключает язык:</p><div class="codebox"><pre><code>ControlGetFocus, control, A
PostMessage 0x50, 0, -255785959, %control%, A</code></pre></div>]]></content>
			<author>
				<name><![CDATA[__Михаил__]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40928</uri>
			</author>
			<updated>2020-07-20T17:59:26Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=140799#p140799</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Сочетания Shift и Alt в разных порядках]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=140798#p140798" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>__Михаил__ пишет:</cite><blockquote><p>+По стандарту в винде можно назначить кнопки если что.</p></blockquote></div><p>Не с таким сложным поведением.</p>]]></content>
			<author>
				<name><![CDATA[mkone112]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40951</uri>
			</author>
			<updated>2020-07-20T17:48:36Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=140798#p140798</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Сочетания Shift и Alt в разных порядках]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=140797#p140797" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>И что, и порядок отжатия тоже важен?</p></blockquote></div><p>Да, важен - в этом вся суть.<br /></p><div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p> А если {LAlt Down}{LShift Down}{LShift Up}{LAlt Up} — тогда что должно произойти?</p></blockquote></div><p>Это 5й пункт.</p>]]></content>
			<author>
				<name><![CDATA[mkone112]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40951</uri>
			</author>
			<updated>2020-07-20T17:46:34Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=140797#p140797</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Сочетания Shift и Alt в разных порядках]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=140796#p140796" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>__Михаил__ пишет:</cite><blockquote><p>Зачем нажимать 4 и более клавиши ради такого бестолкового действия?</p></blockquote></div><p>Не 4, а 2.</p>]]></content>
			<author>
				<name><![CDATA[mkone112]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40951</uri>
			</author>
			<updated>2020-07-20T17:44:07Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=140796#p140796</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Сочетания Shift и Alt в разных порядках]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=140794#p140794" />
			<content type="html"><![CDATA[<p>Такие сложности, не легче ли будет установить одну клавишу для переключения языка, от двойного - второе действие, а если её удерживаешь третье? Так же можно сделать проверку тех же Shift, Alt, Win, Ctrl.<br />Зачем нажимать 4 и более клавиши ради такого бестолкового действия?<br />+По стандарту в винде можно назначить кнопки если что.</p>]]></content>
			<author>
				<name><![CDATA[__Михаил__]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40928</uri>
			</author>
			<updated>2020-07-20T17:15:02Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=140794#p140794</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Сочетания Shift и Alt в разных порядках]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=140793#p140793" />
			<content type="html"><![CDATA[<p>И что, и порядок отжатия тоже важен? А если {LAlt Down}{LShift Down}{LShift Up}{LAlt Up} — тогда что должно произойти?</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2020-07-20T15:42:58Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=140793#p140793</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Сочетания Shift и Alt в разных порядках]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=140792#p140792" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong><br />Нет, одно действие должно выбирать одну раскладку, sh + alt -&gt; точно русский, alt + sh -&gt; точно английский.<br />К тому-же RShift уже занят.</p>]]></content>
			<author>
				<name><![CDATA[mkone112]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40951</uri>
			</author>
			<updated>2020-07-20T15:26:59Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=140792#p140792</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Сочетания Shift и Alt в разных порядках]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=140791#p140791" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>mkone112 пишет:</cite><blockquote><p>Подскажите, как реализовать следующее поведение:<br /></p><ul><li><p>{LAlt Down}{LShift Down}{LAlt Up}{LShift Up} без нажатий других клавиш:<br /></p><ul><li><p>Выбрать русскую раскладку</p></li></ul></li><li><p>{LShift Down}{LAlt Down}{LShift Up}{LAlt Up} без нажатий других клавиш:<br /></p><ul><li><p>Выбрать английскую раскладку</p></li></ul></li></ul></blockquote></div><p>А зачем такие сложности? Не проще переключать раскладку по одной и той же клавише, например RShift?</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2020-07-20T07:51:05Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=140791#p140791</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Сочетания Shift и Alt в разных порядках]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=140788#p140788" />
			<content type="html"><![CDATA[<p>Подскажите, как реализовать следующее поведение:<br /></p><ul><li><p>{LAlt Down}{LShift Down}{LAlt Up}{LShift Up} без нажатий других клавиш:<br /></p><ul><li><p>Выбрать русскую раскладку</p></li></ul></li><li><p>{LShift Down}{LAlt Down}{LShift Up}{LAlt Up} без нажатий других клавиш:<br /></p><ul><li><p>Выбрать английскую раскладку</p></li></ul></li><li><p>Одиночное нажатие LAlt:<br /></p><ul><li><p>Послать !{/}</p></li></ul></li><li><p>Одиночное нажатие LShift:<br /></p><ul><li><p>Послать {Esc}</p></li></ul></li><li><p>Одиночное нажатие LShift при нажатом Alt:<br /></p><ul><li><p>Послать +!{/}</p></li></ul></li><li><p>Одиночное нажатие LAlt при нажатом LShift:<br /></p><ul><li><p>Послать {F13}</p></li></ul></li><li><p>Остальные сочетания с LAlt, LShift работают как обычно</p></li></ul><p>Бьюсь уже часов 20, все что смог написать либо работает не так, либо адово глючит ,либо не работает вовсе.<br />Последний нерабочий концепт:<br /></p><div class="codebox"><pre><code>/*
Запуск всегда с максимальными правами
*/
if not A_IsAdmin
{
   Run *RunAs &quot;%A_ScriptFullPath%&quot;  ; Requires v1.0.92.01+
   ExitApp
}


#SingleInstance, force
#NoEnv
SetWorkingDir %A_ScriptDir%

/*
  Чтобы клавиши не залипали
*/
Process, Priority, , H
SetBatchLines, -1
SetKeyDelay, 50
SendMode Input
/*
  Чтобы работало со всеми окнами
*/
DetectHiddenWindows, On



/*
~ посылает клавиши в окно
*/
~LAlt &amp; ~LShift::
    except_lalt_lsh := false
    /*
      Пока LAlt не отпущен - перебираем клавиши в поисках нажатой
    */
    while ( GetKeyState(&quot;LAlt&quot;, &quot;P&quot;) )
    {
        Loop, 256
        {
            key_with_lalt_lsh := Format(&quot;vk{:x}&quot;, A_Index-1)

            /*
              VK12=Alt    VKA4=LAlt    VK10=Shift    VKA0=LShift
            */
            if ( GetKeyState(key_with_lalt_lsh, &quot;P&quot;)
                 &amp;&amp; key_with_lalt_lsh != &quot;vk12&quot; &amp;&amp; key_with_lalt_lsh != &quot;vka4&quot;
                 &amp;&amp;  key_with_lalt_lsh != &quot;vk10&quot; &amp;&amp; key_with_lalt_lsh != &quot;vka0&quot; )
            {
                /*
                  Нажата клавиша кроме LAlt или LShift
                */
                except_lalt_lsh := true
                break 2
            }
        }
    }

    /*
      Если не нажимались клавиши кроме LShift или LAlt, и LShift еще нажат
    */
    if ( !except_lalt_lsh &amp;&amp; GetKeyState(&quot;LShift&quot;, &quot;P&quot;) )
    {
        /*
          Ждем отпускания LShift и переключаем раскладку на Английскую
        */
        KeyWait, LShift
        ControlGetFocus, control, A
        PostMessage 0x50, 0, -255851511, %control%, A
    }
return




/*
~ посылает клавиши в окно
LAlt не посылается - иначе, отрываеся меню программ
*/
~LShift &amp; LAlt::
    except_lsh_lalt := false
    /*
      Пока LShift не отпущен - перебираем клавиши в поисках нажатой
    */
    while ( GetKeyState(&quot;LShift&quot;, &quot;P&quot;) )
    {
        Loop, 256
        {
            key_with_lsh_lalt := Format(&quot;vk{:x}&quot;, A_Index-1)

            /*
              VK10=Shift    VKA0=LShift    VK12=Alt    VKA4=LAlt
            */
            if ( GetKeyState(key_with_lsh_lalt, &quot;P&quot;)
                 &amp;&amp; key_with_lsh_lalt != &quot;vk10&quot; &amp;&amp; key_with_lsh_lalt != &quot;vka0&quot;
                 &amp;&amp; key_with_lsh_lalt != &quot;vk12&quot; &amp;&amp; key_with_lsh_lalt != &quot;vka4&quot; )
            {
                /*
                  Нажата клавиша кроме LShift или LAlt
                */
                except_lsh_lalt := true
                break 2
            }
        }
        lsh_single := false
    }

    /*
      Если LShift &amp; LAlt
      не были задействованы ни в каких других сочетаниях
      клавиш(в это время ни одна другая клавиша 
      не была нажата), - переключаем раскладку на Русскую
    */
    if (!except_lsh_lalt)
    {
        ControlGetFocus, control, A
        PostMessage 0x50, 0, -255785959, %control%, A
    }
return




~$LShift::
    lsh_single := true
    /*
      Пока LShift не отпущен - перебираем клавиши в поисках нажатой
    */
    while ( GetKeyState(&quot;LShift&quot;, &quot;P&quot;) )
    {
        Loop, 256
        {
            key_with_lshift := Format(&quot;vk{:x}&quot;, A_Index-1)

            /*
              VK10=Shift    VKA0=LShift
            */
            if ( GetKeyState(key_with_lshift, &quot;P&quot;)
                 &amp;&amp; key_with_lshift != &quot;vk10&quot; &amp;&amp; key_with_lshift != &quot;vka0&quot; )
            {
                lsh_single := false
                break 2
            }
        }
        /*
          Если одиночный LShift удерживается дольше 300мс - Esc не будет послан
        */
        if (A_TimeSinceThisHotkey &gt; 300)
        {
            lsh_single := false
            break
        }
    }
    /*
      Ждем отпускания LShift
    */
    KeyWait, LShift
    /*
      Если LShift был зажат менее 300мс и
      не был задействован в сочетании
      клавиш(в это время ни одна другая клавиша не была нажата),
      посылаем Esc
    */
    if (lsh_single)
    {
        Send {Esc}
    }
return


~$LAlt::
    lalt_single := true

    while ( GetKeyState(&quot;LAlt&quot;, &quot;P&quot;) )
    {
        Loop, 256
        {
            key_with_lalt := Format(&quot;vk{:x}&quot;, A_Index-1)

            /*
              VK12=Alt    VKA4=LAlt
            */
            if ( GetKeyState(key_with_lalt, &quot;P&quot;)
                 &amp;&amp; key_with_lalt != &quot;vk12&quot; &amp;&amp; key_with_lalt != &quot;vka4&quot; )
            {
                lalt_single := false
                break 2
            }
        }

        if (A_TimeSinceThisHotkey &gt; 300)
        {
            lalt_single := false
            break
        }
    }
    /*
      Ждем отпускания LAlt
    */
    KeyWait, LAlt
    /*
      Если LAlt был зажат менее 300мс и
      не был задействован в сочетании
      клавиш(в это время ни одна другая клавиша не была нажата),
      посылаем {Alt Down}{/ Down}{/ Up}{Alt Up}
    */
    if (lalt_single)
    {
        Send !{/}
    }
return</code></pre></div>]]></content>
			<author>
				<name><![CDATA[mkone112]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40951</uri>
			</author>
			<updated>2020-07-19T21:16:51Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=140788#p140788</id>
		</entry>
</feed>
