<?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=14173&amp;type=atom" />
	<updated>2018-09-22T09:48:14Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=14173</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как проверить, нажималась ли другая клавиша между хоткеями?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=128813#p128813" />
			<content type="html"><![CDATA[<p><strong>Malcev</strong>, А, точно, спасбо. Смотрел только описание самой команды KeyHistory, куда ссылка с PriorKey вела.</p>]]></content>
			<author>
				<name><![CDATA[dron008]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39530</uri>
			</author>
			<updated>2018-09-22T09:48:14Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=128813#p128813</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как проверить, нажималась ли другая клавиша между хоткеями?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=128808#p128808" />
			<content type="html"><![CDATA[<p>Всё там есть:<br /><a href="https://autohotkey.com/docs/commands/_KeyHistory.htm">https://autohotkey.com/docs/commands/_KeyHistory.htm</a></p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2018-09-22T02:06:06Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=128808#p128808</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как проверить, нажималась ли другая клавиша между хоткеями?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=128807#p128807" />
			<content type="html"><![CDATA[<p>Понятно, буфер нужно больше делать, значит или не ограничивать. Он для одного только хоткея Shift+R 12 строк туда добавляет. Просто в хелпе-то об этом ничего нет.</p>]]></content>
			<author>
				<name><![CDATA[dron008]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39530</uri>
			</author>
			<updated>2018-09-21T23:15:48Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=128807#p128807</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как проверить, нажималась ли другая клавиша между хоткеями?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=128763#p128763" />
			<content type="html"><![CDATA[<p>В keyHistory &quot;2&quot; нету, следовательно A_PriorKey пустой.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2018-09-19T08:33:27Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=128763#p128763</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как проверить, нажималась ли другая клавиша между хоткеями?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=128761#p128761" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Malcev пишет:</cite><blockquote><p>Запустите этот код, наберите 123, нажмите view-&gt;refresh.<br />Что у вас показывает?</p></blockquote></div><p>Такое показывает:<br /></p><div class="codebox"><pre><code>VK  SC	Type	Up/Dn	Elapsed	Key		Window
-------------------------------------------------------------------------------------------------------------
33  004	 	d	0.92	3              	
33  004	 	u	0.13	3              	
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[dron008]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39530</uri>
			</author>
			<updated>2018-09-19T01:04:18Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=128761#p128761</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как проверить, нажималась ли другая клавиша между хоткеями?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=128733#p128733" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>#InstallKeybdHook
#KeyHistory 2
KeyHistory</code></pre></div><p>Запустите этот код, наберите 123, нажмите view-&gt;refresh.<br />Что у вас показывает?</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2018-09-16T23:54:34Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=128733#p128733</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как проверить, нажималась ли другая клавиша между хоткеями?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=128732#p128732" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Malcev пишет:</cite><blockquote><p>А теперь посмотрите какие нажатия сохраняются в keyhistory при #KeyHistory 2.</p></blockquote></div><p>В том-то и дело, что там значения были, выше отмечал это: &quot;...хотя по KeyHistory в логе есть промежуточные нажатия&quot;.</p>]]></content>
			<author>
				<name><![CDATA[dron008]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39530</uri>
			</author>
			<updated>2018-09-16T23:42:47Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=128732#p128732</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как проверить, нажималась ли другая клавиша между хоткеями?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=128731#p128731" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>dron008 пишет:</cite><blockquote><p>получается A_PriorKey было пустым из-за &quot;#KeyHistory 2&quot;</p></blockquote></div><div class="quotebox"><blockquote><p>A_PriorKey - The name of the last key which was pressed prior to the most recent key-press or key-release, or <strong>blank if no applicable key-press can be found in the key history</strong>.</p></blockquote></div><p>А теперь посмотрите какие нажатия сохраняются в keyhistory при #KeyHistory 2.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2018-09-16T22:58:50Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=128731#p128731</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как проверить, нажималась ли другая клавиша между хоткеями?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=128730#p128730" />
			<content type="html"><![CDATA[<p><strong>stealzy</strong>, о, благодарю, так заработало. </p><p>Под $s подправил, но получается A_PriorKey было пустым из-за &quot;#KeyHistory 2&quot;. Странно, в доке пишут &quot;For this variable to be of use, the keyboard or mouse hook must be installed and <strong>key history must be enabled</strong>&quot;, вот и добавил.</p><p>Клавишу-модификатор рассматривал, двойное нажатие удобнее показалось - не надо пальцы тянуть далеко каждый раз. Но вот оказалось, что редактирование через backspace не со всеми приложениями совместимо, так что посмотрю ещё в сторону модификаторов.</p><p>А тултип для отладки - полезная штука, не надо с DebugView возиться. Благодарю за наводку. <br /><span style="color: darkgray">Правда, AHK очень эпизодически использую, у меня даже AHK-скрипт через JS-скрипт генерируется - не хотелось долго разбираться со всеми тонкостями эскейпинга, функций для генерации хоткеев и т.д. Язык непривычный всё-таки.</span></p>]]></content>
			<author>
				<name><![CDATA[dron008]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39530</uri>
			</author>
			<updated>2018-09-16T22:39:45Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=128730#p128730</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как проверить, нажималась ли другая клавиша между хоткеями?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=128727#p128727" />
			<content type="html"><![CDATA[<p>Можно использовать капслок или клавишу меню в качестве модификатора турецкого языка: <a href="http://forum.script-coding.com/viewtopic.php?pid=127345#p127345">http://forum.script-coding.com/viewtopi … 45#p127345</a>.</p><p>Что же касается вашего вопроса - <em>&quot;$s&quot; != &quot;s&quot;</em>.<br /></p><div class="codebox"><pre><code>#MaxThreadsPerHotkey 2
#InstallKeybdHook

$s::
  ToolTip % A_PriorHotkey &quot; &lt;&gt; &quot; A_ThisHotkey &quot;`n&quot; A_TimeSincePriorHotkey &quot; &gt; 200`n&quot; A_PriorHotkey &quot; &lt;&gt; &quot; A_PriorKey
  if (A_PriorHotkey &lt;&gt; A_ThisHotkey or A_TimeSincePriorHotkey &gt; 200 or A_PriorHotkey &lt;&gt; A_PriorKey)  
    send s
  else
    send ş
return
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[stealzy]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=31937</uri>
			</author>
			<updated>2018-09-16T17:15:04Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=128727#p128727</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Как проверить, нажималась ли другая клавиша между хоткеями?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=128725#p128725" />
			<content type="html"><![CDATA[<p>Есть скрипт, по двойному нажатию заменяющий латинские буквы на турецкие. Например, нажимаю быстро (менее 200 мс между нажатиями) &quot;ss&quot;, появляется &quot;ş&quot;.&nbsp; Работает, но проблема в том, что если быстро набираю &quot;sos&quot;, то тоже срабатывает замена.&nbsp; Нужно отловить условие, что между хоткеями нажималась другая клавиша. Пробовал через A_PriorKey, но она почему-то всегда пустая, хотя по KeyHistory в логе есть промежуточные нажатия.</p><p>Код интересующей части скрипта такой:</p><div class="codebox"><pre><code>#MaxThreadsPerHotkey 2
#InstallKeybdHook
#KeyHistory 2

$s::
  lang := GetLang()
  if (lang &lt;&gt; &quot;English&quot;) {
    send, ы
    return
  }
  OutputDebug, A_PriorKey: %A_PriorKey%
  OutputDebug, A_PriorHotkey: %A_PriorHotkey%
  OutputDebug, A_ThisHotkey: %A_ThisHotkey%
  KeyHistory

  if (A_PriorHotkey &lt;&gt; A_ThisHotkey or A_TimeSincePriorHotkey &gt; 200 or A_PriorHotkey &lt;&gt; A_PriorKey) 
  { 
    send, s
    return 
  }
  send, {BS}ş
return
</code></pre></div><p>Добавил условие A_PriorHotkey &lt;&gt; A_PriorKey, чтобы убеждаться, что не было промежуточных нажатий, но из-за того, что A_PriorKey пустое, вообще не заменяет ничего. Почему может не заполняться A_PriorKey?</p>]]></content>
			<author>
				<name><![CDATA[dron008]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39530</uri>
			</author>
			<updated>2018-09-16T15:45:53Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=128725#p128725</id>
		</entry>
</feed>
