Harmonful

Send alarm when the pixel color change

15 posts in this topic

#1 ·  Posted (edited)

Hi there!!

Is it possible to do that when a pixel changes color an alarm sounds?:D

thx

Edited by Ryona

Share this post


Link to post
Share on other sites



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

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

were i put the Coordinates of the pixel?? :D

Edited by Ryona

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

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.

Share this post


Link to post
Share on other sites

it cant be something using pixelget color... if color is (hex number) soundplay...???

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

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.

Share this post


Link to post
Share on other sites

how i check that??

with a mouse position checker or something like that?

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Look this is an image of something i like

Posted Image

Share this post


Link to post
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.

Share this post


Link to post
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..


Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

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

 

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