<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK: Определение изменений в определенной области экрана.]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=12800</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=12800&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: Определение изменений в определенной области экрана.».]]></description>
		<lastBuildDate>Wed, 12 Jul 2017 15:36:18 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: Определение изменений в определенной области экрана.]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=117231#p117231</link>
			<description><![CDATA[<p>Она недокументирована.</p>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Wed, 12 Jul 2017 15:36:18 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=117231#p117231</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Определение изменений в определенной области экрана.]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=117229#p117229</link>
			<description><![CDATA[<p>Спасибо, но я имею ввиду MSDN.</p>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Wed, 12 Jul 2017 15:24:56 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=117229#p117229</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Определение изменений в определенной области экрана.]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=117228#p117228</link>
			<description><![CDATA[<p>Вот это нашел:<br /><a href="https://source.winehq.org/WineAPI/RtlComputeCrc32.html">https://source.winehq.org/WineAPI/RtlComputeCrc32.html</a></p>]]></description>
			<author><![CDATA[null@example.com (powercat)]]></author>
			<pubDate>Wed, 12 Jul 2017 15:14:02 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=117228#p117228</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Определение изменений в определенной области экрана.]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=117227#p117227</link>
			<description><![CDATA[<p>Не нашёл описание &quot;NTDLL\RtlComputeCrc32&quot;.</p>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Wed, 12 Jul 2017 13:36:59 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=117227#p117227</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Определение изменений в определенной области экрана.]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=117222#p117222</link>
			<description><![CDATA[<p><strong>serzh82saratov</strong> достаточно хорошо работает, но smooth() успевает на какую-то долю секунды сработать перед задержкой. Я так понимаю мгновенно не получится из-за того, что ahk выполняется в одном потоке? Спасибо за помощь.</p>]]></description>
			<author><![CDATA[null@example.com (powercat)]]></author>
			<pubDate>Tue, 11 Jul 2017 20:46:03 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=117222#p117222</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Определение изменений в определенной области экрана.]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=117221#p117221</link>
			<description><![CDATA[<div class="codebox"><pre><code>
ChkSum := PixelChecksum( 880,23,10,10 )  
while GetKeyState(key,&quot;P&quot;) 
{		
    If ((T_ChkSum := PixelChecksum( 880,23,10,10 )) != ChkSum)  
		ChkSum := T_ChkSum, DllCall(&quot;Sleep&quot;,UInt,500)
	Else
		smooth(), DllCall(&quot;Sleep&quot;,UInt,0)
}
</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Tue, 11 Jul 2017 10:24:17 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=117221#p117221</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Определение изменений в определенной области экрана.]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=117212#p117212</link>
			<description><![CDATA[<div class="codebox"><pre><code>while GetKeyState(key,&quot;P&quot;) 
{		
    ChkSum := PixelChecksum( 880,23,10,10 )  
	DllCall(&quot;Sleep&quot;,UInt,0)
	smooth()
    if (PixelChecksum( 880,23,10,10 ) != ChkSum) 
    {
	DllCall(&quot;Sleep&quot;,UInt,500)
    }
	DllCall(&quot;Sleep&quot;,UInt,0)
}</code></pre></div><p>Все на что хватило ума. Работает, но опять же иногда Sleep 500 просто не применяется или применяется после того, как smooth() уже активна. Помогите довести до ума. В идеале нужно, чтобы после смены области ChkSum, smooth() выключался и вешался Sleep 500 только если зажата определенная клавиша, потом надо чтобы ChkSum запомнил новые пиксели в этих же координатах.</p>]]></description>
			<author><![CDATA[null@example.com (powercat)]]></author>
			<pubDate>Mon, 10 Jul 2017 18:40:42 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=117212#p117212</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Определение изменений в определенной области экрана.]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=117211#p117211</link>
			<description><![CDATA[<p>Точно. <br />Но всё же моя поправка имеет место быть?</p>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Mon, 10 Jul 2017 16:30:51 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=117211#p117211</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Определение изменений в определенной области экрана.]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=117210#p117210</link>
			<description><![CDATA[<p>И не будет работать, так как каждый раз в начале цикла вы заново присваиваете ChkSum := PixelChecksum( 880,23,10,10 ).</p>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Mon, 10 Jul 2017 16:23:26 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=117210#p117210</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Определение изменений в определенной области экрана.]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=117209#p117209</link>
			<description><![CDATA[<p><strong>serzh82saratov</strong> работает, но срабатывает не всегда. Не успевает каким то образом.</p>]]></description>
			<author><![CDATA[null@example.com (powercat)]]></author>
			<pubDate>Mon, 10 Jul 2017 14:57:34 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=117209#p117209</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Определение изменений в определенной области экрана.]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=117208#p117208</link>
			<description><![CDATA[<div class="codebox"><pre><code>if ( PixelChecksum( 880,23,10,10 ) != ChkSum ) </code></pre></div>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Mon, 10 Jul 2017 14:18:06 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=117208#p117208</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Определение изменений в определенной области экрана.]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=117206#p117206</link>
			<description><![CDATA[<p><strong>Malcev</strong>, спасибо работает. Только вот я не понимаю, где у меня ошибка. Тултип изменяется, а msgbox 1 и sleep не хотят отзываться.<br /></p><div class="codebox"><pre><code>while GetKeyState(key,&quot;P&quot;) 
{	
	ChkSum := PixelChecksum( 880,23,10,10 )
    tooltip % ChkSum
    DllCall(&quot;Sleep&quot;,UInt,0)
    if ( PixelChecksum( 880,23,10,10 ) = !ChkSum ) 
	    {
	        msgbox 1
	        Sleep 1000
	}
	smooth()
    DllCall(&quot;Sleep&quot;,UInt,delay)
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (powercat)]]></author>
			<pubDate>Mon, 10 Jul 2017 13:04:18 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=117206#p117206</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Определение изменений в определенной области экрана.]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=117199#p117199</link>
			<description><![CDATA[<p>Для обеих битностей.<br />У меня в своё время всё работало.<br /></p><div class="codebox"><pre><code>/*   __    __  __          __ __       __    __                 _       __                   
    / /_  / /_/ /_____  _ / // /____ _/ /_  / /________________(_)___  / /_ ____  _______
   / __ \/ __/ __/ __ \(_) // // __ &#039;/ __ \/ //_/ ___/ ___/ __/ / __ \/ __// __ \/ __/ _ \
  / / / / /_/ /_/ /_/ / / // // /_/ / / / / ,&lt; (__  ) /__/ / / / /_/ / /__/ /_/ / / / // / 
 /_/ /_/\__/\__/ .___(_) // / \__,_/_/ /_/_/|_/____/\___/_/ /_/ .___/\__(_)____/_/  \__ /  
              /_/     /_//_/                                 /_/                   (___/   
 
 http://ahkscript.org/boards/viewtopic.php?&amp;t=4431
__________________________________________________________________________________________
*/

PixelCheckSum( X, Y, W, H, Title := &quot;&quot; ) { ;               By SKAN,   http://goo.gl/X5dfvn
;                                                          CD:08/Jun/2009 | MD:01/Sep/2014

  Static DIBSECTION, SRCCOPY := 0x00CC0020, CAPTUREBLT := 0x40000000, BPP := 32
  Local hWnd, hDC, mDC, hBM, oBM, nSize, pBITMAPINFOHEADER, ppvBits := 0
  
  If not VarSetCapacity( DIBSECTION )
         VarSetCapacity( DIBSECTION, 104, 0 ) 
  
  pBITMAPINFOHEADER := &amp;DIBSECTION + ( A_PtrSize = 4 ? 24 : 32 )
  
  NumPut(  40, pBITMAPINFOHEADER +  0, &quot;UInt&quot;   ) 
  NumPut(   W, pBITMAPINFOHEADER +  4, &quot;UInt&quot;   )
  NumPut(   H, pBITMAPINFOHEADER +  8, &quot;UInt&quot;   )
  NumPut(   1, pBITMAPINFOHEADER + 12, &quot;UShort&quot; )
  NumPut( BPP, pBITMAPINFOHEADER + 14, &quot;UShort&quot; )

  hWnd  := WinExist( Title )
  hDC   := DllCall( &quot;GetDC&quot;, &quot;Ptr&quot;,hWnd, &quot;UPtr&quot; )
  mDC   := DllCall( &quot;CreateCompatibleDC&quot;, UInt,hDC, &quot;UPtr&quot; )

  hBM   := DllCall( &quot;CreateDIBSection&quot;, &quot;Ptr&quot;, mDC, &quot;Ptr&quot;, pBITMAPINFOHEADER, &quot;Int&quot;,0
                                      , &quot;PtrP&quot;,ppvBits, &quot;Ptr&quot;,0, &quot;Int&quot;,0, &quot;UPtr&quot; )
  
  oBM   := DllCall( &quot;SelectObject&quot;, &quot;Ptr&quot;,mDC, &quot;Ptr&quot;,hBM, &quot;UPtr&quot; )
  
  DllCall( &quot;BitBlt&quot;, &quot;Ptr&quot;,mDC, &quot;Int&quot;,0, &quot;Int&quot;,0, &quot;Int&quot;,W, &quot;Int&quot;,H, &quot;Ptr&quot;,hDC
                   , &quot;Int&quot;,X, &quot;Int&quot;,Y, &quot;UInt&quot;,SRCCOPY | CAPTUREBLT )

  DllCall( &quot;SelectObject&quot;, &quot;Ptr&quot;,mDC, &quot;Ptr&quot;,oBM )
  DllCall( &quot;DeleteDC&quot;,  &quot;Ptr&quot;,mDC )
  DllCall( &quot;ReleaseDC&quot;, &quot;Ptr&quot;,hWnd, &quot;Ptr&quot;,hDC )

  DllCall( &quot;GetObject&quot;, &quot;Ptr&quot;,hBM, &quot;Int&quot;,( A_PtrSize = 4 ? 84 : 104 ), &quot;Ptr&quot;,&amp;DIBSECTION )
  nSize := NumGet( pBITMAPINFOHEADER + 20, &quot;UInt&quot; ) 
  
Return DllCall( &quot;NTDLL\RtlComputeCrc32&quot;, &quot;UInt&quot;,0, &quot;Ptr&quot;,ppvBits, &quot;UInt&quot;,nSize, &quot;UInt&quot; )
     , DllCall( &quot;DeleteObject&quot;, &quot;Ptr&quot;,hBM )    
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Sun, 09 Jul 2017 20:35:56 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=117199#p117199</guid>
		</item>
		<item>
			<title><![CDATA[AHK: Определение изменений в определенной области экрана.]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=117197#p117197</link>
			<description><![CDATA[<p>Здравствуйте. В определенной области экрана находится картинка с цифрой белого цвета (0хFFFFFF). Периодически эта цифра меняется на другую цифру(тоже белого цвета), это и нужно определить. Нашел вот такой скрипт:<br /></p><div class="codebox"><pre><code>c:
coords := [[1033,23],[1044,23],[1032,36],[1044,36],[1038,35]
        ,[1038,23]] 
tooltip % res    
res := PixelChecksum(coords)

F::
Loop
{
    If (PixelChecksum(coords) != res)
	    { 
		    tooltip, изменилась
		    Sleep 5000
            goto c			
			return
        }        
            else
			tooltip, ne изменилась
		    return
            


    PixelChecksum(coords) {
    For k, v in coords
    {
        PixelGetColor, c, v[1], v[2]
        sum .= c &quot;|&quot;
    }
    Return sum
    }
}
return</code></pre></div><p>Он работает, но не так быстро как нужно. Скрипт ниже через GDIP у меня отказывается работать, да и он не универсальный, как пишут (только на х32 работает). Нужно чтобы и на х64 и на х32 все работало.<br /></p><div class="codebox"><pre><code>; Example - Wait for a Screen Region to change
ChkSum := PixelChecksum( 0,0,10,10 )
While % ( ChkSum = PixelChecksum( 0,0,10,10 ) )
  Sleep, 100
MsgBox, Screen Region Change Detected!
Return

PixelCheckSum( X, Y, W, H, Title ) {
 hWn := WinExist( Title ), hDC := DllCall( &quot;GetDC&quot;, UInt,hWn )
 mDC := DllCall( &quot;CreateCompatibleDC&quot;, UInt,hDC )
 NumPut( VarSetCapacity(BI,40,0),BI ), NumPut( W,BI,4 ) , NumPut( H,BI,8 )
 NumPut( 32,NumPut( 1,BI,12,&quot;UShort&quot; ),0,&quot;UShort&quot; )     , NumPut( 0,BI,16 )
 hBM := DllCall( &quot;CreateDIBSection&quot;, UInt,mDC, UInt,&amp;BI , Int,0, UIntP,pB, Int,0,Int,0 )
 oBM := DllCall( &quot;SelectObject&quot;, UInt,mDC, UInt,hBM )   , Rop := 0x40000000|0x00CC0020
 DllCall( &quot;BitBlt&quot;, UInt,mDC, Int,0,Int,0, Int,W,Int,H, UInt,hDC, Int,X,Int,Y, UInt,Rop )
 DllCall( &quot;shlwapi\HashData&quot;, UInt,pB, UInt,W*H*4, Int64P,Hash, UInt,8 )
 VarSetCapacity(HH,16,0), DllCall( &quot;msvcrt\sprintf&quot;, Str,HH, Str,&quot;%016I64X&quot;,UInt64,Hash )
 DllCall( &quot;DeleteObject&quot;, UInt,hBM ), DllCall( &quot;DeleteObject&quot;, UInt,oBM )
 DllCall( &quot;DeleteDC&quot;, UInt,mDC ), DllCall( &quot;ReleaseDC&quot;, UInt,hWn, UInt,hDC )
Return HH
}</code></pre></div><p>Как еще можно определить изменение цифры? Нужно чтобы детект был практически мгновенным.</p>]]></description>
			<author><![CDATA[null@example.com (powercat)]]></author>
			<pubDate>Sun, 09 Jul 2017 19:16:52 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=117197#p117197</guid>
		</item>
	</channel>
</rss>
