<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Переменные гор. клавиши на Win 8]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=10652&amp;type=atom" />
	<updated>2015-05-21T21:22:33Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=10652</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Переменные гор. клавиши на Win 8]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=94126#p94126" />
			<content type="html"><![CDATA[<p>Спасиб )</p>]]></content>
			<author>
				<name><![CDATA[Hydrogenium]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=30160</uri>
			</author>
			<updated>2015-05-21T21:22:33Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=94126#p94126</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Переменные гор. клавиши на Win 8]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=94125#p94125" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>#If CheckWin(WinExist(&quot;A&quot;))   ; здесь нужная функция
SetHotkey(&quot;$q&quot;, &quot;ProcFunc1&quot;)
SetHotkey(&quot;$ц&quot;, &quot;ProcFunc2&quot;)
SetHotkey(&quot;$e&quot;, &quot;ProcFunc3&quot;)
Return

ProcFunc1:
   MsgBox, TEST1
   Return

ProcFunc2:
   MsgBox, TEST2 
   Return

ProcFunc3:
   MsgBox, TEST3
   Return
   
CheckWin(hwnd)  {
   WinGetClass, WindowClass, ahk_id %hwnd%   ; здесь вместо этого любая проверка
   if (WindowClass = &quot;Notepad&quot;)
      Return true
}
   
SetHotkey(hotkey, label)  {
   ChangeLayout(hotkey)
   Hotkey, % hotkey, % label
}

ChangeLayout(hotkey)  {
   static WM_INPUTLANGCHANGEREQUEST := 0x50, INPUTLANGCHANGE_SYSCHARSET := 1

   layout := RegExMatch(hotkey, &quot;i)[а-я]&quot;) ? 0x4190419 : 0x4090409
   DllCall(&quot;SendMessage&quot;, Ptr, A_ScriptHwnd, UInt, WM_INPUTLANGCHANGEREQUEST, Ptr, INPUTLANGCHANGE_SYSCHARSET, Ptr, layout, Ptr)
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2015-05-21T20:53:37Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=94125#p94125</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Переменные гор. клавиши на Win 8]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=94124#p94124" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong>, Спасиб, но <span class="bbu">ahk_class Notepad</span> это условность. В реальности там функция с кучей условий и жёсткая привязка к <span class="bbu">Notepad </span> не канает.</p><div class="codebox"><pre><code>
MyKey1 = q

ChangeLayout(MyKey1)
Hotkey, % &quot;$&quot; MyKey1, ProcFunc1
return

ProcFunc1:
   WinGet, active_id, ID, A 
   if CheckWin(active_id)
      MsgBox, TEST1
   else
      Send {%MyKey1%}
Return

ChangeLayout(hotkey)  {
   static WM_INPUTLANGCHANGEREQUEST := 0x50, INPUTLANGCHANGE_SYSCHARSET := 1

   layout := RegExMatch(hotkey, &quot;i)[а-я]&quot;) ? 0x4190419 : 0x4090409
   DllCall(&quot;SendMessage&quot;, Ptr, A_ScriptHwnd, UInt, WM_INPUTLANGCHANGEREQUEST, Ptr, INPUTLANGCHANGE_SYSCHARSET, Ptr, layout, Ptr)
}
</code></pre></div><p>Получается, что только при отправке надо определять какая раскладка и посылать нужный символ ?<br />Пожалуйста, подскажи как подправить ))</p>]]></content>
			<author>
				<name><![CDATA[Hydrogenium]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=30160</uri>
			</author>
			<updated>2015-05-21T20:31:55Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=94124#p94124</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Переменные гор. клавиши на Win 8]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=94123#p94123" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>Hotkey, IfWinActive, ahk_class Notepad
SetHotkey(&quot;$q&quot;, &quot;ProcFunc1&quot;)
SetHotkey(&quot;$ц&quot;, &quot;ProcFunc2&quot;)
SetHotkey(&quot;$e&quot;, &quot;ProcFunc3&quot;)
Return

ProcFunc1:
   MsgBox, TEST1
   Return

ProcFunc2:
   MsgBox, TEST2 
   Return

ProcFunc3:
   MsgBox, TEST3
   Return
   
SetHotkey(hotkey, label)  {
   ChangeLayout(hotkey)
   Hotkey, % hotkey, % label
}

ChangeLayout(hotkey)  {
   static WM_INPUTLANGCHANGEREQUEST := 0x50, INPUTLANGCHANGE_SYSCHARSET := 1

   layout := RegExMatch(hotkey, &quot;i)[а-я]&quot;) ? 0x4190419 : 0x4090409
   DllCall(&quot;SendMessage&quot;, Ptr, A_ScriptHwnd, UInt, WM_INPUTLANGCHANGEREQUEST, Ptr, INPUTLANGCHANGE_SYSCHARSET, Ptr, layout, Ptr)
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2015-05-21T19:56:21Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=94123#p94123</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Переменные гор. клавиши на Win 8]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=94111#p94111" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong>, спасиб огромное.</p><p>А как сделать, чтобы отсылалась клавиша текущей раскладки, когда окно не Notepad ?</p><p>MyKey1 = q<br />Send {%MyKey1%} </p><p>Т.е. если <strong>ENG</strong> то в окно посылается &quot;q&quot;, если <strong>РУС</strong>, то &quot;й&quot;</p>]]></content>
			<author>
				<name><![CDATA[Hydrogenium]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=30160</uri>
			</author>
			<updated>2015-05-20T22:31:11Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=94111#p94111</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Переменные гор. клавиши на Win 8]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=94088#p94088" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>MyKey1 = q
MyKey2 = ц
MyKey3 = e

ChangeLayout(MyKey1)
Hotkey, % &quot;$&quot; MyKey1, ProcFunc1

ChangeLayout(MyKey2)
Hotkey, % &quot;$&quot; MyKey2, ProcFunc2

ChangeLayout(MyKey3)
Hotkey, % &quot;$&quot; MyKey3, ProcFunc3
return

ProcFunc1:
   IfWinActive, ahk_class Notepad
      MsgBox, TEST1
   else
      Send {%MyKey1%}
Return

ProcFunc2:
   IfWinActive, ahk_class Notepad
      MsgBox, TEST2
   else
      Send {%MyKey2%}  
Return

ProcFunc3:
   IfWinActive, ahk_class Notepad
      MsgBox, TEST3
   else
      Send {%MyKey3%}  
Return

ChangeLayout(hotkey)  {
   static WM_INPUTLANGCHANGEREQUEST := 0x50, INPUTLANGCHANGE_SYSCHARSET := 1

   layout := RegExMatch(hotkey, &quot;i)[а-я]&quot;) ? 0x4190419 : 0x4090409
   DllCall(&quot;SendMessage&quot;, Ptr, A_ScriptHwnd, UInt, WM_INPUTLANGCHANGEREQUEST, Ptr, INPUTLANGCHANGE_SYSCHARSET, Ptr, layout, Ptr)
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2015-05-20T16:31:17Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=94088#p94088</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Переменные гор. клавиши на Win 8]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=94069#p94069" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong>, подскажи как интегрировать твой код в структуру типа :</p><div class="codebox"><pre><code>
MyKey1 = q
MyKey2 = w
MyKey3 = e

Hotkey, % &quot;$&quot; MyKey1, ProcFunc1
Hotkey, % &quot;$&quot; MyKey2, ProcFunc2
Hotkey, % &quot;$&quot; MyKey3, ProcFunc3
return

ProcFunc1:
   IfWinActive, ahk_class Notepad
      MsgBox, TEST1
   else
      Send {%MyKey1%}  
Return

ProcFunc2:
   IfWinActive, ahk_class Notepad
      MsgBox, TEST2
   else
      Send {%MyKey2%}  
Return

ProcFunc3:
   IfWinActive, ahk_class Notepad
      MsgBox, TEST3
   else
      Send {%MyKey3%}  
Return
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Hydrogenium]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=30160</uri>
			</author>
			<updated>2015-05-20T09:31:11Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=94069#p94069</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Переменные гор. клавиши на Win 8]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=94047#p94047" />
			<content type="html"><![CDATA[<p>Так можно попробовать:<br /></p><div class="codebox"><pre><code>MyHotkey := &quot;z&quot;
layout := RegExMatch(MyHotkey, &quot;i)[а-я]&quot;) ? 0x4190419 : 0x4090409

WM_INPUTLANGCHANGEREQUEST := 0x50, INPUTLANGCHANGE_SYSCHARSET := 1
DllCall(&quot;SendMessage&quot;, Ptr, A_ScriptHwnd, UInt, WM_INPUTLANGCHANGEREQUEST, Ptr, INPUTLANGCHANGE_SYSCHARSET, Ptr, layout, Ptr)

Hotkey, % MyHotkey, label, On
Return

label:
   MsgBox, % A_ThisHotkey
   Return</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2015-05-19T11:46:05Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=94047#p94047</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Переменные гор. клавиши на Win 8]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=94046#p94046" />
			<content type="html"><![CDATA[<p>Такое решение есть — использование кодов виртуальных клавиш или сканкодов.</p><p>Ну или запускайте ваш скрипт из другого, который предварительно переключит &quot;текущую раскладку&quot;.</p>]]></content>
			<author>
				<name><![CDATA[YMP]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=81</uri>
			</author>
			<updated>2015-05-19T11:22:31Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=94046#p94046</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Переменные гор. клавиши на Win 8]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=94045#p94045" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>YMP пишет:</cite><blockquote><p> Проблема в языке самого скрипта, а он соответствует языку ввода по умолчанию, установленному в системных настройках. Хотя в 8, помнится, не всё так однозначно.</p></blockquote></div><p>В WinXP и Win7 - соответствует языку ввода по умолчанию<br />В Win8 - языку текущей раскладки</p><p>Вот и требуется решение задачи для Win8 !!!</p>]]></content>
			<author>
				<name><![CDATA[Hydrogenium]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=30160</uri>
			</author>
			<updated>2015-05-19T10:34:18Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=94045#p94045</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Переменные гор. клавиши на Win 8]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=94044#p94044" />
			<content type="html"><![CDATA[<p>Переключение языка активного окна тут ни при чём. Проблема в языке самого скрипта, а он соответствует языку ввода по умолчанию, установленному в системных настройках. Хотя в 8, помнится, не всё так однозначно.</p><p>Так что лучшее решение всё-таки vk.</p>]]></content>
			<author>
				<name><![CDATA[YMP]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=81</uri>
			</author>
			<updated>2015-05-19T10:05:33Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=94044#p94044</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Переменные гор. клавиши на Win 8]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=94043#p94043" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>
KeyMy =  z

Hotkey, % &quot;$&quot; KeyMy, ProcFunc

return

ProcFunc:
   MsgBox, TEST
Return
</code></pre></div><p>Если стоит русская раскладка, то скрипт выдаёт ошибку.</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"><p><span class="postimg"><img src="http://f5.s.qip.ru/1q1ISRms.png" alt="http://f5.s.qip.ru/1q1ISRms.png" /></span></p></div></div><p>Если ставлю в начале строку кода, чтобы переключал раскладку - всё равно не помогает (как-будто не успевает преключиться):</p><div class="codebox"><pre><code>
PostMessage, 0x50,, 0x4090409,, A   ; На английский

KeyMy =  z

Hotkey, % &quot;$&quot; KeyMy, ProcFunc

return

ProcFunc:
   MsgBox, TEST
Return
</code></pre></div><p>Как быть для Win8?</p><p><strong>p.s.</strong><br />Клавиши &quot;vk&quot; не предлагать )</p>]]></content>
			<author>
				<name><![CDATA[Hydrogenium]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=30160</uri>
			</author>
			<updated>2015-05-19T08:26:04Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=94043#p94043</id>
		</entry>
</feed>
