Jump to content

Recommended Posts

Posted

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?

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
  • Administrators
Posted

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!")


 

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
×
×
  • Create New...