<?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="http://forum.script-coding.com/extern.php?action=feed&amp;tid=2789&amp;type=atom" />
	<updated>2012-04-30T17:59:24Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.script-coding.com/viewtopic.php?id=2789</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Отслеживание времени бездействия мыши]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=59853#p59853" />
			<content type="html"><![CDATA[<p>Вариант, поддерживающий AHK_L x64.<br /></p><div class="codebox"><pre><code>   PrevTime := A_TickCount
   OnExit, Exit
   hHookMouse := DllCall(&quot;SetWindowsHookEx&quot; . (A_IsUnicode ? &quot;W&quot; : &quot;A&quot;)
      , Int, WH_MOUSE_LL := 14
      , Int, RegisterCallback(&quot;LowLevelMouseProc&quot;, &quot;Fast&quot;)
      , Ptr, DllCall(&quot;GetModuleHandle&quot;, UInt, 0, Ptr)
      , UInt, 0, Ptr)
   Return
 
Exit:
   DllCall(&quot;UnhookWindowsHookEx&quot;, UInt, hHookMouse)
   ExitApp
 
LowLevelMouseProc(nCode, wParam, lParam)
{
   global PrevTime
   Time := NumGet(lParam+0, 16, &quot;UInt&quot;)
   InactivityTime := Time - PrevTime
   if InactivityTime &gt; 300
   {
      ToolTip % &quot;Время бездействия мыши &quot; InactivityTime &quot; ms&quot;
      PrevTime := Time
   }
   Return DllCall(&quot;CallNextHookEx&quot;, Ptr, 0, Int, nCode, UInt, wParam, UInt, lParam)
}
 
Esc::ExitApp</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2012-04-30T17:59:24Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=59853#p59853</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Отслеживание времени бездействия мыши]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=52805#p52805" />
			<content type="html"><![CDATA[<p>Вариант с использованием <a href="http://forum.script-coding.com/viewtopic.php?id=6350">хука</a> на события мыши:<br /></p><div class="codebox"><pre><code>   PrevTime := A_TickCount
   OnExit, Exit
   hHookKeybd := DllCall(&quot;SetWindowsHookEx&quot;
      , Int, WH_MOUSE_LL := 14
      , Int, RegisterCallback(&quot;LowLevelMouseProc&quot;, &quot;Fast&quot;)
      , UInt, DllCall(&quot;GetModuleHandle&quot;, UInt, 0)
      , UInt, 0)
   Return
 
Exit:
   DllCall(&quot;UnhookWindowsHookEx&quot;, Uint, hHookKeybd)
   ExitApp
 
LowLevelMouseProc(nCode, wParam, lParam)
{
   global PrevTime
   Time := NumGet(lParam+0, 16)
   InactivityTime := Time - PrevTime
   if InactivityTime &gt; 300
   {
      ToolTip % &quot;Время бездействия мыши &quot; InactivityTime &quot; ms&quot;
      PrevTime := Time
   }
   Return DllCall(&quot;CallNextHookEx&quot;, UInt, 0, Int, nCode, UInt, wParam, UInt, lParam)
}
 
Esc::ExitApp</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2011-10-22T20:09:34Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=52805#p52805</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Отслеживание времени бездействия мыши]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=19534#p19534" />
			<content type="html"><![CDATA[<p>Скрипт выполняет нужную функцию по прошествии определённого времени неактивности мыши.</p><div class="codebox"><pre><code>    CoordMode, Mouse, Screen
    SetTimer, MouseWatch, 1000
    return

MouseWatch:
    MouseGetPos, x, y
    if (x = x_old) &amp;&amp; (y = y_old)
         counter++
    else counter =
    if counter = 5
         MyFunc(), counter := 0
    x_old := x, y_old := y
    return
    
~WheelDown::
~WheelUp::
~RButton::
~LButton::
    counter =
    return
    
MyFunc()
{
    MsgBox, 5 секунд бездействия мыши!
}

Esc:: ExitApp</code></pre></div><p>Авторы скрипта <strong>teadrinker</strong> и <strong>YMP</strong></p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2009-02-15T17:17:27Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=19534#p19534</id>
		</entry>
</feed>
