Jump to content
Sign in to follow this  
majiangtian

Why does the checksum value of the region of a window changes when the window moves to a another location

Recommended Posts

majiangtian

$t="迅雷"
WinActivate($t)
MouseMove(@DesktopWidth,@DesktopHeight,0)
Sleep(1000)
$r=WinGetPos($t)
ConsoleWrite("postion 0 checksum=" & PixelChecksum($r[0],$r[1],$r[0]+$r[2]-1,$r[1]+$r[3]-1) & @CRLF)
WinMove($t,"",$r[0]-15,$r[1]-15,$r[2],$r[3])
Sleep(1000)
$r=WinGetPos($t)
ConsoleWrite("postion 1 checksum=" & PixelChecksum($r[0],$r[1],$r[0]+$r[2]-1,$r[1]+$r[3]-1) & @CRLF)

Share this post


Link to post
Share on other sites
martin

That's a good question.

I played with that a bit and found (On my XP laptop at least) that if you make sure your rectangle doesn't go outside

 Left + 1, Top + 5, Right - 1, Bottom - 1

then it works as expected, otherwise the results don't appear to make sense. I can't see what changes in the borders when the window is moved.

Here is what I used. (Of course you must make sure that the whole window stays within the desktop.)

$l = 1
$p = 5
$g = 1
$b = 1

opt("pixelcoordmode",1)
$t = "Untitled - Notepad"
WinActivate($t)
MouseMove(@DesktopWidth,@DesktopHeight,1)
Sleep(1000)
$r=WinGetPos($t)
ConsoleWrite("postion 0 checksum=" & PixelChecksum($r[0]+$l,$r[1]+$p,$r[0]+$r[2]-$g,$r[1]+$r[3]-$b) & @CRLF)
WinMove($t,"",$r[0]-15,$r[1]-15);,$r[2],$r[3])
Sleep(1000)
$r=WinGetPos($t)
ConsoleWrite("postion 0 checksum=" & PixelChecksum($r[0]+$l,$r[1]+$p,$r[0]+$r[2]-$g,$r[1]+$r[3]-$b) & @CRLF)
Edited by martin

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×