<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; Помощь для скрипта на события мыши]]></title>
		<link>http://forum.script-coding.com/viewtopic.php?id=9814</link>
		<atom:link href="http://forum.script-coding.com/extern.php?action=feed&amp;tid=9814&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «Помощь для скрипта на события мыши».]]></description>
		<lastBuildDate>Sat, 19 Jul 2014 04:52:05 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Помощь для скрипта на события мыши]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=84899#p84899</link>
			<description><![CDATA[<p>Мне для игр с эмуляторами, там и так всё мельтешит и мигает, а тут ещё курсор маячит...<br />Ещё раз большое спасибо. Сейчас нет возможности отблагодарить материально, но в следующий раз точно будет, и я думаю вскоре обращусь.</p>]]></description>
			<author><![CDATA[null@example.com (Xion)]]></author>
			<pubDate>Sat, 19 Jul 2014 04:52:05 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=84899#p84899</guid>
		</item>
		<item>
			<title><![CDATA[Re: Помощь для скрипта на события мыши]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=84898#p84898</link>
			<description><![CDATA[<p>Мне кажется без курсора не удобно.<br /></p><div class="codebox"><pre><code>
#SingleInstance Force
#NoEnv
ListLines Off
SetBatchLines -1
OnExit, Exit
OnMessage(0x200, &quot;WM_MOUSEMOVE&quot;)
CoordMode Mouse
VarSetCapacity(RECT, 16 ,0)
side := 50

Gui, -DPIScale +AlwaysOnTop -Caption +HWNDhThisGui +E0x08000000
Gui, Margin, 0, 0
Loop 9
    Gui, Add, Progress, % (Mod(A_Index+2, 3) ? &quot;x+0&quot; : &quot;x0&quot;)
        . &quot; y&quot; ((A_Index-1)//3)*(side) &quot; h&quot; side &quot; w&quot; side &quot; cD9952F v&quot; A_Index, 100
Return

1::
    Gui, Show, NA
    WinSet, Transparent, 150, ahk_id %hThisGui%
    MoveCenter()
    GuiControl, +c696969, 5 
    DllCall(&quot;GetWindowRect&quot;,&quot;uint&quot;,hThisGui,&quot;uint&quot;,&amp;RECT)
    DllCall(&quot;ClipCursor&quot;,&quot;uint&quot;,&amp;RECT)
    SetTimer, IsThisGui, 100
    DllCall(&quot;ShowCursor&quot;, &quot;uint&quot;, 0) 
    Return

2::
Close: 
    Gui, Hide 
    SetTimer, IsThisGui, Off
    GuiControl, +cD9952F, % prArea  
    If (prArea != &quot;&quot; &amp;&amp; prArea != 5)
        Send(prArea, &quot;Up&quot;), prArea := 5
    DllCall(&quot;ClipCursor&quot;)
    Return

IsThisGui:
    MouseGetPos, , , WinID
    If (hThisGui = WinID) 
        Return
    GoTo Close

MoveCenter:
    MoveCenter()
    Return
    
Exit:
    DllCall(&quot;ClipCursor&quot;) 
    ExitApp

WM_MOUSEMOVE()   {
    Global prArea 
    Area := A_GuiControl 
    If (Area = prArea)
        Return
    GuiControl, -Redraw, % prArea
    GuiControl, +cD9952F, % prArea
    GuiControl, +Redraw, % prArea 
    GuiControl, -Redraw, % Area
    GuiControl, +c696969, % Area
    GuiControl, +Redraw, % Area
    If (prArea != &quot;&quot; &amp;&amp; prArea != 5)
        Send(prArea, &quot;Up&quot;)
    prArea := Area
    If (Area != 5)
        Send(Area, &quot;Down&quot;) 
    SetTimer, MoveCenter, -1000    
} 

Send(n, mode)   {
    Static Send := [&quot;Up|Left&quot;, &quot;Up&quot;, &quot;Up|Right&quot;, &quot;Left&quot;, &quot;&quot;, &quot;Right&quot;, &quot;Left|Down&quot;, &quot;Down&quot;, &quot;Down|Right&quot;]
    This := StrSplit(Send[n], &quot;|&quot;)
    SendInput % &quot;{&quot; This[1] &quot; &quot; mode &quot;}&quot; (This[2] != &quot;&quot; ? &quot;{&quot; This[2] &quot; &quot; mode &quot;}&quot; : &quot;&quot;)   
    ; ToolTip % &quot;{&quot; This[1] &quot; &quot; mode &quot;}&quot; (This[2] != &quot;&quot; ? &quot;{&quot; This[2] &quot; &quot; mode &quot;}&quot; : &quot;&quot;)   
} 
    
MoveCenter()   {
    Global hThisGui 
    WinGetPos, WinX, WinY, WinWidth, WinHeight, ahk_id %hThisGui%
    MouseMove, WinX+WinWidth/2, WinY+WinHeight/2, 0  
} 
</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Sat, 19 Jul 2014 04:18:24 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=84898#p84898</guid>
		</item>
		<item>
			<title><![CDATA[Re: Помощь для скрипта на события мыши]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=84897#p84897</link>
			<description><![CDATA[<p>Огромное спасибо, прекрасно получилось, в моём понимании прекрасного, конечно. <br />Можно ещё попросить что бы при активации курсор пропадал? (а то мешает он прилично)</p>]]></description>
			<author><![CDATA[null@example.com (Xion)]]></author>
			<pubDate>Sat, 19 Jul 2014 03:30:52 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=84897#p84897</guid>
		</item>
		<item>
			<title><![CDATA[Re: Помощь для скрипта на события мыши]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=84892#p84892</link>
			<description><![CDATA[<div class="quotebox"><blockquote><p>Вот только для меня, тут как то всё очень мудро</p></blockquote></div><p>В первой редакции у меня всегда недопилено лишнее.<br /></p><div class="quotebox"><blockquote><p>Можно ещё попросить кусочек кода, что бы курсор возвращался в центральное положение через секунду?</p></blockquote></div><p>Перемещение в центр непомешает (функция -<strong>MoveCenter()</strong>):<br /></p><div class="codebox"><pre><code>
#SingleInstance Force
#NoEnv
ListLines Off
SetBatchLines -1
OnExit, Exit
OnMessage(0x200, &quot;WM_MOUSEMOVE&quot;)
CoordMode Mouse
VarSetCapacity(RECT, 16 ,0)
side := 50

Gui, -DPIScale +AlwaysOnTop -Caption +HWNDhThisGui +E0x08000000
Gui, Margin, 0, 0
Loop 9
    Gui, Add, Progress, % (Mod(A_Index+2, 3) ? &quot;x+0&quot; : &quot;x0&quot;)
        . &quot; y&quot; ((A_Index-1)//3)*(side ) &quot; h&quot; side &quot; w&quot; side &quot; cD9952F v&quot; A_Index, 100
Return

1::
    Gui, Show, NA
    WinSet, Transparent, 150, ahk_id %hThisGui%
    MoveCenter()
    GuiControl, +c696969, 5 
    DllCall(&quot;GetWindowRect&quot;,&quot;uint&quot;,hThisGui,&quot;uint&quot;,&amp;RECT)
    DllCall(&quot;ClipCursor&quot;,&quot;uint&quot;,&amp;RECT)
    SetTimer, IsThisGui, 100
    Return

2::
Close: 
    Gui, Hide 
    SetTimer, IsThisGui, Off
    GuiControl, +cD9952F, % prArea 
    If (prArea != &quot;&quot; &amp;&amp; prArea != 5)
        Send(prArea, &quot;Up&quot;), prArea := &quot;&quot;
    DllCall(&quot;ClipCursor&quot;)
    Return
    
Exit:
    DllCall(&quot;ClipCursor&quot;) 
    ExitApp

WM_MOUSEMOVE()   {
    Global prArea 
    Area := A_GuiControl
    If (Area = prArea)
        Return
    GuiControl, -Redraw, % prArea
    GuiControl, +cD9952F, % prArea
    GuiControl, +Redraw, % prArea 
    GuiControl, -Redraw, % Area
    GuiControl, +c696969, % Area
    GuiControl, +Redraw, % Area
    If (prArea != &quot;&quot; &amp;&amp; prArea != 5)
        Send(prArea, &quot;Up&quot;)
    prArea := Area
    If (Area != 5)
        Send(Area, &quot;Down&quot;)
} 

Send(n, mode)   {
    Static Send := [&quot;Up|Left&quot;, &quot;Up&quot;, &quot;Up|Right&quot;, &quot;Left&quot;, &quot;&quot;, &quot;Right&quot;, &quot;Left|Down&quot;, &quot;Down&quot;, &quot;Down|Right&quot;]
    This := StrSplit(Send[n], &quot;|&quot;)
    SendInput % &quot;{&quot; This[1] &quot; &quot; mode &quot;}&quot; (This[2] != &quot;&quot; ? &quot;{&quot; This[2] &quot; &quot; mode &quot;}&quot; : &quot;&quot;) 
} 

IsThisGui:
    MouseGetPos, , , WinID
    If (hThisGui = WinID) 
        Return
    GoTo Close

MoveCenter()   {
    Global hThisGui 
    WinGetPos, WinX, WinY, WinWidth, WinHeight, ahk_id %hThisGui%
    MouseMove, WinX+WinWidth/2, WinY+WinHeight/2, 0 
} 
</code></pre></div><p>А вот через секунду после чего, я непонял (или кое кому, сложно уточнить).<br /></p><div class="fancy_spoiler_switcher"><div class="fancy_spoiler_switcher_header"><strong>+</strong>&nbsp;может это</div><div class="fancy_spoiler"><div class="codebox"><pre><code>
#SingleInstance Force
#NoEnv
ListLines Off
SetBatchLines -1
OnExit, Exit
OnMessage(0x200, &quot;WM_MOUSEMOVE&quot;)
CoordMode Mouse
VarSetCapacity(RECT, 16 ,0)
side := 50

Gui, -DPIScale +AlwaysOnTop -Caption +HWNDhThisGui +E0x08000000
Gui, Margin, 0, 0
Loop 9
    Gui, Add, Progress, % (Mod(A_Index+2, 3) ? &quot;x+0&quot; : &quot;x0&quot;)
        . &quot; y&quot; ((A_Index-1)//3)*(side ) &quot; h&quot; side &quot; w&quot; side &quot; cD9952F v&quot; A_Index, 100
Return

1::
    Gui, Show, NA
    WinSet, Transparent, 150, ahk_id %hThisGui%
    MoveCenter()
    GuiControl, +c696969, 5 
    DllCall(&quot;GetWindowRect&quot;,&quot;uint&quot;,hThisGui,&quot;uint&quot;,&amp;RECT)
    DllCall(&quot;ClipCursor&quot;,&quot;uint&quot;,&amp;RECT)
    SetTimer, IsThisGui, 100
    Return

2::
Close: 
    Gui, Hide 
    SetTimer, IsThisGui, Off
    GuiControl, +cD9952F, % prArea 
    If (prArea != &quot;&quot; &amp;&amp; prArea != 5)
        Send(prArea, &quot;Up&quot;), prArea := &quot;&quot;
    DllCall(&quot;ClipCursor&quot;)
    Return

IsThisGui:
    MouseGetPos, , , WinID
    If (hThisGui = WinID) 
        Return
    GoTo Close

MoveCenter:
    MoveCenter()
    Return
    
Exit:
    DllCall(&quot;ClipCursor&quot;) 
    ExitApp

WM_MOUSEMOVE()   {
    Global prArea 
    Area := A_GuiControl
    If (Area = prArea)
        Return
    GuiControl, -Redraw, % prArea
    GuiControl, +cD9952F, % prArea
    GuiControl, +Redraw, % prArea 
    GuiControl, -Redraw, % Area
    GuiControl, +c696969, % Area
    GuiControl, +Redraw, % Area
    If (prArea != &quot;&quot; &amp;&amp; prArea != 5)
        Send(prArea, &quot;Up&quot;)
    prArea := Area
    If (Area != 5)
        Send(Area, &quot;Down&quot;) 
    SetTimer, MoveCenter, -1000    
} 

Send(n, mode)   {
    Static Send := [&quot;Up|Left&quot;, &quot;Up&quot;, &quot;Up|Right&quot;, &quot;Left&quot;, &quot;&quot;, &quot;Right&quot;, &quot;Left|Down&quot;, &quot;Down&quot;, &quot;Down|Right&quot;]
    This := StrSplit(Send[n], &quot;|&quot;)
    SendInput % &quot;{&quot; This[1] &quot; &quot; mode &quot;}&quot; (This[2] != &quot;&quot; ? &quot;{&quot; This[2] &quot; &quot; mode &quot;}&quot; : &quot;&quot;)   
} 
    
MoveCenter()   {
    Global hThisGui 
    WinGetPos, WinX, WinY, WinWidth, WinHeight, ahk_id %hThisGui%
    MouseMove, WinX+WinWidth/2, WinY+WinHeight/2, 0 
}  
</code></pre></div></div></div><div class="quotebox"><blockquote><p>Я так понял тут событие вызывается при наведении на определённый квадрат, значит можно просто уменьшить их и должно получится, то что хотел.</p></blockquote></div><p>Это тоже непонял, но если...:<br /></p><div class="codebox"><pre><code>side := 50</code></pre></div><p>то 50 это размер стороны квадратиков.</p>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Fri, 18 Jul 2014 18:03:24 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=84892#p84892</guid>
		</item>
		<item>
			<title><![CDATA[Re: Помощь для скрипта на события мыши]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=84891#p84891</link>
			<description><![CDATA[<p>Спасибо большое, пример стоящий! Вот только для меня, тут как то всё очень мудро, но зато будет чем заняться.</p><p>Можно ещё попросить кусочек кода, что бы курсор возвращался в центральное положение через секунду?</p><p>Я так понял тут событие вызывается при наведении на определённый квадрат, значит можно просто уменьшить их и должно получится, то что хотел.</p>]]></description>
			<author><![CDATA[null@example.com (Xion)]]></author>
			<pubDate>Fri, 18 Jul 2014 17:41:26 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=84891#p84891</guid>
		</item>
		<item>
			<title><![CDATA[Re: Помощь для скрипта на события мыши]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=84889#p84889</link>
			<description><![CDATA[<p>Могу предложить такой наглядный вариант:<br /></p><div class="codebox"><pre><code>
#SingleInstance Force
#NoEnv
ListLines Off
SetBatchLines -1
OnExit, Exit
OnMessage(0x200, &quot;WM_MOUSEMOVE&quot;)
VarSetCapacity(RECT, 16 ,0)
side := 50

Gui, -DPIScale +AlwaysOnTop -Caption +HWNDhThisGui +E0x08000000
Gui, Margin, 0, 0
Loop 9
    Gui, Add, Progress, % (Mod(A_Index+2, 3) ? &quot;x+0&quot; : &quot;x0&quot;)
        . &quot; y&quot; ((A_Index-1)//3)*(side ) &quot; h&quot; side &quot; w&quot; side &quot; cD9952F v&quot; A_Index, 100
Return

1::
    Gui, Show, NA
    WinSet, Transparent, 150, ahk_id %hThisGui%
    DllCall(&quot;GetWindowRect&quot;,&quot;uint&quot;,hThisGui,&quot;uint&quot;,&amp;RECT)
    DllCall(&quot;ClipCursor&quot;,&quot;uint&quot;,&amp;RECT)
    SetTimer, IsThisGui, 100
    Return

2::
Close: 
    Gui, Hide 
    SetTimer, IsThisGui, Off
    GuiControl, +cD9952F, % prArea 
    DllCall(&quot;ClipCursor&quot;), prArea := &quot;&quot;
    Return
    
Exit:
    DllCall(&quot;ClipCursor&quot;) 
    ExitApp

WM_MOUSEMOVE()   {
    Global prArea 
    Area := A_GuiControl
    If (Area = prArea)
        Return
    GuiControl, -Redraw, % prArea
    GuiControl, +cD9952F, % prArea
    GuiControl, +Redraw, % prArea 
    GuiControl, -Redraw, % Area
    GuiControl, +c696969, % Area
    GuiControl, +Redraw, % Area
    If (prArea != &quot;&quot; &amp;&amp; prArea != 5)
        Send(prArea, &quot;Up&quot;)
    prArea := Area
    If (Area != 5)
        Send(Area, &quot;Down&quot;)
} 

Send(n, mode)   {
    Static Send := [&quot;Up|Left&quot;, &quot;Up&quot;, &quot;Up|Right&quot;, &quot;Left&quot;, &quot;&quot;, &quot;Right&quot;, &quot;Left|Down&quot;, &quot;Down&quot;, &quot;Down|Right&quot;]
    This := StrSplit(Send[n], &quot;|&quot;)
    SendInput % &quot;{&quot; This[1] &quot; &quot; mode &quot;}&quot; (This[2] != &quot;&quot; ? &quot;{&quot; This[2] &quot; &quot; mode &quot;}&quot; : &quot;&quot;) 
} 

IsThisGui:
    MouseGetPos, , , WinID
    If (hThisGui = WinID) 
        Return
    GoTo Close
</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Fri, 18 Jul 2014 17:04:34 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=84889#p84889</guid>
		</item>
		<item>
			<title><![CDATA[Помощь для скрипта на события мыши]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=84887#p84887</link>
			<description><![CDATA[<p>Здравствуйте, уважаемые скриптописатели.<br />Прошу помощи в написании скрипта для мыши или в направлении куда копать. Из-за своей парализации, могу использовать только мышь и хотелось бы вспомнить старое и поиграть в ретро с приставок. С моими двух дневными знаниями АХК, меня хватило только на это:<br /></p><div class="codebox"><pre><code>sensitivity=20 ; настройка чувствительности
MouseGetPos,x1,y1 ; хватаем позицию курсора мыши
Sleep,180


Loop
{
  MouseGetPos,x2,y2 ; взять текущую позицию курсора
  ; назначаем разные действия по разнице начальных и конечных координат:

  If (x1-x2 &gt; sensitivity and y1-y2 &gt; sensitivity) ; вверх-влево
    {
      Send {Up down}{Left down}
      Send {Up up}{Left up}
      Gosub,ShowToolTip
      ;Goto,RemoveToolTip ; раскомментирование этой строки делает действие ОДНОКРАТНЫМ, иначе повторяетcя пока клавиша нажата
    }
  If (x1-x2 &lt; -sensitivity and y1-y2 &gt; sensitivity) ; вверх-вправо
    {
      Send {Up down}{Right down}
      Send {Up up}{Right up}
      Gosub,ShowToolTip
      ;Goto,RemoveToolTip
    }
  If (x1-x2 &gt; sensitivity and y1-y2 &lt; -sensitivity) ; вниз-влево
    {
      Send {Down down}{Left down}
      Sleep, 200
      Send {Down up}{Left up}
      Gosub,ShowToolTip
      ;Goto,RemoveToolTip
    }
  If (x1-x2 &lt; -sensitivity and y1-y2 &lt; -sensitivity) ; вниз-вправо
    {
      Send {Down down}{Right down}
      Sleep, 200
      Send {Down up}{Right up}
      Gosub,ShowToolTip
      ;Goto,RemoveToolTip
    }
  If (x1-x2 &lt; sensitivity and y1-y2 &gt; sensitivity) ; вверх
    {
      Send {Up down}
      Sleep, 200
      Send {Up up}
      Gosub,ShowToolTip
      ;Goto,RemoveToolTip
    }
  If (x1-x2 &lt; sensitivity and y1-y2 &lt; -sensitivity) ; вниз
    {
      Send {Down down}
      Sleep, 200
      Send {Down up}
      Gosub,ShowToolTip
      ;Goto,RemoveToolTip
    }
  If (x1-x2 &gt; sensitivity and y1-y2 &lt; sensitivity) ; влево
    {
      Send {Left down}
      Sleep, 200
      Send {Left up}
      Gosub,ShowToolTip
      ;Goto,RemoveToolTip
    }
  If (x1-x2 &lt; -sensitivity and y1-y2 &lt; sensitivity) ; вправо
    {
      Send {Right down}
      Sleep, 200
      Send {Right up}
      Gosub,ShowToolTip
      ;Goto,RemoveToolTip
    }
  
}

ShowToolTip: ; &quot;ПОКАЗУХА&quot;
; присваиваем конечные координаты начальным переменным
; для отслеживания изменения относительно нового положения курсора
  x1:=x2
  y1:=y2
  ToolTip %ShowAction% ; отображать ToolTip`ом название нажатой кнопке

RemoveToolTip:
  Sleep,100 ; задержка на отображение ToolTip
  ToolTip ; по истечении задержки убираем ToolTip
Return ; полный конец</code></pre></div><p>Код был взят с ранних примеров.</p><p>Что хотелось бы видеть:<br />1. При нажатии определённой клавиши, происходила фиксация курсора в центре экрана и от этой точки бы шли вычисления т.к. в коде выше курсор часто упирается в края.Ну и нужна соответственно, диактивация фиксации на другую кнопку.<br />2. Исчезновение курсора во время фиксации.<br />3. Плавность выполнения команд. Ибо с тем кодом всё происходит рывками...</p>]]></description>
			<author><![CDATA[null@example.com (Xion)]]></author>
			<pubDate>Fri, 18 Jul 2014 14:29:15 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=84887#p84887</guid>
		</item>
	</channel>
</rss>
