Sign in to follow this  
Followers 0
tao

Having trouble with PixelCheckSum

5 posts in this topic

This is just a correction in topic to a post i made a little while ago. Just wanted my issue to be clear. Do not mean to spam...

I am currently working on my first project using AutoIt. I am new to the language.

I am experiencing problems using the PixelCheckSum function. It seems that even though there are drastic changes in the target area, the function is not registering the change, and returning the same value. Here is the relevant portion of my code:

global $checksum;

WinMinimizeAll();

$checksum = PixelChecksum(530,560, 590,580);

MsgBox(0, "Sum0", $checksum, 3);

Run("C:\Program Files\Wizards of the Coast\Magic Online III\Renamer.exe", "C:\Program Files\Wizards of the Coast\Magic Online III");

WinWaitActive("Magic Online 3.0"); ;Note: at this point, a large graphic pops up in the middle of the screen.

$checksum = PixelChecksum(530,560, 590,580);

MsgBox(0, "Sum1", $checksum, 3);

Both returned values are identical.

Now, I have tried some alternative coding to attempt to debug:

1) I've considered that my pixel range was for some reason not incorporating the huge graphic that pops up in the middle of the screen. I changed the range in checksum to (0,0, 1200, 700). There is still no change between the two function calls.

2) I've added a checksum call prior to minimizing all windows. In this case, there is a unique returned value prior to minimization (i.e. one taken while the script editor is still maximized). However, the value for the checksum of my desktop wallpaper, while different from the one taken of the script editor, still doesn't change after the target program is called and initialized (after the graphic pops up).

Any ideas???

Thanks,

Ben

Share this post


Link to post
Share on other sites



WinWaitActive("Magic Online 3.0")

...

may return prematurely to the graphic arising... and are both returns 0 or 16777215? It is important.

Lar.


f_mrcleansmalm_77ce002.jpgAutoIt has helped make me wealthy

Share this post


Link to post
Share on other sites

No. The return value is 417542457. If I put in several more CheckSums over time, they all come out the same, so I am pretty sure the graphic is up there...

Ben

Share this post


Link to post
Share on other sites

PixelCoordMode setting?


f_mrcleansmalm_77ce002.jpgAutoIt has helped make me wealthy

Share this post


Link to post
Share on other sites

PixelCoordMode is default.

I have tried some more troubleshooting. The code is below if you want to look at it. It basically splits the screen up into 16 sectors, takes a reading on each, then prints the results to notepad. It opens a application then repeats the process.

The really interesting thing is that when I compare my desktop wallpaper to, say, an open windows media player, the checksums are different in the expected sectors.

But not so when I compare my wallpaper to the much larger graphic imposed by the application I am really trying to work with (Magic Online)....In the latter case, it is as if the graphic is not there at all....really bizarre. I am pulling my hair out.

Ben

global $sum[4][4]

global $sum2[4][4]

WinMinimizeAll()

for $i = 0 to 3

for $j = 0 to 3

$sum[$i][$j] = PixelChecksum(300*$i+1, 200*$j+1, 300*($i+1), 200*($j+1))

Next

Next

WinActivate("Untitled - Notepad")

WinWaitActive("Untitled - Notepad")

for $i = 0 to 3

for $j = 0 to 3

send($sum[$i][$j])

send("{TAB}")

Next

Next

WinMinimizeAll()

WinActivate("Windows Media Player")

WinWaitActive("Windows Media Player")

Sleep(3000)

for $i = 0 to 3

for $j = 0 to 3

$sum2[$i][$j] = PixelChecksum(300*$i+1, 200*$j+1, 300*($i+1), 200*($j+1))

Next

Next

WinActivate("Untitled - Notepad")

WinWaitActive("Untitled - Notepad")

Sleep(1000)

send("{ENTER}{ENTER}");

for $i = 0 to 3

for $j = 0 to 3

send($sum2[$i][$j])

send("{TAB}")

Next

Next

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  
Followers 0