Jump to content

Problem With Pixelsearch And Closing Command


Recommended Posts

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

Link to comment
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

Link to comment
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)

Link to comment
Share on other sites

  • Moderators

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

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.

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