<?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=15603&amp;type=atom" />
	<updated>2020-08-19T21:03:00Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=15603</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Подсчет пути, проделанного курсом мыши.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=141781#p141781" />
			<content type="html"><![CDATA[<p>Alectric, спасибо.</p>]]></content>
			<author>
				<name><![CDATA[Ragnar Lodbrokovitch]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39591</uri>
			</author>
			<updated>2020-08-19T21:03:00Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=141781#p141781</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Подсчет пути, проделанного курсом мыши.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=141762#p141762" />
			<content type="html"><![CDATA[<p><a href="http://www.script-coding.com/AutoHotkey/Exit.html">Exit</a><br /></p><div class="quotebox"><cite>Справка пишет:</cite><blockquote><p>Выход из текущего потока или (<strong>если</strong> скрипт не резидентный, т.е. не содержит директиву #Persistent, и <strong>не содержит горячих клавиш</strong>) из скрипта в целом.</p></blockquote></div><p>Этот Exit работает как Return. Условно говоря.<br />Тебе нужен <a href="http://www.script-coding.com/AutoHotkey/ExitApp.html">ExitApp</a>.</p>]]></content>
			<author>
				<name><![CDATA[Alectric]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26027</uri>
			</author>
			<updated>2020-08-18T13:14:55Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=141762#p141762</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Подсчет пути, проделанного курсом мыши.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=141751#p141751" />
			<content type="html"><![CDATA[<p>Alectric, а выйти как из этой программы ?<br />Почему Exit здесь не срабатывает ?<br /></p><div class="codebox"><pre><code>

#NoEnv
#SingleInstance,Force
SetBatchLines,-1
CoordMode,Mouse,Screen



F1::
off := 1
mousegetpos,oldx,oldy
Loop
{
  If off = 1
  {
    sleep,10
    mousegetpos,x,y
    var+=Sqrt(abs(x-oldx)**2+abs(y-oldy)**2)
    oldx:=x
    oldy:=y
    ;tooltip,% var
  }
  else
    break

}
return

F2::
off := 0


;msgbox,Замени меня на FileAppend. Мышка проехала %var% пикселей.
FileDelete %A_Scriptdir%\пробег мыши.txt
FileAppend, %var%, %A_ScriptDir%\пробег мыши.txt
Exit

;Return
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Ragnar Lodbrokovitch]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39591</uri>
			</author>
			<updated>2020-08-18T03:23:03Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=141751#p141751</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Подсчет пути, проделанного курсом мыши.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=141745#p141745" />
			<content type="html"><![CDATA[<p><a href="http://www.script-coding.com/AutoHotkey/FileDelete.html">FileDelete</a></p>]]></content>
			<author>
				<name><![CDATA[Alectric]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26027</uri>
			</author>
			<updated>2020-08-17T15:36:41Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=141745#p141745</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Подсчет пути, проделанного курсом мыши.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=141743#p141743" />
			<content type="html"><![CDATA[<p>Получился скрипт:<br /></p><div class="codebox"><pre><code>
#NoEnv
#SingleInstance,Force
SetBatchLines,-1
CoordMode,Mouse,Screen

F1::
off := 1
mousegetpos,oldx,oldy
Loop
{
  If off = 1
  {
    sleep,10
    mousegetpos,x,y
    var+=Sqrt(abs(x-oldx)**2+abs(y-oldy)**2)
    oldx:=x
    oldy:=y
    tooltip,% var
  }
  else
    break

}
return

F2::
off := 0

;msgbox,Замени меня на FileAppend. Мышка проехала %var% пикселей.
FileAppend, %var%, %A_ScriptDir%\пробег мыши.txt
Return
</code></pre></div><p>Он в целом работает, но выводит результаты при периодическом использовании :<br />4472.7224186636.588887<br />То есть в одну кучу их кидает в txt.<br />Как поменять этот код, чтобы итоговый результат - перезаписывал бы старый результат, а после нажатия F2 и записи в файл - скрипт закрывался бы ?</p>]]></content>
			<author>
				<name><![CDATA[Ragnar Lodbrokovitch]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39591</uri>
			</author>
			<updated>2020-08-17T06:39:40Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=141743#p141743</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Подсчет пути, проделанного курсом мыши.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=141713#p141713" />
			<content type="html"><![CDATA[<p>Второй цикл здесь лишний. И чтобы завершить цикл нужно выполнить команду <a href="http://www.script-coding.com/AutoHotkey/CommandList.html">break</a>.<br /></p><div class="codebox"><pre><code>
#NoEnv
#SingleInstance,Force
SetBatchLines,-1
CoordMode,Mouse,Screen



F1::
off := 1
mousegetpos,oldx,oldy
Loop
{
  If off = 1
  {
    sleep,10
    mousegetpos,x,y
    var+=Sqrt(abs(x-oldx)**2+abs(y-oldy)**2)
    oldx:=x
    oldy:=y
    tooltip,% var
  }
  else
    break
}
return

F2::
off := 0
msgbox,Замени меня на FileAppend. Мышка проехала %var% пикселей.
Return

</code></pre></div><div class="quotebox"><cite>Ragnar Lodbrokovitch пишет:</cite><blockquote><p>не по клавише F1</p></blockquote></div><p>Потому-что в условии так написано <em>&quot;If off = 0&quot;</em> - <em>&quot;если переменная &quot;off&quot; равна нулю&quot;</em>.<br /></p><div class="quotebox"><cite>Ragnar Lodbrokovitch пишет:</cite><blockquote><p>записью результата в txt</p></blockquote></div><p>Нужно выполнить <a href="http://www.script-coding.com/AutoHotkey/FileAppend.html">FileAppend</a> в момент выключения.</p>]]></content>
			<author>
				<name><![CDATA[Alectric]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26027</uri>
			</author>
			<updated>2020-08-16T03:20:24Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=141713#p141713</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Подсчет пути, проделанного курсом мыши.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=141712#p141712" />
			<content type="html"><![CDATA[<p><strong>Alectric</strong><br />Вот у меня получился такой код.<br /></p><div class="codebox"><pre><code>
#NoEnv
#SingleInstance,Force
SetBatchLines,-1
CoordMode,Mouse,Screen



F1::
off := 1
Loop
{
mousegetpos,oldx,oldy
If off = 0

loop
{
  sleep,10
  mousegetpos,x,y
  var+=Sqrt(abs(x-oldx)**2+abs(y-oldy)**2)
  oldx:=x
  oldy:=y
  tooltip,% var
}


}
return

F2::
off := 0
Return

</code></pre></div><p>Правда включается он не по клавише F1, а почему-то по клавише F2. <br />И выключить с записью результата в txt - не получается.</p><p>Подскажите - как это сделать ?</p>]]></content>
			<author>
				<name><![CDATA[Ragnar Lodbrokovitch]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39591</uri>
			</author>
			<updated>2020-08-16T02:34:57Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=141712#p141712</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Подсчет пути, проделанного курсом мыши.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=141706#p141706" />
			<content type="html"><![CDATA[<p><strong>Alectric</strong>, уверены что я язвлю?<br />Просто отмечаю что вы дали без объяснения готовый код, который неполностью удовлетворяет заказу ТС.<br />Что интереснее, теперь вы сами ответили ему в духе &quot;изучай, пробуй, показывай код&quot;.</p>]]></content>
			<author>
				<name><![CDATA[stealzy]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=31937</uri>
			</author>
			<updated>2020-08-15T18:52:09Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=141706#p141706</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Подсчет пути, проделанного курсом мыши.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=141705#p141705" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>stealzy пишет:</cite><blockquote><p><strong>Alectric</strong>, недоделали работу! <img src="//forum.script-coding.com/img/smilies/big_smile.png" width="15" height="15" /></p></blockquote></div><p>Если честно, надоели ваши подколки и язвление. Прекратите язвить, пожалуйста.</p><div class="quotebox"><cite>Ragnar Lodbrokovitch пишет:</cite><blockquote><p>как подключить на подсчет пути - клавиши</p></blockquote></div><p><a href="https://google.gik-team.com/?q=site%3Aforum.script-coding.com+ahk+%D0%B2%D0%BA%D0%BB%D1%8E%D1%87%D0%B8%D1%82%D1%8C+%D0%BF%D0%BE+%D0%BA%D0%BB%D0%B0%D0%B2%D0%B8%D1%88%D0%B5">Изучай.</a> Пробуй. Если не получится - показывай свой код, подскажем.</p>]]></content>
			<author>
				<name><![CDATA[Alectric]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26027</uri>
			</author>
			<updated>2020-08-15T17:13:41Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=141705#p141705</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Подсчет пути, проделанного курсом мыши.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=141703#p141703" />
			<content type="html"><![CDATA[<p><strong>Alectric</strong>, недоделали работу! <img src="//forum.script-coding.com/img/smilies/big_smile.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[stealzy]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=31937</uri>
			</author>
			<updated>2020-08-15T15:14:21Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=141703#p141703</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Подсчет пути, проделанного курсом мыши.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=141700#p141700" />
			<content type="html"><![CDATA[<p>Alectric, а как подключить на подсчет пути - клавиши -&nbsp; F1 для запуска, и F2 для записи результата в txt</p>]]></content>
			<author>
				<name><![CDATA[Ragnar Lodbrokovitch]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39591</uri>
			</author>
			<updated>2020-08-15T13:42:19Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=141700#p141700</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Подсчет пути, проделанного курсом мыши.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=141698#p141698" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>
#NoEnv
#SingleInstance,Force
SetBatchLines,-1
CoordMode,Mouse,Screen

mousegetpos,oldx,oldy

loop
{
  sleep,10
  mousegetpos,x,y
  var+=Sqrt(abs(x-oldx)**2+abs(y-oldy)**2)
  oldx:=x
  oldy:=y
  tooltip,% var
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Alectric]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26027</uri>
			</author>
			<updated>2020-08-15T09:14:00Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=141698#p141698</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Подсчет пути, проделанного курсом мыши.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=141695#p141695" />
			<content type="html"><![CDATA[<p><strong>Ragnar Lodbrokovitch</strong>, это я и так понимаю. А цель-то какая преследуется?</p>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2020-08-15T07:45:42Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=141695#p141695</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Подсчет пути, проделанного курсом мыши.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=141694#p141694" />
			<content type="html"><![CDATA[<p><strong>stealzy</strong> мышка ходит например - по кругу или восьмеркой.<br />Ну какие тут отрезки ?</p>]]></content>
			<author>
				<name><![CDATA[Ragnar Lodbrokovitch]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39591</uri>
			</author>
			<updated>2020-08-15T07:26:05Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=141694#p141694</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Подсчет пути, проделанного курсом мыши.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=141693#p141693" />
			<content type="html"><![CDATA[<p><strong>ypppu</strong>, чтобы общий пробег определить.<br />Вот кстати похожая программа:</p>]]></content>
			<author>
				<name><![CDATA[Ragnar Lodbrokovitch]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39591</uri>
			</author>
			<updated>2020-08-15T07:23:28Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=141693#p141693</id>
		</entry>
</feed>
