<?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=3290&amp;type=atom" />
	<updated>2016-08-22T23:13:16Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=3290</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Движение мыши по дуге]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=106986#p106986" />
			<content type="html"><![CDATA[<p>Если под плавным движением подразумевается то, что последовательные положения указателя находятся в соседних пикселах, то при изменении угла с шагом da&gt;1/R это в общем случае невозможно (т.к. полный оборот составляет 2PI радиан, а длина окружности — 2PI*R пикселов, то для перемещения на 1 пиксел требуется поворот на угол в 1/R радиан. Более того, это значение не помешало бы уменьшить вдвое, чтобы предусмотреть возможные погрешности округления машинной математики).</p><p>Скорость движения можно менять изменяя параметр Sleep. Если этой скорости не будет хватать, то придётся изменять положение «рывками» (с пропуском пикселей).</p>]]></content>
			<author>
				<name><![CDATA[wisgest]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=3850</uri>
			</author>
			<updated>2016-08-22T23:13:16Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=106986#p106986</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Движение мыши по дуге]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=106984#p106984" />
			<content type="html"><![CDATA[<p><strong>wisgest</strong>,<br />Скрипт хороший, но курсор двигается рывками при установке большего угла, например, при R = 100 и da = 8 / R. Желательно, чтобы курсор перемещался плавно и с изменяемой клавишами скоростью, радиус можно оставить фиксированным (допустим, в 100 px).</p>]]></content>
			<author>
				<name><![CDATA[Gector]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34109</uri>
			</author>
			<updated>2016-08-22T22:31:31Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=106984#p106984</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Движение мыши по дуге]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=106983#p106983" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>PI := atan(1)  * 4
works := 1
a := 0 ; угол поворота
da := 1 / R ; шаг изменения угла
Loop {
	Sleep 20
	if not works
		continue
	x := X0 + R * cos(a)
	y := Y0 + R * sin(a)
	MouseMove %x%, %y%
	a -= da
	if (a &lt; 0)
		a += 2 * PI
}
</code></pre></div><p><em><span class="bbu">23.08.2016</span>:</em> забыл, что в AHK нет встроенной константы <em>PI</em>, — исправил оплошность.</p>]]></content>
			<author>
				<name><![CDATA[wisgest]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=3850</uri>
			</author>
			<updated>2016-08-22T20:38:15Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=106983#p106983</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Движение мыши по дуге]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=106982#p106982" />
			<content type="html"><![CDATA[<p>Вот что получилось, но почему-то включение/выключение через F2 не работает и круг описывается курсором с разной скоростью. Нужно, чтобы курсор двигался равномерно и без пауз. Может кто знает, в чем дело?<br /></p><div class="codebox"><pre><code>
SetBatchLines -1
      SetMouseDelay 0
   ;начальные координаты и радиус
X0:=960
Y0:=540
R:=150

loop
{
  if works
  {
    sleep 1000
    continue
  }
  

x1:=x:=X0-R
y1:=y:=Y0
x2:=X0+R
mousemove, %x%, %y%
sleep 20
sleep 100
Loop
{
     mousemove, %x%, %y%
     x:= x+1
     y:= Y0+sqrt(R**2-(X0-x)**2)
     sleep 5
     If (x=x2) and (y=y1)
          Break
}
x:=x2
Loop
{
     x:= x-1
     y:= Y0-sqrt(R**2-(X0-x)**2)
     mousemove, %x%, %y%
     sleep 5
     If (x=x1) and (y=y1)
          Break
}
}
return

f2::
works:=!works
return

f4::
ExitApp
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Gector]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34109</uri>
			</author>
			<updated>2016-08-22T19:52:11Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=106982#p106982</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Движение мыши по дуге]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=106974#p106974" />
			<content type="html"><![CDATA[<p>Помогите изменить скрипт данный выше, чтобы курсор двигался вечно и с большей (изменяемой) скоростью. А также переключался с помощью F2:<br /></p><div class="codebox"><pre><code>
f2::
works:=!works
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Gector]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34109</uri>
			</author>
			<updated>2016-08-22T14:42:00Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=106974#p106974</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Движение мыши по дуге]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=41231#p41231" />
			<content type="html"><![CDATA[<p>Вот так вроде работает правильно</p><div class="codebox"><pre><code>   SetBatchLines -1
      SetMouseDelay 0
!t::
   ;начальные координаты и радиус
X0:=300
Y0:=330
R:=150


x1:=x:=X0-R
y1:=y:=Y0
x2:=X0+R
mousemove, %x%, %y%
sleep 20
MouseClick, left, , , , , D
sleep 100
Loop
{
     mousemove, %x%, %y%
     x:= x+1
     y:= Y0+sqrt(R**2-(X0-x)**2)
     If (x=x2) and (y=y1)
          Break
}
sleep 100
x:=x2
Loop
{
     x:= x-1
     y:= Y0-sqrt(R**2-(X0-x)**2)
     mousemove, %x%, %y%
     If (x=x1) and (y=y1)
          Break
}

MouseClick, left,,,,,U
   ExitApp</code></pre></div>]]></content>
			<author>
				<name><![CDATA[InFlames]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24849</uri>
			</author>
			<updated>2010-11-04T19:25:51Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=41231#p41231</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Движение мыши по дуге]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=24739#p24739" />
			<content type="html"><![CDATA[<p>В вашем примере<br />при радиусе &lt;100 получается полная полуокржность<br />при радиусе &gt;=100 получается неполная полуокружность<br />почему?</p><p>Хотя вот в таком коде чертится полная окружность<br /></p><div class="codebox"><pre><code>   !t::
   ;начальные координаты и радиус
X0:=300
Y0:=300
R:=100

sleep, 300

N:=X0-R
q:=ABS(N)

x:=N
y:=Y0
mousemove, %x%, %y%
MouseClick, left, , , , , D,
Loop, %q%
{
mousemove, %x%, %y%
x:= x+1
y:= Y0+sqrt(R**2-(X0-x)**2)
}

x:=N+q
Loop, %q%
{
x:= x-1
y:= Y0-sqrt(R**2-(X0-x)**2)
mousemove, %x%, %y%
}

MouseClick, left, , , , , U,
   return</code></pre></div>]]></content>
			<author>
				<name><![CDATA[InFlames]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24849</uri>
			</author>
			<updated>2009-06-12T07:44:11Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=24739#p24739</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Движение мыши по дуге]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=24737#p24737" />
			<content type="html"><![CDATA[<p>Поковырялся на ночь глядя, сам не очень понял что получилось <img src="//forum.script-coding.com/img/smilies/yikes.png" width="15" height="15" /> Может, пригодится. Следующий код должен начертить половину окружности (в Paint).<br /></p><div class="codebox"><pre><code>;начальные координаты и радиус
X0:=300
Y0:=300
R:=100

sleep, 3000

N:=X0-R
q:=ABS(N)

x:=N
y:=Y0

Loop, %q%
{
mousemove, %x%, %y%
x:= x+1
y:= Y0+sqrt(R**2-(X0-x)**2)
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2009-06-11T21:27:08Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=24737#p24737</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Движение мыши по дуге]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=24736#p24736" />
			<content type="html"><![CDATA[<p>x^2 + y^2 = R^2 это я помню, но вот реализовать это в AHK не могу</p>]]></content>
			<author>
				<name><![CDATA[InFlames]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24849</uri>
			</author>
			<updated>2009-06-11T21:13:04Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=24736#p24736</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Движение мыши по дуге]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=24731#p24731" />
			<content type="html"><![CDATA[<p>Вспомнить курс школьной геометрии <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" />.</p>]]></content>
			<author>
				<name><![CDATA[alexii]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=1844</uri>
			</author>
			<updated>2009-06-11T19:51:04Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=24731#p24731</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Движение мыши по дуге]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=24730#p24730" />
			<content type="html"><![CDATA[<p>Как сделать так, что бы мышь прошла по кругу? Например, нарисовать окружность в пеинте с помощью AHK</p>]]></content>
			<author>
				<name><![CDATA[InFlames]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24849</uri>
			</author>
			<updated>2009-06-11T19:37:28Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=24730#p24730</id>
		</entry>
</feed>
