Jump to content

Send alarm when the pixel color change


Harmonful
 Share

Recommended Posts

$checksum = PixelChecksum(0, 0, 5, 5)

While 1
    If PixelChecksum(0, 0, 5, 5) <> $checksum Then
        SoundPlay(@WindowsDir & "\Media\notify.wav", 1)
        ExitLoop
    EndIf
    Sleep(100)
WEnd

Note: If \Media\notify.wav doesn't exist in the windows directory change it to a different sound file.

The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again.

Link to comment
Share on other sites

  • Developers

click on the PixelChecksum in the example and just read the page shown for all needed info.

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

In the first four parameters for pixelchecksum. It can either be a single pixel, or a box. The parameters I put in the second post have it checking a box of 5*5 pixels at the top left of your screen. If you wanted to check the very top left pixel you could do this.

$checksum = PixelChecksum(0, 0, 0, 0)

While 1
    If PixelChecksum(0, 0, 0, 0) <> $checksum Then
        SoundPlay(@WindowsDir & "\Media\notify.wav", 1)
        ExitLoop
    EndIf
    Sleep(100)
WEnd
Edited by Hawkwing

The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again.

Link to comment
Share on other sites

Well, it could, but he doesn't care about what color the pixel changes too, just that it changes. So I thought I'd post code with pixelchecksum since you can also check a box of pixels.

Edit: I am so unobservant. Didn't notice you were the op. :D

Edited by Hawkwing

The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again.

Link to comment
Share on other sites

Not sure I know what your talking about. If your wandering how to check a box of pixels with pixelchecksum look at post #2.

The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again.

Link to comment
Share on other sites

In that case you would want to use pixelgetcolor since the bar looks like it is shaded and has more than 1 color.

While 1
    If PixelGetColor( $x, $y , $winhandle) = $color Then
        SoundPlay(@WindowsDir & "\Media\notify.wav", 1)
        ExitLoop
    EndIf
    Sleep(100)
WEnd

The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again.

Link to comment
Share on other sites

If ide seen this topic,

I dont think ive would have helped.

Your asking on this topic how and if you can even do it,

Then in another topic your asking for us to make it...

Tsk tsk, maybe i need sleep but sounds like you want us to make

this and you r new member as of today..

Link to comment
Share on other sites

I probably wouldn't have either normally. I guess I'm just feeling especially nice today.

Note to new members: If you actually try something yourself and post code, people are a lot more likely to help you.

The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again.

Link to comment
Share on other sites

  • 7 years later...

Could anyone say how to get this to repeat more than once? The code works for when the color changes, but stops working if the color is changed again the second time. I tried injecting a for loop, but the alarm stops working. 

$checksum = PixelChecksum(0, 0, 5, 5)

For $i = 5 To 1 Step -1
    If PixelChecksum(0, 0, 5, 5) <> $checksum Then
        SoundPlay(@WindowsDir & "\Media\notify.wav", 1)
        ExitLoop
    EndIf
    Sleep(100)
Next

 

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...