<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; Увеличение Sleep после нажатия клавиши]]></title>
		<link>http://forum.script-coding.com/viewtopic.php?id=11240</link>
		<atom:link href="http://forum.script-coding.com/extern.php?action=feed&amp;tid=11240&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «Увеличение Sleep после нажатия клавиши».]]></description>
		<lastBuildDate>Tue, 19 Jan 2016 19:17:01 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Увеличение Sleep после нажатия клавиши]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=100527#p100527</link>
			<description><![CDATA[<p>Разорбался <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /> получилось что то в роде этого.<br /></p><div class="codebox"><pre><code>

SetWorkingDir %A_ScriptDir%
#InstallKeybdHook

;IfNotExist, 1.png
    ;MsgBox Error: Your file either doesn&#039;t exist or isn&#039;t in this location.

p1 := [0, 0, A_ScreenWidth, A_ScreenHeight, &quot;1.png&quot;, 1]
p2 := [0, 0, A_ScreenWidth, A_ScreenHeight, &quot;2.png&quot;, 2]
p3 := [0, 0, A_ScreenWidth, A_ScreenHeight, &quot;3.png&quot;, 3]
p4 := [0, 0, A_ScreenWidth, A_ScreenHeight, &quot;4.png&quot;, 4]


SetTimer, CheckActivity, 50
Exit

CheckActivity:
  loop
   {
      if(A_TimeIdlePhysical &lt; 200) and !(GetKeyState(&quot;w&quot;, &quot;p&quot;)) and !(GetKeyState(&quot;a&quot;, &quot;p&quot;)) and !(GetKeyState(&quot;s&quot;, &quot;p&quot;)) and !(GetKeyState(&quot;d&quot;, &quot;p&quot;))
         {
            sleep 1000
         }
      else
         {
            loop 4
               {
                  ImageSearch, Px, Py, p%A_Index%[1], p%A_Index%[2], p%A_Index%[3], p%A_Index%[4], % p%A_Index%[5]
                  if !errorlevel
                     {
                        send % p%A_Index%[6]
                        break
                     }
               }
         }
  }
return
</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (bubaaa)]]></author>
			<pubDate>Tue, 19 Jan 2016 19:17:01 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=100527#p100527</guid>
		</item>
		<item>
			<title><![CDATA[Re: Увеличение Sleep после нажатия клавиши]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=100519#p100519</link>
			<description><![CDATA[<div class="quotebox"><cite>Alectric пишет:</cite><blockquote><div class="codebox"><pre><code>SetWorkingDir %A_ScriptDir%

;IfNotExist, 1.png
    ;MsgBox Error: Your file either doesn&#039;t exist or isn&#039;t in this location.

p1 := [0, 0, 1366, 768, &quot;1.png&quot;, 1]
p2 := [0, 0, 1366, 768, &quot;2.png&quot;, 2]
p3 := [0, 0, 1366, 768, &quot;3.png&quot;, 3]
p4 := [0, 0, 1366, 768, &quot;4.png&quot;, 4]


loop
{
  sleep,10
  t++
  if t&gt;0
  loop 4
  {
    ImageSearch, Px, Py, p%A_Index%[1], p%A_Index%[2], p%A_Index%[3], p%A_Index%[4], % p%A_Index%[5]
;    tooltip,% a_tickcount
    if t&lt;1
      break
    if !errorlevel
    {
      send % p%A_Index%[6]
      break
    }
  }
}
Return


~vk45::
t=-100
return
</code></pre></div></blockquote></div><p>К сожалению не работает, перезапускает 1 loop и все.</p><p>Вот к чему пришел - но скрипт останавливается при нажатии любой кнопки, а вот как добавить исключения к WASD не могу понять.<br />при нажатых кнопках W или A&nbsp; или S или D скрипт продолжал работать.</p><div class="codebox"><pre><code> SetWorkingDir %A_ScriptDir%
#InstallKeybdHook

;IfNotExist, 1.png
    ;MsgBox Error: Your file either doesn&#039;t exist or isn&#039;t in this location.

p1 := [0, 0, A_ScreenWidth, A_ScreenHeight, &quot;1.png&quot;, 1]
p2 := [0, 0, A_ScreenWidth, A_ScreenHeight, &quot;2.png&quot;, 2]
p3 := [0, 0, A_ScreenWidth, A_ScreenHeight, &quot;3.png&quot;, 3]
p4 := [0, 0, A_ScreenWidth, A_ScreenHeight, &quot;4.png&quot;, 4]


SetTimer, CheckActivity, 50
Exit

CheckActivity:
  loop
   {
      if(A_TimeIdlePhysical &lt; 200)
         {
            sleep 1000
         }
      else
         {
            loop 4
               {
                  ImageSearch, Px, Py, p%A_Index%[1], p%A_Index%[2], p%A_Index%[3], p%A_Index%[4], % p%A_Index%[5]
                  if !errorlevel
                     {
                        send % p%A_Index%[6]
                        break
                     }
               }
         }
  }
return </code></pre></div>]]></description>
			<author><![CDATA[null@example.com (bubaaa)]]></author>
			<pubDate>Tue, 19 Jan 2016 18:22:29 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=100519#p100519</guid>
		</item>
		<item>
			<title><![CDATA[Re: Увеличение Sleep после нажатия клавиши]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=100517#p100517</link>
			<description><![CDATA[<div class="codebox"><pre><code>SetWorkingDir %A_ScriptDir%

;IfNotExist, 1.png
    ;MsgBox Error: Your file either doesn&#039;t exist or isn&#039;t in this location.

p1 := [0, 0, 1366, 768, &quot;1.png&quot;, 1]
p2 := [0, 0, 1366, 768, &quot;2.png&quot;, 2]
p3 := [0, 0, 1366, 768, &quot;3.png&quot;, 3]
p4 := [0, 0, 1366, 768, &quot;4.png&quot;, 4]


loop
{
  sleep,10
  t++
  if t&gt;0
  loop 4
  {
    ImageSearch, Px, Py, p%A_Index%[1], p%A_Index%[2], p%A_Index%[3], p%A_Index%[4], % p%A_Index%[5]
;    tooltip,% a_tickcount
    if t&lt;1
      break
    if !errorlevel
    {
      send % p%A_Index%[6]
      break
    }
  }
}
Return


~vk45::
t=-100
return
</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Alectric)]]></author>
			<pubDate>Tue, 19 Jan 2016 17:50:48 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=100517#p100517</guid>
		</item>
		<item>
			<title><![CDATA[Re: Увеличение Sleep после нажатия клавиши]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=100504#p100504</link>
			<description><![CDATA[<p><strong>yalanne</strong><br /> Так тоже проверял, все не дало результатов <img src="//forum.script-coding.com/img/smilies/sad.png" width="15" height="15" /> все равно, между нажатиями проскакивает цифра</p>]]></description>
			<author><![CDATA[null@example.com (bubaaa)]]></author>
			<pubDate>Tue, 19 Jan 2016 10:17:10 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=100504#p100504</guid>
		</item>
		<item>
			<title><![CDATA[Re: Увеличение Sleep после нажатия клавиши]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=100503#p100503</link>
			<description><![CDATA[<p><strong>GetKeystate(&quot;e&quot;)</strong> неправильно указан. <strong>GetKeystate(&quot;vk45&quot;,&quot;p&quot;) </strong> правильно. <strong>vk45</strong> это клавиша <strong>e\у</strong>, а <strong>p</strong> значит что должна проводится проверка на нажатость(есть еще T, проверяет статус например у caps lock).</p><p>vk это виртуальный код клавиши, его можно узнать тут <a href="https://msdn.microsoft.com/ru-ru/library/windows/desktop/dd375731(v=vs.85).aspx">Virtual-Key Codes</a>.</p>]]></description>
			<author><![CDATA[null@example.com (yalanne)]]></author>
			<pubDate>Tue, 19 Jan 2016 09:56:31 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=100503#p100503</guid>
		</item>
		<item>
			<title><![CDATA[Re: Увеличение Sleep после нажатия клавиши]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=100500#p100500</link>
			<description><![CDATA[<p><img src="//forum.script-coding.com/img/smilies/sad.png" width="15" height="15" /> вообще нет идей, или наводок каких нибудь? куда копать?</p>]]></description>
			<author><![CDATA[null@example.com (bubaaa)]]></author>
			<pubDate>Tue, 19 Jan 2016 09:16:54 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=100500#p100500</guid>
		</item>
		<item>
			<title><![CDATA[Увеличение Sleep после нажатия клавиши]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=100494#p100494</link>
			<description><![CDATA[<p>Добрый день.<br />В данный скрипт осуществляет поиск картинки в директории, и в зависимости от найденной картинки - нажимает цифру от 1 до 4. <br />Если нажать кнопка &quot;e&quot; скрипт засыпает на 1 секунду. <br />Если зажать &quot;e&quot; то засыпает пока не отожмешь &quot;e&quot;</p><p>Однако если часто нажимать &quot;e&quot;, цифры все равно проскакивают между нажатиями - как на скриншоте. </p><p>Вопрос: </p><p>Можно ли это реализовать? - каждый раз при нажатии кнопки &quot;e&quot; сбрасывать значение sleep в 0 и начинать sleep заново?<br />Или возможно есть другой метод исключить, цифры между нажатиями?</p><br /><br /><div class="codebox"><pre><code>

SetWorkingDir %A_ScriptDir%

;IfNotExist, 1.png
    ;MsgBox Error: Your file either doesn&#039;t exist or isn&#039;t in this location.

p1 := [0, 0, 1366, 768, &quot;1.png&quot;, 1]
p2 := [0, 0, 1366, 768, &quot;2.png&quot;, 2]
p3 := [0, 0, 1366, 768, &quot;3.png&quot;, 3]
p4 := [0, 0, 1366, 768, &quot;4.png&quot;, 4]


loop
{
   loop 4
   {
	  ImageSearch, Px, Py, p%A_Index%[1], p%A_Index%[2], p%A_Index%[3], p%A_Index%[4], % p%A_Index%[5]
      if errorlevel &amp;&amp; (GetKeystate(&quot;e&quot;) = 1)
   {
         sleep 1000
         break
   } 
      else if !errorlevel &amp;&amp; (GetKeystate(&quot;e&quot;) = 0)
   {
         send % p%A_Index%[6]
         break
   }
   }
}
Return

</code></pre></div><p>Спасибо.</p>]]></description>
			<author><![CDATA[null@example.com (bubaaa)]]></author>
			<pubDate>Mon, 18 Jan 2016 14:00:28 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=100494#p100494</guid>
		</item>
	</channel>
</rss>
