<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; Как правильно написать код, запоминающий нажатие клавиши?]]></title>
	<link rel="self" href="http://forum.script-coding.com/extern.php?action=feed&amp;tid=10943&amp;type=atom" />
	<updated>2015-10-06T14:05:44Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.script-coding.com/viewtopic.php?id=10943</id>
		<entry>
			<title type="html"><![CDATA[Re: Как правильно написать код, запоминающий нажатие клавиши?]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=97931#p97931" />
			<content type="html"><![CDATA[<p>А типо бот можно записать маршрут автобуса чтоль?</p>]]></content>
			<author>
				<name><![CDATA[Dimasik-Sk]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=33387</uri>
			</author>
			<updated>2015-10-06T14:05:44Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=97931#p97931</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Как правильно написать код, запоминающий нажатие клавиши?]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=97398#p97398" />
			<content type="html"><![CDATA[<p>Большое спасибо!&nbsp; Разобрался в коде)</p>]]></content>
			<author>
				<name><![CDATA[GrayFox1]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=33347</uri>
			</author>
			<updated>2015-09-13T19:50:20Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=97398#p97398</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Как правильно написать код, запоминающий нажатие клавиши?]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=97389#p97389" />
			<content type="html"><![CDATA[<p>Вот пытался когда-то:<br /></p><div class="codebox"><pre><code>#SingleInstance,Force
AutoTrim,Off
CoordMode,Mouse,Screen
CoordMode,ToolTip
CoordMode,Pixel
Menu,Tray,UseErrorLevel
process,priority,,high
;SendMode,input
SetBatchLines,-1
SetControlDelay,0
SetKeyDelay,-1
SetTitleMatchMode,2
SetWinDelay,20
SetWorkingDir,%A_ScriptDir%
StringCaseSense,On
DetectHiddenWindows,On

SetFormat, IntegerFast, h

vkod:={&quot;~*del&quot;:&quot;vk2e down&quot;,&quot;~*up&quot;:&quot;vk26 down&quot;,&quot;~*Down&quot;:&quot;vk28 down&quot;,&quot;~*left&quot;:&quot;vk25 down&quot;,&quot;~*right&quot;:&quot;vk27 down&quot;,&quot;~*ins&quot;:&quot;vk2d down&quot;,&quot;~*home&quot;:&quot;vk24 down&quot;,&quot;~*end&quot;:&quot;vk23 down&quot;,&quot;~*pgup&quot;:&quot;vk21 down&quot;,&quot;~*pgdn&quot;:&quot;vk22 down&quot;,&quot;~*del up&quot;:&quot;vk2e up&quot;,&quot;~*up up&quot;:&quot;vk26 up&quot;,&quot;~*Down up&quot;:&quot;vk28 up&quot;,&quot;~*left up&quot;:&quot;vk25 up&quot;,&quot;~*right up&quot;:&quot;vk27 up&quot;,&quot;~*ins up&quot;:&quot;vk2d up&quot;,&quot;~*home up&quot;:&quot;vk24 up&quot;,&quot;~*end up&quot;:&quot;vk23 up&quot;,&quot;~*pgup up&quot;:&quot;vk21 up&quot;,&quot;~*pgdn up&quot;:&quot;vk22 up&quot;}

timecorrection:=0

Loop, 0xFF
{
  if (A_Index=0x79 or A_Index=0x7a or A_Index=0x7b)
    continue
  Hotkey,% &quot;~*vk&quot; . A_Index . &quot; down&quot;,Label,On T0
  Hotkey,% &quot;~*vk&quot; . A_Index . &quot; up&quot;,Label,On
}

  Hotkey,~*del,Label,On T0
  Hotkey,~*up,Label,On T0
  Hotkey,~*Down,Label,On T0
  Hotkey,~*left,Label,On T0
  Hotkey,~*right,Label,On T0
  Hotkey,~*ins,Label,On T0
  Hotkey,~*home,Label,On T0
  Hotkey,~*end,Label,On T0
  Hotkey,~*pgup,Label,On T0
  Hotkey,~*pgdn,Label,On T0

  Hotkey,~*del up,Label,On T0
  Hotkey,~*up up,Label,On T0
  Hotkey,~*Down up,Label,On T0
  Hotkey,~*left up,Label,On T0
  Hotkey,~*right up,Label,On T0
  Hotkey,~*ins up,Label,On T0
  Hotkey,~*home up,Label,On T0
  Hotkey,~*end up,Label,On T0
  Hotkey,~*pgup up,Label,On T0
  Hotkey,~*pgdn up,Label,On T0
Return

Label:
critical
;tooltip,%a_tickcount%`n%A_ThisHotkey%`n%a_priorhotkey%
if (A_ThisHotkey=a_priorhotkey)
  return
time:=a_tickcount-oldtime
if A_ThisHotkey not contains vk
  key:=vkod[A_ThisHotkey]
else
  key:=RegExreplace(A_ThisHotkey, &quot;~\*(vk)0x(.*)&quot;, &quot;$1$2&quot; )

if waittocontinue=1
{
  if key contains up
    waittocontinue=0
  return
}

if play=1
  oldrec:=rec
play=

count++
if (time&lt;0x11)
  time-=time
rec%count%:=time-timecorrection

count++
rec%count%:=key
;t.=time &quot;|&quot; key &quot;|&quot;
;tooltip,%a_tickcount%`n%A_ThisHotkey%`n%a_priorhotkey%

;ToolTip,&quot;%key%&quot;`n%A_TimeSincePriorHotkey%
oldtime:=a_tickcount
Return

;if vk&lt;7 save coords

f10::  ; rec
tooltip
oldtime:=a_tickcount
rec=
play=
count=
t=
return

F12::  ; play
PlayRec=
play=1
loop,% count
{
;  critical
;tooltip,% A_loopfield &quot;`n&quot; play &quot;`n&quot; Play
  if play=
    break
  Play:=rec%a_index%
  if (a_index &amp; 1)
  {
    if Play=wait
    {
      tooltip,Нажми любую кнопку чтобы продолжить.
      waittocontinue=1
      while waittocontinue
        sleep,10
      tooltip
    }
    else if (Play&gt;0 and oldPlay!=&quot;wait&quot;)
      DllCall(&quot;Sleep&quot;,UInt,Play)
    oldPlay:=Play
  }
  else
    send,{%Play%}
  PlayRec%a_index%:=Play
  c:=a_index
}
play=0
;loop,% c
;  rec%a_index%:=PlayRec%a_index%
return

F11::  ; play old
count++
rec%count%=wait
count++
rec%count%=vk07 up

;fileappend,%t%,Rec
;play=1
;loop,c
;{
;;  critical
;;tooltip,% A_loopfield &quot;`n&quot; play &quot;`n&quot; key
;  if play=
;    break
;  key:=PlayRec%a_index%
;  if (a_index &amp; 1)
;  {
;    if key&gt;0
;      DllCall(&quot;Sleep&quot;,UInt,key)
;  }
;  else
;    send,{%key%}
;}
;play=0
return



</code></pre></div><p>F10 - запись.<br />F12 - воспроизведение.</p>]]></content>
			<author>
				<name><![CDATA[Alectric]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=26027</uri>
			</author>
			<updated>2015-09-13T12:46:09Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=97389#p97389</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Как правильно написать код, запоминающий нажатие клавиши?]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=97377#p97377" />
			<content type="html"><![CDATA[<p>Пытаюсь создать&nbsp; скрипт,&nbsp; который будет запоминать нажатие клавиши (действия), к примеру вождение машины (эмуляция),&nbsp; &nbsp; для gta samp,&nbsp; а после будет их воспроизводить. Пытался сделать с помощью макроса,&nbsp; тоже не вышло. Нужна ваша помощь. Заранее спасибо!</p>]]></content>
			<author>
				<name><![CDATA[GrayFox1]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=33347</uri>
			</author>
			<updated>2015-09-12T11:14:00Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=97377#p97377</id>
		</entry>
</feed>
