Sign in to follow this  
Followers 0
notakiller

Problem With Pixelsearch And Closing Command

5 posts in this topic

Hi i tried this command

$coord = PixelSearch(0, 0, 744, 479, 0xD2DAE4 or 0xDBE2F0)

and it does work without the "or 0xDBE2F0" but with it nothing works >< what would be the correct combination :)

AND

i cant find the command to set a key to terminate the program :( i looked all over the help file ... says nothing :D

thanks guys

Share this post


Link to post
Share on other sites



HotKeySet( "{Esc}", "exit_now" )

Func exit_now()
    Exit
EndFunc

this code will cause the script to terminate when Esc is presed

to do the pixel search, search for each one seperately. Look at PixelSearch in the helpfile/documentation for information on what PixelSearch returns on success/fail.


_____________________________________________________"some people live for the rules, I live for exceptions"Wallpaper Changer - Easily Change Your Windows Wallpaper

Share this post


Link to post
Share on other sites

You will need to use a If...Then...EndIf statement to use multiple values.

Something like...

$coord0 = PixelSearch(0, 0, 744, 479, 0xD2DAE4)
$coord1 = PixelSearch(0, 0, 744, 479, 0xDBE2F0)

If $coord0 = "something" OR $coord1 = "something" Then
  ; do these commands
EndIf

Hope that helps,

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

You'll either have to use a Shade variation but if that is too much, and it needs to be specifically that then I would do the most common color first and run 2 options. This would be the only way I would think that the native functions would do it properly, downside is that it would take 2 searches sometimes, so speed could be an issue:

$coord = _DualPixSearch(0, 0, 744, 479, 0xD2DAE4, 0xDBE2F0)

Func _DualPixSearch($i_xStart, $i_yStart, $i_xEnd, $i_yEnd, $i_Color1, $i_Color2, $i_ShadeVariation = 0, $i_Step = 1)
    Local $a_PixCoord = ''
    $a_PixCoord = PixelSearch($i_xStart, $i_yStart, $i_xEnd, $i_yEnd, $i_Color1, $i_ShadeVariation, $i_Step)
    If @error Then
        $a_PixCoord = PixelSearch($i_xStart, $i_yStart, $i_xEnd, $i_yEnd, $i_Color2, $i_ShadeVariation, $i_Step)
    EndIf
    If IsArray($a_PixCoord) Then Return $a_PixCoord
    SetError(1)
    Return 0
EndFunc


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Thx guys :) helps alot :( you all rule :D

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