Jump to content

PixelChecksum always return 0


lvv
 Share

Recommended Posts

Hi there,

I want to catch some changes on the window using PixelChecksum.

But it always return 0. Is there anything wrong with this code:

Run("notepad.exe")

WinWaitActive("Untitled - Notepad")

Send("This is some text.")

Dim $pos = WinGetPos("Untitled - Notepad")

$checksum = PixelChecksum($pos[0],$pos[1], 50,50)

MsgBox(0, "", $pos[0] & " " & $pos[1] & " " & $checksum)

Thanks

Link to comment
Share on other sites

Maybe...

Opt("MouseCoordMode", 2)        ;1=absolute, 0=relative, 2=client
Opt("PixelCoordMode", 2)        ;1=absolute, 0=relative, 2=client


Run("notepad.exe")
WinWaitActive("Untitled - Notepad")
$checksum = PixelChecksum(0,0, 50,50)

Send("This is some text.")
Sleep(200)

If $checksum <> PixelChecksum(0,0, 50,50) Then
    MsgBox(0, "Yes", $checksum)
Else    
    MsgBox(0, "No", $checksum)
EndIf

**** TESTED

8)

NEWHeader1.png

Link to comment
Share on other sites

Still got some problem:

Here is my code, I want to install office 2007. (the last page has same handle, title, no text)

So I want to use PixelChecksum to see the if there is sth changed .

The result is that PixelChecksum always return 0. :)

; after select components, click install.

Send("!i")

Sleep(1000*60*10)

Opt("MouseCoordMode", 2) ;1=absolute, 0=relative, 2=client

Opt("PixelCoordMode", 2) ;1=absolute, 0=relative, 2=client

If( Not WinActive("Microsoft Office Professional Plus 2007")) Then

WinActivate("Microsoft Office Professional Plus 2007")

EndIf

$file = FileOpen("c:\test.txt", 1)

$checksum = PixelChecksum(275,175,50,50)

FileWriteLine($file,$checksum)

While ($checksum == PixelChecksum(275,175,50,50))

FileWriteLine($file, PixelChecksum(275,175,50,50))

Sleep(5000)

WEnd

FileWriteLine($file , "End")

;WinWaitActive("Microsoft Office Professional Plus 2007","has been successfully installed")

Sleep(200)

Send("!c")

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...