<?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=12876&amp;type=atom" />
	<updated>2017-08-05T10:47:26Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=12876</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: При переключении раскладки клавиатуры пропустить ненужную]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=117848#p117848" />
			<content type="html"><![CDATA[<p>Согласен с постом выше <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" />.</p>]]></content>
			<author>
				<name><![CDATA[belyankin12]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34408</uri>
			</author>
			<updated>2017-08-05T10:47:26Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=117848#p117848</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: При переключении раскладки клавиатуры пропустить ненужную]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=117846#p117846" />
			<content type="html"><![CDATA[<p>Кстати, за последнее десятилетие помимо нового ahk много хороших браузеров появилось, рекомендую.</p>]]></content>
			<author>
				<name><![CDATA[stealzy]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=31937</uri>
			</author>
			<updated>2017-08-05T10:10:33Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=117846#p117846</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: При переключении раскладки клавиатуры пропустить ненужную]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=117844#p117844" />
			<content type="html"><![CDATA[<p>У меня везде работает. Учитывайте, что в вашем варианте горячей клавиши нужно сначала нажимать Shift, а потом LCtrl.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2017-08-05T09:21:31Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=117844#p117844</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: При переключении раскладки клавиатуры пропустить ненужную]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=117842#p117842" />
			<content type="html"><![CDATA[<p>Спасибо, работает, но почему-то не во всех приложениях. Например, не работает в Word&#039;e и Internet Explorer. <br />Мой вариант работает в Word&#039;e, но не работает в Internet Explorer.</p>]]></content>
			<author>
				<name><![CDATA[Vadus]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=25975</uri>
			</author>
			<updated>2017-08-05T09:12:20Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=117842#p117842</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: При переключении раскладки клавиатуры пропустить ненужную]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=117839#p117839" />
			<content type="html"><![CDATA[<p>Вот так на старом AHK должно сработать (с вашей горячей клавишей):<br /></p><div class="codebox"><pre><code>+LCtrl::
   ControlGetFocus, CtrlFocus, A
   PostMessage, WM_INPUTLANGCHANGEREQUEST := 0x50,, GetInputLangID(&quot;A&quot;) != 0x409 ? 0x409 : 0x419, %CtrlFocus%, A
   return


GetInputLangID(window)  {
   If !(hWnd := WinExist(window))
      return

   WinGetClass, winClass

   if (winClass != &quot;ConsoleWindowClass&quot;)  {
      threadId := DllCall(&quot;GetWindowThreadProcessId&quot;, UInt, hWnd, UInt, 0, UInt)
      lyt := DllCall(&quot;GetKeyboardLayout&quot;, UInt, threadId, UInt)
      langID := lyt &amp; 0x3FFF
   }
   else  {
      WinGet, consolePID, PID
      DllCall(&quot;AttachConsole&quot;, UInt, consolePID)
      VarSetCapacity(lyt, 16)
      DllCall(&quot;GetConsoleKeyboardLayoutName&quot;, Str, lyt)
      DllCall(&quot;FreeConsole&quot;)
      langID := &quot;0x&quot; . SubStr(lyt, -4)
   }
   return langID
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2017-08-05T08:52:11Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=117839#p117839</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: При переключении раскладки клавиатуры пропустить ненужную]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=117838#p117838" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong><br />Грешен <img src="//forum.script-coding.com/img/smilies/sad.png" width="15" height="15" /><br />Слишком много понаписал в свое время, никак не перейти в новую жизнь...</p>]]></content>
			<author>
				<name><![CDATA[Vadus]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=25975</uri>
			</author>
			<updated>2017-08-05T08:43:03Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=117838#p117838</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: При переключении раскладки клавиатуры пропустить ненужную]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=117837#p117837" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Vadus пишет:</cite><blockquote><p>Возможно потому, что у меня старый AHK 1.0.48</p></blockquote></div><p>И Windows 3, надо полагать? <img src="//forum.script-coding.com/img/smilies/wink.png" width="15" height="15" /> Код на форуме рассчитан на последнюю версию AHK.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2017-08-05T08:34:46Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=117837#p117837</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: При переключении раскладки клавиатуры пропустить ненужную]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=117836#p117836" />
			<content type="html"><![CDATA[<p>Вот сделал вариант, не глючит в Punto и по Ctrl+Shift+Right выделяет слово. Тестирую дальше, спасибо за подсказки!</p><div class="codebox"><pre><code>+LCtrl::

Lang := Lang_In_Window() ;вызываем функцию определения языка раскладки активного окна — см. ниже
; 0x4190419 — русская раскладка, 0x4090409 —  английская раскладка, 0x4100410 — итальянская раскладка
If (Lang= &quot;0x4090409&quot;) ; если была английская раскладка, то следующая итальянская раскладка, ее нужно пропустить, и сразу переключиться на русскую
{
	 SendMessage, 0x50,, 0x4190419,, A ; русский
	
}
else If (Lang= &quot;0x4190419&quot;) ; если была русская раскладка, то переключиться на английскую
{
	SendMessage, 0x50,, 0x4090409,, A ; английский
}
Return

Lang_In_Window()
{  
;27.11.10 Выясняем язык раскладки активного окна
;http://www.script-coding.com/AutoHotkey/AhkRussian.html
;Вызвать функцию можно так: Lang := Lang_In_Window()
; 0x4190419 — русская раскладка, 0x4090409 —  английская раскладка, 0x4100410 — итальянская раскладка
	; запоминаем текущий режим определения/нет скрытых окон
    DetectHiddenWindows_Before := A_DetectHiddenWindows
    DetectHiddenWindows, On ; переключаемся на работу со скрытыми окнами
    ; запоминаем текущий режим поиска окон по заголовкам
    TitleMatchMode_Before := A_TitleMatchMode
    ; переключаемся на режим &quot;искать в любой части заголовка окна&quot;
    SetTitleMatchMode, 2
    FormatInteger_Before := A_FormatInteger ; запоминаем текущий числовой формат
    SetFormat, integer, H ; переключаемся на шестнадцатеричный формат
    WinGet, Active_Window_ID, ID, A ; получаем ID активного окна
    Active_Window_Thread := DllCall(&quot;GetWindowThreadProcessId&quot;
        , &quot;UInt&quot;, Active_Window_ID, &quot;UInt&quot;, 0)
    ; получаем для активного окна ID его потока через Win API
    Lang := DllCall(&quot;GetKeyboardLayout&quot;, &quot;UInt&quot;, Active_Window_Thread) ; получаем текущую раскладку для найденного потока активного окна через Win API
 	;MsgBox Lang: %Lang% 
	; 0x4190419 — русская раскладка, 0x4090409 —  английская раскладка, 0x4100410 — итальянская раскладка
    ; возвращаем режим определения/нет скрытых окон
    DetectHiddenWindows, %DetectHiddenWindows_Before%
    ; возвращаем режим поиска окон по заголовкам
    SetTitleMatchMode, %TitleMatchMode_Before%
    ; возвращаем числовой формат
    SetFormat, integer, %FormatInteger_Before%
	
	return Lang ;задаем значение функции
	
} ; конец функции</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Vadus]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=25975</uri>
			</author>
			<updated>2017-08-05T08:34:15Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=117836#p117836</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: При переключении раскладки клавиатуры пропустить ненужную]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=117835#p117835" />
			<content type="html"><![CDATA[<p>Спасибо, teadrinker. К сожалению, вылетает даже без объявления причин. Возможно потому, что у меня старый AHK 1.0.48</p>]]></content>
			<author>
				<name><![CDATA[Vadus]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=25975</uri>
			</author>
			<updated>2017-08-05T08:30:45Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=117835#p117835</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: При переключении раскладки клавиатуры пропустить ненужную]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=117834#p117834" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>&lt;^LShift::
   ControlGetFocus, CtrlFocus, A
   PostMessage, WM_INPUTLANGCHANGEREQUEST := 0x50,, GetInputLangID(&quot;A&quot;) != 0x409 ? 0x409 : 0x419, %CtrlFocus%, A
   return


GetInputLangID(window)  {
   If !(hWnd := WinExist(window))
      return

   WinGetClass, winClass

   if (winClass != &quot;ConsoleWindowClass&quot;)  {
      threadId := DllCall(&quot;GetWindowThreadProcessId&quot;, Ptr, hWnd, UInt, 0, Ptr)
      lyt := DllCall(&quot;GetKeyboardLayout&quot;, Ptr, threadId, UInt)
      langID := lyt &amp; 0x3FFF
   }
   else  {
      WinGet, consolePID, PID
      DllCall(&quot;AttachConsole&quot;, Ptr, consolePID)
      VarSetCapacity(lyt, 16)
      DllCall(&quot;GetConsoleKeyboardLayoutName&quot;, Str, lyt)
      DllCall(&quot;FreeConsole&quot;)
      langID := &quot;0x&quot; . SubStr(lyt, -4)
   }
   return langID
}</code></pre></div><div class="quotebox"><cite>Vadus пишет:</cite><blockquote><p>И еще заметил: Ctrl+Shift+Right - не выделяет слово в текстовых редакторах</p></blockquote></div><p>Лучше всего заменить &lt;^LShift (LControl + LShift) на !Shift (Alt + Shift).</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2017-08-05T08:19:06Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=117834#p117834</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: При переключении раскладки клавиатуры пропустить ненужную]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=117831#p117831" />
			<content type="html"><![CDATA[<p>Спасибо.<br />Работает, только к сожалению Punto Switcher сходит с ума — автокорректировка с русского на английский туда-сюда переключает при вводе каждой буквы. <br />И еще заметил: Ctrl+Shift+Right - не выделяет слово в текстовых редакторах<br />Можно что-нибудь предпринять?</p>]]></content>
			<author>
				<name><![CDATA[Vadus]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=25975</uri>
			</author>
			<updated>2017-08-05T07:20:49Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=117831#p117831</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: При переключении раскладки клавиатуры пропустить ненужную]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=117830#p117830" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>#MaxThreadsPerHotkey 2 
 
~LCtrl &amp; LShift::
 T := !T
 While T {
SendMessage, 0x50,, 0x4090409,, A ; английский
 sleep 10
 }
 SendMessage, 0x50,, 0x4190419,, A ; русский
 return</code></pre></div>]]></content>
			<author>
				<name><![CDATA[svoboden]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34280</uri>
			</author>
			<updated>2017-08-05T06:47:29Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=117830#p117830</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: При переключении раскладки клавиатуры пропустить ненужную]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=117828#p117828" />
			<content type="html"><![CDATA[<p>Доброго времени суток.<br />Возникла такая задача. В Windows 10 добавил язык Italiano к имеющимся Русский и English. Теперь имею 3 раскладки клавиатуры, в том числе итальянскую. А она мне не нужна, нужен только языковой пакет для синтеза итальянской речи. Убрать третью раскладу без удаления всего языкового пакета не удалость (в MS подтвердили, что это невозможно). </p><p>Решил попытаться сделать с помощью AHK так, чтобы при переключении РУС-ENG-ITA-РУС... раскладка перескакивала&nbsp; с ENG на РУС, минуя ITA. Получилась программка (см. ниже), но она работает нестабильно. Эксперты, что посоветуете?</p><div class="codebox"><pre><code>;---пытаюсь пропустить итальянскую раскладку клавиатуры
~LCtrl &amp; LShift:: ;Ctrl+Shift - так у меня переключаются раскладки клавиатуры
Lang := Lang_In_Window() ;вызываем функцию определения языка раскладки активного окна — см. ниже
; 0x4190419 — русская раскладка, 0x4090409 —  английская раскладка, 0x4100410 — итальянская раскладка
If (Lang= &quot;0x4090409&quot;) ; если была английская раскладка, то следующая итальянская раскладка, ее нужно пропустить, и сразу переключиться на русскую
{
	Send, !+1 ; Alt+Shift + 1 - Переключение раскладки клавиатуры на русский язык (у меня назначено такое сочетание)
}

Return

Lang_In_Window()
{  
;27.11.10 Выясняем язык раскладки активного окна
;http://www.script-coding.com/AutoHotkey/AhkRussian.html
;Вызвать функцию можно так: Lang := Lang_In_Window()
; 0x4190419 — русская раскладка, 0x4090409 —  английская раскладка, 0x4100410 — итальянская раскладка
	; запоминаем текущий режим определения/нет скрытых окон
    DetectHiddenWindows_Before := A_DetectHiddenWindows
    DetectHiddenWindows, On ; переключаемся на работу со скрытыми окнами
    ; запоминаем текущий режим поиска окон по заголовкам
    TitleMatchMode_Before := A_TitleMatchMode
    ; переключаемся на режим &quot;искать в любой части заголовка окна&quot;
    SetTitleMatchMode, 2
    FormatInteger_Before := A_FormatInteger ; запоминаем текущий числовой формат
    SetFormat, integer, H ; переключаемся на шестнадцатеричный формат
    WinGet, Active_Window_ID, ID, A ; получаем ID активного окна
    Active_Window_Thread := DllCall(&quot;GetWindowThreadProcessId&quot;
        , &quot;UInt&quot;, Active_Window_ID, &quot;UInt&quot;, 0)
    ; получаем для активного окна ID его потока через Win API
    Lang := DllCall(&quot;GetKeyboardLayout&quot;, &quot;UInt&quot;, Active_Window_Thread) ; получаем текущую раскладку для найденного потока активного окна через Win API
 	;MsgBox Lang: %Lang% 
	; 0x4190419 — русская раскладка, 0x4090409 —  английская раскладка, 0x4100410 — итальянская раскладка
    ; возвращаем режим определения/нет скрытых окон
    DetectHiddenWindows, %DetectHiddenWindows_Before%
    ; возвращаем режим поиска окон по заголовкам
    SetTitleMatchMode, %TitleMatchMode_Before%
    ; возвращаем числовой формат
    SetFormat, integer, %FormatInteger_Before%
	
	return Lang ;задаем значение функции
	
} ; конец функции</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Vadus]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=25975</uri>
			</author>
			<updated>2017-08-05T06:18:45Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=117828#p117828</id>
		</entry>
</feed>
