Sign in to follow this  
Followers 0
lolp1

Is it Possible to do multible pixel checksums at once?

4 posts in this topic

Hello, I'm wondering if it is possible to run 2 pixel Check sums at the same time.

Here is a example from the help file

; Wait until something changes in the region 0,0 to 50,50

; Get initial checksum
$checksum = PixelChecksum(0,0, 50,50)

; Wait for the region to change, the region is checked every 100ms to reduce CPU load
While $checksum = PixelChecksum(0,0, 50, 50)
  Sleep(100)
WEnd

MsgBox(0, "", "Something in the region has changed!")

I wan't to run two of these, but at the same time! Is it possible?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hello, I'm wondering if it is possible to run 2 pixel Check sums at the same time.

Here is a example from the help file

; Wait until something changes in the region 0,0 to 50,50

; Get initial checksum
$checksum = PixelChecksum(0,0, 50,50)

; Wait for the region to change, the region is checked every 100ms to reduce CPU load
While $checksum = PixelChecksum(0,0, 50, 50)
  Sleep(100)
WEnd

MsgBox(0, "", "Something in the region has changed!")

I wan't to run two of these, but at the same time! Is it possible?

That's called multi-threading, and AutoIt doesn't support multi-threading. But if you search the forums you'll find that it is possible, but could have unforseen side-effects with the engine driving AutoIt.

Nomad :D

Edit: If you absolutely need these at the same time and don't want to multi-thread, you can create a second compiled script containing the second pixelchecksum and course of action and have it run at the same time as your main script.

Edited by Nomad

Share this post


Link to post
Share on other sites

you could also do 'virtual' multithreading with somthing like AdlibEnable() but that's like our 'virtual' multi-tasking processors, they just switch jobs really fast^^

Share this post


Link to post
Share on other sites

It doesn't sound like you want to run both at the same time, just check two regions at once which is a subtle difference :D

; Wait until something changes in the region 0,0 to 50,50 or 100, 100 to 200,200

; Get initial checksums
$checksum = PixelChecksum(0,0, 50,50)
$checksum2 = PixelChecksum(100,100, 200,200)

; Wait for the region to change, the region is checked every 100ms to reduce CPU load
While $checksum = PixelChecksum(0,0, 50, 50) And $checksum2 = PixelChecksum(100,100, 200, 200)
  Sleep(100)
WEnd

MsgBox(0, "", "Something in one of the regions has changed!")

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