<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK: Разное поведение LControl на разных машинах]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=13698</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=13698&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: Разное поведение LControl на разных машинах».]]></description>
		<lastBuildDate>Thu, 10 May 2018 20:31:46 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: Разное поведение LControl на разных машинах]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=125294#p125294</link>
			<description><![CDATA[<div class="codebox"><pre><code>#MaxHotkeysPerInterval 1000 ; avoid reaction on ~LControl system autorepeat
#If Not (GetKeyState(&quot;LButton&quot;) || GetKeyState(&quot;RButton&quot;) || GetKeyState(&quot;MButton&quot;))
~LControl:: keyPressed ? : (downTime := A_TickCount, keyPressed := true)
#If keyPressed And Not (GetKeyState(&quot;LButton&quot;) || GetKeyState(&quot;RButton&quot;) || GetKeyState(&quot;MButton&quot;))
~LControl Up:: !(keyPressed := false) &amp;&amp; A_PriorHotKey = &quot;~LControl&quot; &amp;&amp; A_TickCount-downTime &lt; 1000 &amp;&amp; SwitchLocale()
#If
*~LButton::
*~RButton::
*~MButton::
Return

SwitchLocale()  {
	PostMessage 0x50, 0x2,,, % &quot;ahk_id&quot; ((hWndOwn:=DllCall(&quot;GetWindow&quot;, Ptr, hWnd:=WinExist(&quot;A&quot;), UInt, 4, Ptr)) ? hWndOwn : hWnd)
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (stealzy)]]></author>
			<pubDate>Thu, 10 May 2018 20:31:46 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=125294#p125294</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Разное поведение LControl на разных машинах]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=125292#p125292</link>
			<description><![CDATA[<p>Спасибо.</p><p>Похоже, что оба этих варианта не учитывают, что:<br />а) системный повтор Ctrl прерывается при нажатии любой клавиши, но не прерывается при нажатии кнопки мышки;<br />б) при нажатии любой клавиши одновременно с Ctrl (в т.ч. и кнопок мышки), переключение языка не должно происходить.</p><p>Вот мой вариант. Он безусловно более примитивный, но учитывает эти 2 момента:</p><div class="codebox"><pre><code>
~LControl::
if (!PriorKey)
    PriorKey := &quot;LControl&quot;
else if (A_PriorKey &lt;&gt; &quot;LControl&quot;)
    PriorKey := A_PriorKey
return
~LControl Up::
if (A_PriorKey = &quot;LControl&quot; and PriorKey = &quot;LControl&quot;)
{
    Send {Control Down}{Shift}{Control Up}
	SoundBeep, 5000, 100
}
PriorKey =
return
</code></pre></div><p>Родился в результате ~3ч чтения мануала по AHK. Буду благодарен за критику.</p>]]></description>
			<author><![CDATA[null@example.com (zmey78)]]></author>
			<pubDate>Thu, 10 May 2018 19:30:38 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=125292#p125292</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Разное поведение LControl на разных машинах]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=125289#p125289</link>
			<description><![CDATA[<p>TimeSincePriorHotkey != TimeSincePriorKey, встроенной переменной для TimeSincePriorKey не предусмотрено. Выконечно можете создать пустой хоткей на нажатие и тогда использовать A_TimeSincePriorHotkey , но системный автоповтор нажатия убъет эту затею.<br /></p><div class="codebox"><pre><code>#MaxHotkeysPerInterval 1000 ; avoid reaction on ~LControl system autorepeat
~LControl:: keyPressed ? : (downTime := A_TickCount, keyPressed := true)
~LControl Up:: !(keyPressed := false) &amp;&amp; A_PriorKey = &quot;LControl&quot; &amp;&amp; (A_TickCount - downTime &lt; 500) &amp;&amp; SwitchLocale()

SwitchLocale()  {
	; ControlGetFocus CtrlFocus, A
	; PostMessage WM_INPUTLANGCHANGEREQUEST := 0x50, INPUTLANGCHANGE_FORWARD := 0x2,, % CtrlFocus, A
	PostMessage WM_INPUTLANGCHANGEREQUEST:=0x50, INPUTLANGCHANGE_FORWARD:=0x2,,, % &quot;ahk_id&quot; ((hWndOwn:=DllCall(&quot;GetWindow&quot;, Ptr, hWnd:=WinExist(&quot;A&quot;), UInt, GW_OWNER:=4, Ptr)) ? hWndOwn : hWnd)
}</code></pre></div><p>Если нужно чтобы работало на панели задач или конкретные языки, загляните сюды:<br /><a href="http://forum.script-coding.com/viewtopic.php?id=12452">http://forum.script-coding.com/viewtopic.php?id=12452</a></p>]]></description>
			<author><![CDATA[null@example.com (stealzy)]]></author>
			<pubDate>Thu, 10 May 2018 18:52:27 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=125289#p125289</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Разное поведение LControl на разных машинах]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=125283#p125283</link>
			<description><![CDATA[<p>Попробуйте так:<br /></p><div class="codebox"><pre><code>~LControl Up:: ( A_PriorKey = &quot;LControl&quot; &amp;&amp; ChangeLocale() )

ChangeLocale()  {
   ControlGetFocus, CtrlFocus, A
   PostMessage, WM_INPUTLANGCHANGEREQUEST := 0x50, INPUTLANGCHANGE_FORWARD := 0x2,, %CtrlFocus%, A
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Thu, 10 May 2018 16:00:58 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=125283#p125283</guid>
		</item>
		<item>
			<title><![CDATA[AHK: Разное поведение LControl на разных машинах]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=125272#p125272</link>
			<description><![CDATA[<p>У меня прекрасно работает этот скрипт на ноутбуке:<br /></p><div class="codebox"><pre><code>
~LControl Up::
if (A_PriorKey = &quot;LControl&quot; and (A_TimeSincePriorHotkey &gt; 400 or A_PriorHotkey &lt;&gt; A_ThisHotkey))
{
    Send {Control Down}{Shift}{Control Up}
	SoundBeep, 5000, 100
}
return
</code></pre></div><p>Смысл такой, что переключаем язык по Ctrl (как было в DOS), но только если не была нажата еще какая то клавиша, т.е. фильтруем обычные хоткеи.</p><p>Попробовал на стационарном компе, нажатие и удержание Ctrl превращается в бесконечный повтор Ctrl Down:<br /></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>A2&nbsp; 01D	 	d	2.48	LControl&nbsp; &nbsp; &nbsp; &nbsp;	<br />01&nbsp; 000	 	d	0.06	LButton&nbsp; &nbsp; &nbsp; &nbsp; 	<br />A2&nbsp; 01D	 	d	0.19	LControl&nbsp; &nbsp; &nbsp; &nbsp;	*new 1 - Notepad++<br />A2&nbsp; 01D	 	d	0.03	LControl&nbsp; &nbsp; &nbsp; &nbsp;	<br />A2&nbsp; 01D	 	d	0.03	LControl&nbsp; &nbsp; &nbsp; &nbsp;	<br />A2&nbsp; 01D	 	d	0.03	LControl&nbsp; &nbsp; &nbsp; &nbsp;	<br />A2&nbsp; 01D	 	d	0.03	LControl&nbsp; &nbsp; &nbsp; &nbsp;	<br />A2&nbsp; 01D	 	d	0.03	LControl&nbsp; &nbsp; &nbsp; &nbsp;	<br />A2&nbsp; 01D	 	d	0.03	LControl&nbsp; &nbsp; &nbsp; &nbsp;	<br />A2&nbsp; 01D	 	d	0.05	LControl&nbsp; &nbsp; &nbsp; &nbsp;	<br />A2&nbsp; 01D	 	d	0.03	LControl&nbsp; &nbsp; &nbsp; &nbsp;	<br />A2&nbsp; 01D	 	d	0.03	LControl&nbsp; &nbsp; &nbsp; &nbsp;	<br />A2&nbsp; 01D	 	d	0.03	LControl&nbsp; &nbsp; &nbsp; &nbsp;	<br />A2&nbsp; 01D	 	d	0.03	LControl&nbsp; &nbsp; &nbsp; &nbsp;	<br />A2&nbsp; 01D	 	d	0.03	LControl&nbsp; &nbsp; &nbsp; &nbsp;	<br />A2&nbsp; 01D	 	d	0.03	LControl&nbsp; &nbsp; &nbsp; &nbsp;	<br />A2&nbsp; 01D	 	d	0.03	LControl&nbsp; &nbsp; &nbsp; &nbsp;	<br />A2&nbsp; 01D	 	d	0.03	LControl&nbsp; &nbsp; &nbsp; &nbsp;	<br />01&nbsp; 000	 	u	0.02	LButton&nbsp; &nbsp; &nbsp; &nbsp; 	<br />A2&nbsp; 01D	 	d	0.02	LControl&nbsp; &nbsp; &nbsp; &nbsp;	<br />A2&nbsp; 01D	 	d	0.03	LControl&nbsp; &nbsp; &nbsp; &nbsp;	<br />A2&nbsp; 01D	 	d	0.05	LControl&nbsp; &nbsp; &nbsp; &nbsp;	<br />A2&nbsp; 01D	 	d	0.03	LControl&nbsp; &nbsp; &nbsp; &nbsp;	<br />A2&nbsp; 01D	 	d	0.03	LControl&nbsp; &nbsp; &nbsp; &nbsp;	<br />A2&nbsp; 01D	 	d	0.03	LControl&nbsp; &nbsp; &nbsp; &nbsp;	<br />A2&nbsp; 01D	 	d	0.03	LControl&nbsp; &nbsp; &nbsp; &nbsp;	<br />A2&nbsp; 01D	 	d	0.03	LControl&nbsp; &nbsp; &nbsp; &nbsp;	<br />A2&nbsp; 01D	h	u	0.01	LControl&nbsp; &nbsp; &nbsp; &nbsp;	<br />11&nbsp; 01D	i	d	0.00	Control&nbsp; &nbsp; &nbsp; &nbsp; 	<br />10&nbsp; 02A	i	d	0.00	Shift&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 	<br />10&nbsp; 02A	i	u	0.00	Shift&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 	<br />11&nbsp; 01D	i	u	0.00	Control</p></div></div><p>Плохо тем, что мой скрипт не видит, например, что я между нажатием и отжатием Ctrl нажимаю кнопку мыши для перетаскивания текста. Соответственно, язык переключается когда не нужно.</p><p>Пока придумал вариант, но еще не написал код для него, возможно не будет работать. Хочу послушать советы, как лучше и правильно сделать. А потом приведу свой вариант, чтобы сравнить. Подскажите, пожалуйста!!!</p>]]></description>
			<author><![CDATA[null@example.com (zmey78)]]></author>
			<pubDate>Thu, 10 May 2018 09:52:08 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=125272#p125272</guid>
		</item>
	</channel>
</rss>
