<?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=10767&amp;type=atom" />
	<updated>2015-07-13T19:12:32Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.script-coding.com/viewtopic.php?id=10767</id>
		<entry>
			<title type="html"><![CDATA[Re: Возможные решения отслеживания движения объекта.(АНК)]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=95431#p95431" />
			<content type="html"><![CDATA[<p>Ошибка-обнаружена ошибка AutoHotKey 64.... и вес комп уходит в дикие тормоза , да так , что до снятие процесса через диспетчер дойти нереально и лечится перезагрузкой системы..</p><div class="codebox"><pre><code>
#Include gdip_All.ahk
Width :=1920 
Height := 1080
DiameterColor := 0xff00ff00   ; цвет диаметра
DiameterThickness := 2  ; толщина диаметра
CoordMode, Pixel, Screen
CoordMode, Mouse, Screen
oGraph := new Graphics(0, 0, Width, Height)




~^LButton:: 
if m!=2
 {
 MouseGetPos, X1, Y1
 x1 := X1
 y1 := Y1
 m=2
 exit
 }

if m!=1
 {
 MouseGetPos, X2, Y2
 x2 := X2
 y2 := Y2
 m=1
 w1:=Abs(x2-x1)
 h1:=Abs(y2-y1)
 
 X:=x1, Y:=y1, W:=w1, H:=h1
 
 If !pToken := Gdip_Startup()
        Throw &quot;Ошибка GDI+!  Убедитесь в наличии gdiplus.dll в вашей системе!&quot;
    chdc := CreateCompatibleDC(), hbm := CreateDIBSection(w, h, chdc)
    obm := SelectObject(chdc, hbm), hhdc := GetDC()
    BitBlt(chdc, 0, 0, w, h, hhdc, x, y,  0x40000000|0x00CC0020)
    ReleaseDC(hhdc), FileName := &quot;d:\s1.png&quot;  
    pBitmap := Gdip_CreateBitmapFromHBITMAP(hbm) 
    SelectObject(chdc, obm), DeleteObject(hbm), DeleteDC(hhdc), DeleteDC(chdc)  
    Gdip_SaveBitmapToFile(pBitmap, FileName), Gdip_DisposeImage(pBitmap), Gdip_Shutdown(pToken)

  Gui, +LastFound +ToolWindow -Caption +AlwaysOnTop 
  Gui, Color, 354EA3
  Gui, Show, x%X% y%Y% w%W% h%H% NA 
  WinSet, Transparent, 130 
  sleep 500
  Gui,  Hide
 xz:=X
 yz:=Y


;~ESC::Exit
sleep 3000   
ImageSearch, xF, yF, 100, 100, 1720, 900, *TransBlack *n250 *wn-1 *hn-1 *40 d:\s1.png
 
      MsgBox % &quot;Найдено&quot; xF &quot;х&quot; yF &quot;предыдущие &quot; xz &quot;х&quot; yz
      ;sleep 5000
  

 
 } 









class Graphics
{
   __New(GuiX, GuiY, Width, Height)  {
      static WS_EX_LAYERED := 0x80000, WS_EX_TRANSPARENT := 0x20
      
      Pi := 4*(4*ATan(1/5) - ATan(1/239))
      this.Gr := Pi/180
      this.Width := Width
      this.Height := Height
      
      this.pToken := Gdip_Startup()
      Gui, Graphics:Default
      Gui, % &quot;-Caption +E&quot; WS_EX_LAYERED &quot; +ToolWindow +AlwaysOnTop +hwndhGui -DPIScale&quot;
      this.hGui := hGui
      Gui, Show, NA x%GuiX% y%GuiY% w%Width% h%Height%
      
      this.GraphicObjects := []
      this.CreateNewGraphicObj(Width, Height)
   }
   
   __Delete()  {
      this.GraphicObjects := &quot;&quot;
      Gdip_Shutdown(this.pToken)
   }
   
   __Get(key)  {
      if RegExMatch(key, &quot;i)(G|hdc)(\d+)&quot;, match)
         Return this.GraphicObjects[match2][match1]
   }
   
   CreateNewGraphicObj(Width, Height)  {
      GrObj := new this.NewGraphicObj(Width, Height)
      Return this.GraphicObjects.Push(GrObj)
   }  
  
   DrawDiameter(color, thickness,x1, y1, x2, y2)  {
      Gdip_GraphicsClear(this.G1, ARGB=0x00ffffff)
      Gr := this.Gr
      pPen := Gdip_CreatePen(color, thickness)
      Gdip_DrawLine(this.G1, pPen, x1, y1, x2, y2)
      Gdip_DeletePen(pPen)
      UpdateLayeredWindow(this.hGui, this.hdc1)
   }
   
      DrawCircle(color, CX, CY, R)  {
      pBrush := Gdip_BrushCreateSolid(color)
      Gdip_FillEllipse(this.G1, pBrush, CX, CY , 2*R, 2*R)
      Gdip_DeleteBrush(pBrush)
      UpdateLayeredWindow(this.hGui, this.hdc1)
   }
   
   
   class NewGraphicObj
   {
      __New(Width, Height)  {
         this.hbm := CreateDIBSection(Width, Height)
         this.hdc := CreateCompatibleDC()
         this.obm := SelectObject(this.hdc, this.hbm)
         this.G := Gdip_GraphicsFromHDC(this.hdc)
         Gdip_SetSmoothingMode(this.G, 4)
      }
      
      __Delete()  {
         SelectObject(this.hdc, this.obm), DeleteObject(this.hbm)
         DeleteDC(this.hdc), Gdip_DeleteGraphics(this.G)
      }
   }
}
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Lelik]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=33186</uri>
			</author>
			<updated>2015-07-13T19:12:32Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=95431#p95431</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Возможные решения отслеживания движения объекта.(АНК)]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=95424#p95424" />
			<content type="html"><![CDATA[<p><strong>Lelik</strong>, приведите код в том виде, в котором его используете. Какая ошибка?</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2015-07-13T19:05:40Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=95424#p95424</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Возможные решения отслеживания движения объекта.(АНК)]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=95421#p95421" />
			<content type="html"><![CDATA[<p><span style="color: green"><strong>Доктор ТуамОсес</strong>, ознакомьтесь с <a href="http://forum.script-coding.com/viewtopic.php?id=6148">этой</a> темой, исправьте оформление ссылки.</span></p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2015-07-13T19:02:58Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=95421#p95421</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Возможные решения отслеживания движения объекта.(АНК)]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=95407#p95407" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>Поиск изображения занимает какое-то время</p></blockquote></div><p><a href="http://forum.script-coding.com/viewtopic.php?pid=94811#p94811">http://forum.script-coding.com/viewtopi … 811#p94811</a></p>]]></content>
			<author>
				<name><![CDATA[Доктор ТуамОсес]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=31413</uri>
			</author>
			<updated>2015-07-13T18:19:22Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=95407#p95407</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Возможные решения отслеживания движения объекта.(АНК)]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=95367#p95367" />
			<content type="html"><![CDATA[<p>Странно удалил все кроме поиска скана участкаэкрана и потом его поискана всем экране, но через некоторое время вылетает ошибка AHK 64</p>]]></content>
			<author>
				<name><![CDATA[Lelik]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=33186</uri>
			</author>
			<updated>2015-07-13T06:05:57Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=95367#p95367</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Возможные решения отслеживания движения объекта.(АНК)]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=95239#p95239" />
			<content type="html"><![CDATA[<p>Повторюсь, ImageSearch всегда ищет именно на экране. Код ваш теперь только в понедельник смогу посмотреть.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2015-07-10T18:27:55Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=95239#p95239</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Возможные решения отслеживания движения объекта.(АНК)]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=95236#p95236" />
			<content type="html"><![CDATA[<p>Раньше открывал файл отскриненный.<br />Вот сделал вырезание с экрана(по кодам с форума).</p><div class="codebox"><pre><code>If !pToken := Gdip_Startup()
        Throw &quot;Ошибка GDI+!  Убедитесь в наличии gdiplus.dll в вашей системе!&quot;
    chdc := CreateCompatibleDC(), hbm := CreateDIBSection(w, h, chdc)
    obm := SelectObject(chdc, hbm), hhdc := GetDC()
    BitBlt(chdc, 0, 0, w, h, hhdc, x, y,  0x40000000|0x00CC0020)
    ReleaseDC(hhdc), FileName := &quot;d:\s1.png&quot;  
    pBitmap := Gdip_CreateBitmapFromHBITMAP(hbm) 
    SelectObject(chdc, obm), DeleteObject(hbm), DeleteDC(hhdc), DeleteDC(chdc)  
    Gdip_SaveBitmapToFile(pBitmap, FileName), Gdip_DisposeImage(pBitmap), Gdip_Shutdown(pToken)</code></pre></div><p> а дальше идет код поиска (просто тупо команда:<br /></p><div class="codebox"><pre><code>ImageSearch, xF, yF, 100, 100, 1720, 900, *TransBlack *n250 *wn-1 *hn-1 d:\s1.png</code></pre></div><p> И в итоге постоянно вылетает ошибка AutoHotKey, почему не пойму(причем после второго к примеру запроса в скрипте на поиск.<br />PS-нужны ли какието директивы для ImageSearch показывающие что надо искать на экране , ну или подобное, я использовал без всяких директив, может изза этого вылетает?</p>]]></content>
			<author>
				<name><![CDATA[Lelik]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=33186</uri>
			</author>
			<updated>2015-07-10T16:51:56Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=95236#p95236</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Возможные решения отслеживания движения объекта.(АНК)]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=95229#p95229" />
			<content type="html"><![CDATA[<p>А как вы до этого-то искали?</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2015-07-10T13:46:12Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=95229#p95229</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Возможные решения отслеживания движения объекта.(АНК)]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=95217#p95217" />
			<content type="html"><![CDATA[<p>Извините, я просто не на ты с АНК,как передать скрипту что надо искать на текущем экране?</p>]]></content>
			<author>
				<name><![CDATA[Lelik]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=33186</uri>
			</author>
			<updated>2015-07-10T05:37:09Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=95217#p95217</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Возможные решения отслеживания движения объекта.(АНК)]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=95216#p95216" />
			<content type="html"><![CDATA[<p>Посредством ImageSearch. Она и ищет на экране, а в файле только искомое изображение.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2015-07-10T05:27:31Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=95216#p95216</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Возможные решения отслеживания движения объекта.(АНК)]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=95215#p95215" />
			<content type="html"><![CDATA[<p>ХМ...честно говоря я не знаю, как так сделать, как вы говорите, это я про поиск на реальном экране без сохранения его тоже в файл. Не подскажите посредством чего это можно реализовать?</p>]]></content>
			<author>
				<name><![CDATA[Lelik]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=33186</uri>
			</author>
			<updated>2015-07-10T05:25:32Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=95215#p95215</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Возможные решения отслеживания движения объекта.(АНК)]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=95214#p95214" />
			<content type="html"><![CDATA[<p>Всё равно не понял, экран-то зачем сохранять. Ищем-то не в скриншоте, а на реальном экране. Изображение, которое ищется, обязательно должно быть в файле, как требует описание команды.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2015-07-10T05:16:20Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=95214#p95214</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Возможные решения отслеживания движения объекта.(АНК)]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=95213#p95213" />
			<content type="html"><![CDATA[<p>Извиняюсь за косноязычие.Я делал следующим образом-выделял область на экране которая мне интересна и перемещение которой нужно отслеживать(т.е. часть объекта или целиком объект), сохранял в файл.Далее сохранял экран.И тогда уже производил поиск через ImageSearch.Через 250 мс заново делал&nbsp; сохранение экрана и уже в новом сохранении искал.И так по циклу.</p>]]></content>
			<author>
				<name><![CDATA[Lelik]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=33186</uri>
			</author>
			<updated>2015-07-10T05:02:56Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=95213#p95213</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Возможные решения отслеживания движения объекта.(АНК)]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=95212#p95212" />
			<content type="html"><![CDATA[<p>Не понял вопроса. Про какой файл идёт речь? И область у нас только одна — та, которая определяется параметрами <em>X1, Y1, X2, Y2</em>.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2015-07-10T04:55:01Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=95212#p95212</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Возможные решения отслеживания движения объекта.(АНК)]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=95210#p95210" />
			<content type="html"><![CDATA[<p>А&nbsp; &nbsp;не подскажите , есть ли возможность искомую область и ту в которой ведется поиск не заносить в файл для обработки?</p>]]></content>
			<author>
				<name><![CDATA[Lelik]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=33186</uri>
			</author>
			<updated>2015-07-10T04:30:29Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=95210#p95210</id>
		</entry>
</feed>
