Sign in to follow this  
Followers 0
Souls

PixelGetColor help

11 posts in this topic

Ok, I have a problem with PixelGetColor script. What can i do to make a script that check an entire horizontal line?

I have an idea but i dont know if it works:

If (PixelGetColor (465) = 0xFFA500) Then
    Exit

Will that check all the horizontal line 465 for that color, and if it finds it will it exit the program?

Ok second problem: I found a new script (for me) it is PixelSearch

Can I use Pixel check to check a screen rectangle and if in the rectangle appears the color0xFFA500 can it close the program?

thx in advance

Share this post


Link to post
Share on other sites



Ok, I have a problem with PixelGetColor script. What can i do to make a script that check an entire horizontal line?

I have an idea but i dont know if it works:

If (PixelGetColor (465) = 0xFFA500) Then
    Exit

Will that check all the horizontal line 465 for that color, and if it finds it will it exit the program?

Ok second problem: I found a new script (for me) it is PixelSearch

Can I use Pixel check to check a screen rectangle and if in the rectangle appears the color0xFFA500 can it close the program?

thx in advance

for $n = 0 to $screenwid - 1

if PixelGetColor($n,465) = $SearchCol then exitloop

next


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

I didn't understand T_T

Share this post


Link to post
Share on other sites

But it sais that PixelChecksum only checks if something has changed in the area, I need one that stops the program when certain color appears

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

But it sais that PixelChecksum only checks if something has changed in the area, I need one that stops the program when certain color appears

You may calculate PixelChecksum before. And if some color changes then also PixelChecksum will return changed number.

EDIT: sorry maybe you are right and it's not proper solution for your needs.

Edited by Zedna

Share this post


Link to post
Share on other sites

I didn't understand T_T

for $n = 0 to $screenwid - 1

if PixelGetColor($n,465) = $SearchCol then exitloop

next

This will check along the line at row 465 one pixel at a time from the left to the end. You need When the search color is found it will stop searching.

I should have used @DesktopWidth - 1 instead of $screenwid, and said $SearchCol = 0xFFA500.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

OMG ppl i think this guy is more uncertain what to do now then before.

1st of all the function is Pixelgetcolor(x,y) . 465 is for sure not a coordonate. Second of all PixelGetColor is returning a decimal value and u are trying to compare it with a hex value >.<

Also u can use

PixelSearch(x, y,x,y 0xFFA500, 5) ; same x and y as before (u can also use an interval)

If NOT @error Then EXIT

PS: if u wanna search it on a line or column then use martin's example or for PixelSearch just don't keep x or y equales

EX: pixelsearch(1,465,1024,465,0xFFA500, 5)

Edited by Dizzydbd

Share this post


Link to post
Share on other sites

OMG ppl i think this guy is more uncertain what to do now then before.

1st of all the function is Pixelgetcolor(x,y) . 465 is for sure not a coordonate.

What planet are you from? Even though his syntax might have been incorrect, this is assuredly an y-coordinate.

In case you didn't notice, that syntax error was corrected in the first reply.

Second of all PixelGetColor is returning a decimal value and u are trying to compare it with a hex value >.<

Correct. @OP: If you wish to match Hex values, use the Hex() or Dec() functions.

Also u can use

PixelSearch(x, y,x,y 0xFFA500, 5) ; same x and y as before (u can also use an interval)

If NOT @error Then EXIT

It is a bad habit to treat @error as a boolean value.

@OP:

$search = PixelSearch(0, 465, @DesktopWidth, 465, $color)
If IsArray($search) Then Exit

PS: if u wanna search it on a line or column then use martin's example or for PixelSearch just don't keep x or y equales

EX: pixelsearch(1,465,1024,465,0xFFA500, 5)

Martin's example was right on the nose, but your post is confusing since it refers to PixelSearch, not PixelGetColor such as Martin demonstrated. Your example is correct, if the screen's horizontal resolution is 1024 pixels. @DesktopWidth (also suggested by Martin) seems like a better option to me. In conclusion, Martin's posts showed a viable solution. I think only you were confused. :P

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]

Share this post


Link to post
Share on other sites

actually i'm making game's scripts for some time and PixelSearch is best to use over PixelGetColor. And i wasn't confused at all ... i just didn't read all the posts entirely :P

Share this post


Link to post
Share on other sites

actually i'm making game's scripts for some time and PixelSearch is best to use over PixelGetColor. And i wasn't confused at all ... i just didn't read all the posts entirely :P

Why would searching an area vs. searching 1 pixel be best? If you can accomplish the test on just a single pixel then it is more efficient.

Kohr

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