<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK: Сброс счетчика нажатием любой другой клавиши]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=6542</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=6542&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: Сброс счетчика нажатием любой другой клавиши».]]></description>
		<lastBuildDate>Tue, 20 Dec 2011 00:07:18 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: Сброс счетчика нажатием любой другой клавиши]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=54790#p54790</link>
			<description><![CDATA[<div class="quotebox"><blockquote><p>Как сделать так, чтобы при нажатии вообще любой другой клавиши (в том числе и на мышке), счетчик сбрасывался и, в случае, если я снова нажму на эту клавишу, начинал с первого заданного значения?</p></blockquote></div><p>Когда то Teadrinker помог мне решить подобную задачу для игры. Мой скрипт&nbsp; выглядит так:</p><div class="codebox"><pre><code>$2::
If  A_PriorHotkey = 1
  {
  SetTimer, Nulling, -20
  Sleep, 40
  Send, %A_ThisHotkey%  
  }
Else If  A_PriorHotkey = 3
  {
  SetTimer, Nulling, -20
  Sleep, 40
  Send, %A_ThisHotkey%  
  }
Else If  A_PriorHotkey = 4
  {
  SetTimer, Nulling, -20
  Sleep, 40
  Send, %A_ThisHotkey%  
  }
Else If  A_PriorHotkey = 5
  {
  SetTimer, Nulling, -20
  Sleep, 40
  Send, %A_ThisHotkey%  
  }
Else If keystroke = ; если у переменной нет значения (пустое)
  {
    keystroke = 1 
    Send, 2
    SetTimer, Nulling, -4000 ; если в течении 4 секунды ничего не жать, &quot;комбо&quot; сбросится в стартовую позицию.
  } 
Else if keystroke = 1
  {
   keystroke = 2 ; присвоим переменной иное значение
    Send, 6
    SetTimer, Nulling, -4000
  }
Else if keystroke = 2
  {
    keystroke = ; очищаем переменную
    Send, 8
  }
Return


XButton2:: 
   SetTimer, Nulling, -40
   ToolTip, сброс, 400, 420 
   Sleep, 40
   ToolTip
Return


Nulling:
   keystroke =
   ToolTip сброс, 400, 430 
   Sleep, 100
   ToolTip
Return</code></pre></div><p>Если я начинаю кликать другие клавиши - происходит сброс таймеров.<br />При нажатии на дополнительную клавишу мыши происходит принудительный сброс.</p>]]></description>
			<author><![CDATA[null@example.com (Raam)]]></author>
			<pubDate>Tue, 20 Dec 2011 00:07:18 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=54790#p54790</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Сброс счетчика нажатием любой другой клавиши]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=54551#p54551</link>
			<description><![CDATA[<p><strong>Grey</strong>, спасибо большое, все замечательно работает!</p>]]></description>
			<author><![CDATA[null@example.com (Uzbek)]]></author>
			<pubDate>Tue, 13 Dec 2011 10:25:40 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=54551#p54551</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Сброс счетчика нажатием любой другой клавиши]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=54535#p54535</link>
			<description><![CDATA[<div class="codebox"><pre><code>#InstallMouseHook

*vk51:: ; q
*vk52:: ; r
*vk57:: ; w
   If % A_ThisHotkey&lt;&gt;Dec2Hex(GetKeyVK(A_PriorKey))
      If Dec2Hex(GetKeyVK(A_PriorKey))!=&quot;*vk20&quot;
      And Dec2Hex(GetKeyVK(A_PriorKey))!=&quot;*vk01&quot;
         bct:=rct:=act:=0
   If % A_ThisHotkey=&quot;*vk51&quot;
      SendInput, % &quot;{&quot;((act:=!act) ? &quot;Home&quot;:&quot;End&quot;)&quot;}&quot;
   Else If % A_ThisHotkey=&quot;*vk52&quot;
   {
      If !rct
      {
         SendInput, {F6}
         rct:=1
      }
      Else If rct=1
      {
         SendInput, {F7}
         rct:=2
      }
      Else If rct=2
      {
         SendInput, {F8}
         rct:=0
      }
   }
   Else If % A_ThisHotkey=&quot;*vk57&quot;
      SendInput, % &quot;{&quot;((bct:=!bct) ? &quot;Ins&quot;:&quot;Del&quot;)&quot;}&quot;
   KeyWait, % A_ThisHotkey
   Return

Dec2Hex(DecData)
{
   HexData:=0000
   DllCall(&quot;msvcrt.dll\s&quot;(A_IsUnicode ? &quot;w&quot;:&quot;&quot;)&quot;printf&quot;, &quot;Str&quot;, HexData
                                                       , &quot;Str&quot;, &quot;*vk%02x&quot;
                                                       , &quot;UInt&quot;, DecData)
   Return, HexData
}</code></pre></div><div class="quotebox"><cite>Uzbek пишет:</cite><blockquote><p>Так нет, у вас все было правильно. &quot;q&quot; — это я уже в своем исправленном варианте изменил.</p></blockquote></div><p>Угу, к чему спешка приводит... <img src="//forum.script-coding.com/img/smilies/lol.png" width="15" height="15" /></p>]]></description>
			<author><![CDATA[null@example.com (Grey)]]></author>
			<pubDate>Mon, 12 Dec 2011 18:50:14 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=54535#p54535</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Сброс счетчика нажатием любой другой клавиши]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=54534#p54534</link>
			<description><![CDATA[<div class="quotebox"><cite>Uzbek пишет:</cite><blockquote><p>Как сделать так, чтобы при нажатии <strong>вообще любой другой клавиши (в том числе и на мышке)</strong>, счетчик сбрасывался и, в случае, если я снова нажму на эту клавишу, начинал с первого заданного значения?</p></blockquote></div><p>На выбор:<br />1) использовать хуки(<a href="http://forum.script-coding.com/viewtopic.php?id=6350">пример</a>).<br />2) по таймеру проверять состояние клавиатуры и мыши.<br /></p><div class="quotebox"><cite>Uzbek пишет:</cite><blockquote><p>A_IsUnicode ? &quot;w&quot;:&quot;q&quot;:&quot;r&quot;:&quot;и так далее&quot;</p></blockquote></div><p><img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p>]]></description>
			<author><![CDATA[null@example.com (Александр_)]]></author>
			<pubDate>Mon, 12 Dec 2011 18:46:45 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=54534#p54534</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Сброс счетчика нажатием любой другой клавиши]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=54516#p54516</link>
			<description><![CDATA[<p><strong>Grey</strong>, в общем я сделал примерно так:</p><div class="codebox"><pre><code>*vk57::
   If % A_ThisHotkey&lt;&gt;Dec2Hex(GetKeyVK(A_PriorKey))
      bct:=0
   SendInput, % &quot;{&quot;((bct:=!bct) ? &quot;Ins&quot;:&quot;Del&quot;)&quot;}&quot;
   KeyWait, vk57
   Return
 
*vk51::
   If % A_ThisHotkey&lt;&gt;Dec2Hex(GetKeyVK(A_PriorKey))
      act:=0
   SendInput, % &quot;{&quot;((act:=!act) ? &quot;Home&quot;:&quot;End&quot;)&quot;}&quot;
   KeyWait, vk51
   Return

*vk52::
   If % A_ThisHotkey&lt;&gt;Dec2Hex(GetKeyVK(A_PriorKey))
      rct:=0
   SendInput, % &quot;{&quot;((rct:=!rct) ? &quot;F6&quot;:&quot;F7&quot;)&quot;}&quot;
   KeyWait, vk52
   Return
 
Dec2Hex(DecData)
{
   HexData:=0000
   DllCall(&quot;msvcrt.dll\s&quot;(A_IsUnicode ? &quot;w&quot;:&quot;&quot;)&quot;printf&quot;, &quot;Str&quot;, HexData
                                                       , &quot;Str&quot;, &quot;*vk%02x&quot;
                                                       , &quot;UInt&quot;, DecData)
   Return, HexData
}</code></pre></div><p>Все вроде бы работает, но появилось два важных вопроса <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p><p>1. Не получилось в третьем случае сделать ротацию трех кнопок вместо двух. Как бы туда еще F8 добавить после F6 и F7?</p><p>2. Самый важный вопрос, который вдруг всплыл после теста <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /><br />Можно как-то внести два исключения (пробел и лев. кнопка мыши), при использовании которых никакие счетчики не сбрасывались бы?</p>]]></description>
			<author><![CDATA[null@example.com (Uzbek)]]></author>
			<pubDate>Mon, 12 Dec 2011 14:22:44 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=54516#p54516</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Сброс счетчика нажатием любой другой клавиши]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=54512#p54512</link>
			<description><![CDATA[<p>Нет, это функция, она <em>перегоняет</em> десятеричное значение (получаемое от встроенной функции GetKeyVK, которая в свою очередь проверяет встроенную переменную A_PriorKey) в шестнадцатиричное с префиксом. <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /> Вы меня извините, я смогу помочь только вечером, ибо надо идти.</p>]]></description>
			<author><![CDATA[null@example.com (Grey)]]></author>
			<pubDate>Mon, 12 Dec 2011 10:49:49 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=54512#p54512</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Сброс счетчика нажатием любой другой клавиши]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=54511#p54511</link>
			<description><![CDATA[<p>А. По ходу, ее не нужно дублировать.</p><p>Нужно как-то так?</p><div class="codebox"><pre><code>Dec2Hex(DecData)
{
   HexData:=0000
   DllCall(&quot;msvcrt.dll\s&quot;(A_IsUnicode ? &quot;w&quot;:&quot;q&quot;:&quot;r&quot;:&quot;и так далее&quot;)&quot;printf&quot;, &quot;Str&quot;, HexData
                                                       , &quot;Str&quot;, &quot;*vk%02x&quot;
                                                       , &quot;UInt&quot;, DecData)
   Return, HexData
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Uzbek)]]></author>
			<pubDate>Mon, 12 Dec 2011 10:38:09 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=54511#p54511</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Сброс счетчика нажатием любой другой клавиши]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=54510#p54510</link>
			<description><![CDATA[<div class="quotebox"><blockquote><p>Хах, банальная опечатка, конечно же там должна быть <strong>w</strong> а не <strong>q</strong>.</p></blockquote></div><p>Так нет, у вас все было правильно. &quot;q&quot; — это я уже в своем исправленном варианте изменил. Т.е., я попробовал изменить код под другую клавишу (Q).</p><p>Кстати, при вставлении второго куска (уже для клавиши vk51, а не vk57) выдает ошибку Dec2Hex (Duplicate function definition).</p>]]></description>
			<author><![CDATA[null@example.com (Uzbek)]]></author>
			<pubDate>Mon, 12 Dec 2011 10:35:17 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=54510#p54510</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Сброс счетчика нажатием любой другой клавиши]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=54508#p54508</link>
			<description><![CDATA[<div class="quotebox"><cite>Uzbek пишет:</cite><blockquote><p>DllCall(&quot;msvcrt.dll\s&quot;(A_IsUnicode ? <strong>&quot;w&quot;</strong></p></blockquote></div><p>Хах, банальная опечатка, конечно же там должна быть <strong>w</strong> а не <strong>q</strong>. Я проверяю скрипты все после запуска прямо в редакторе, где их и пишу... <img src="//forum.script-coding.com/img/smilies/lol.png" width="15" height="15" /></p>]]></description>
			<author><![CDATA[null@example.com (Grey)]]></author>
			<pubDate>Mon, 12 Dec 2011 10:20:58 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=54508#p54508</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Сброс счетчика нажатием любой другой клавиши]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=54506#p54506</link>
			<description><![CDATA[<p>Проверил ваш код. Работает великолепно!</p>]]></description>
			<author><![CDATA[null@example.com (Uzbek)]]></author>
			<pubDate>Mon, 12 Dec 2011 10:04:15 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=54506#p54506</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Сброс счетчика нажатием любой другой клавиши]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=54505#p54505</link>
			<description><![CDATA[<div class="quotebox"><blockquote><p>Луше и быстрее будет, если я буду знать все клавиши и то, что они должны делать, и у Вас будет стартовый пример, для дальнейших разработок. <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p></blockquote></div><p>Без сомнений, это точно будет быстрее и лучше <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p><p>Ну, вот vk51 (Q) — поочередное нажатие Home, End</p><p>vk52 — F6, F7, F8</p><p>И такой же сброс, конечно же.</p><div class="quotebox"><blockquote><p>Ну как-бы эта W (*vk57) изначально не моя, и пом, где внизу?</p></blockquote></div><p>DllCall(&quot;msvcrt.dll\s&quot;(A_IsUnicode ? <strong>&quot;w&quot;</strong></p>]]></description>
			<author><![CDATA[null@example.com (Uzbek)]]></author>
			<pubDate>Mon, 12 Dec 2011 10:01:36 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=54505#p54505</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Сброс счетчика нажатием любой другой клавиши]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=54504#p54504</link>
			<description><![CDATA[<div class="quotebox"><cite>Uzbek пишет:</cite><blockquote><p>...надо будет поправить примерно так?</p></blockquote></div><p>Луше и быстрее будет, если я буду знать все клавиши и то, что они должны делать, и у Вас будет стартовый пример, для дальнейших разработок. <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /><br /></p><div class="quotebox"><cite>Uzbek пишет:</cite><blockquote><p>Сомнение вызывает ваша &quot;w&quot; внизу</p></blockquote></div><p>Ну как-бы эта W (*vk57) изначально не моя, и пом, где внизу?</p>]]></description>
			<author><![CDATA[null@example.com (Grey)]]></author>
			<pubDate>Mon, 12 Dec 2011 09:52:05 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=54504#p54504</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Сброс счетчика нажатием любой другой клавиши]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=54500#p54500</link>
			<description><![CDATA[<div class="quotebox"><blockquote><p>Ваш <em>идеальный вариант</em> готов</p></blockquote></div><p>Спасибо огромное, пойду тестить.</p><p>А для других счетчиков (коих у меня много) надо будет поправить примерно так? (Например, для vk51, и для других клавиш.)</p><div class="codebox"><pre><code>*vk51::
   If % A_ThisHotkey&lt;&gt;Dec2Hex(GetKeyVK(A_PriorKey))
      bct:=0
   SendInput, % &quot;{&quot;((act:=!act) ? &quot;Home&quot;:&quot;End&quot;:&quot;PgUp&quot;)&quot;}&quot;
   KeyWait, vk51
   Return
 
Dec2Hex(DecData)
{
   HexData:=0000
   DllCall(&quot;msvcrt.dll\s&quot;(A_IsUnicode ? &quot;q&quot;:&quot;&quot;)&quot;printf&quot;, &quot;Str&quot;, HexData
                                                       , &quot;Str&quot;, &quot;*vk%02x&quot;
                                                       , &quot;UInt&quot;, DecData)
   Return, HexData
}</code></pre></div><p>Если что, я чисто интуитивно тут в потемках шарюсь. Сомнение вызывает ваша &quot;w&quot; внизу — это клавиша, или это какая-то другая переменная? Я ее заменил на &quot;q&quot;, потому что решил, что это клавиша <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p>]]></description>
			<author><![CDATA[null@example.com (Uzbek)]]></author>
			<pubDate>Mon, 12 Dec 2011 09:32:47 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=54500#p54500</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Сброс счетчика нажатием любой другой клавиши]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=54498#p54498</link>
			<description><![CDATA[<p>Ваш <em>идеальный вариант</em> готов:</p><div class="codebox"><pre><code>*vk57::
   If % A_ThisHotkey&lt;&gt;Dec2Hex(GetKeyVK(A_PriorKey))
      bct:=0
   SendInput, % &quot;{&quot;((bct:=!bct) ? &quot;Ins&quot;:&quot;Del&quot;)&quot;}&quot;
   KeyWait, vk57
   Return

Dec2Hex(DecData)
{
   HexData:=0000
   DllCall(&quot;msvcrt.dll\s&quot;(A_IsUnicode ? &quot;w&quot;:&quot;&quot;)&quot;printf&quot;, &quot;Str&quot;, HexData
                                                       , &quot;Str&quot;, &quot;*vk%02x&quot;
                                                       , &quot;UInt&quot;, DecData)
   Return, HexData
}</code></pre></div><div class="quotebox"><cite>Uzbek пишет:</cite><blockquote><p>...как правильно прописать сброс нескольких счетчиков?</p></blockquote></div><div class="codebox"><pre><code>~LButton::bct:=act:=cct:=dct:=0</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Grey)]]></author>
			<pubDate>Mon, 12 Dec 2011 09:05:30 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=54498#p54498</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Сброс счетчика нажатием любой другой клавиши]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=54495#p54495</link>
			<description><![CDATA[<p>Ваш вариант с LButton тоже, в принципе, пойдет.<br />Скажите, а как правильно прописать сброс нескольких счетчиков? Не только bct, а еще и act, cct, dct и так далее.</p>]]></description>
			<author><![CDATA[null@example.com (Uzbek)]]></author>
			<pubDate>Mon, 12 Dec 2011 08:14:59 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=54495#p54495</guid>
		</item>
	</channel>
</rss>
