Jump to content
Sign in to follow this  
BrookieDragon

If Then with GetPixel fail?

Recommended Posts

BrookieDragon

OK, I'm trying to create a script exit via opening the Windows start menu (vista) and matching the white in the info box there.

Basically...have the script running, running, running, hit the windows key, start menu opens, white background of the recently used programs list is shown, script stops. (got stuck in a few infinite loops earlier where I had no control over the mouse to manually close the script)

I made a little test script to work on this, but for the life of me, I can not get this to work. Anyone see anything blaring'ly wrong?

$i = 1

Do

if PixelGetColor(252,980) = "FFFFFF" Then

Send ("o")

Sleep(300)

EndIf

Send ("x")

Sleep(200)

Until $i = 2

I usually just test this with notepad up to see whats being written. I have yet to get an "o". Edited by BrookieDragon

Share this post


Link to post
Share on other sites
Uriziel01

pixelGetColor isnt returning hex value, you should change:

if PixelGetColor(252,980) = "FFFFFF" Then

to:

if hex(PixelGetColor(252,980),6) = "FFFFFF" Then

:)

Edited by Uriziel01

Share this post


Link to post
Share on other sites
BrookieDragon

Thanks much, I was thinking my problem was with that. Cause all the script samples used something other then what the Autoit windows info tool was returning.

Is there an easy way to get hex using the window tool?

pixelGetColor isnt returning hex value, you should change:

if PixelGetColor(252,980) = "FFFFFF" Then

to:

if hex(PixelGetColor(252,980),6) = "FFFFFF" Then

:)

Share this post


Link to post
Share on other sites
Uriziel01

just get decimal value of color and use

if PixelGetColor(252,980) = hex(716259,6) Then

in this example you color value was 716259


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  

×