Jump to content

FastFind library


Hawlong
 Share

Recommended Posts

please any one use FastFind library I have a problem in some functions like

FFNearestPixel , FFNearestSpot ,FFBestSpot All functions work but search at full screen

I want to search at a part of the screen how this can be done ,

Some examples from help file

FFBestSpot 


Searches a SnapShot for the area containing the best number of pixels of the given color, closest to the given point.


FFBestSpot ( SizeSearch, MinNbPixel, OptNbPixel, PosX, PosY, Color [, ShadeVariation [, ForceNewSnap [, Left [, Top [, Right [, Bottom [, NoSnapShot [, WindowHandle]]]]]]]] )


 

Parameters

SizeSearch The width and height of the area to search for. 
MinNbPixel Minimum number of pixels in the area. 
OptNbPixel Optimal number of pixels in the area. 
PosX X coordinate of proximity position. 
PosY Y coordinate of proximity position. 
Color Colour value of pixel to find (in decimal or hex). -1 to use the FastFind color list. 
ShadeVariation [optional] A number between 0 and 255 to indicate the allowed number of shades of variation of the red, green, and blue components of the colour. Default is 0 (exact match). 
ForceNewSnap [optional] If true, a new SnapShot will be made and the search will be done on that. Default is True. 
Left [optional] Left coordinate of the new SnapShot area. Default is 0. 
Top [optional] Top coordinate of the new SnapShot area. Default is 0. 
Right [optional] Right coordinate of the new SnapShot area. Default is 0. 
Bottom [optional] Bottom coordinate of the new SnapShot area. Default is 0. 
NoSnapShot [optional] SnapShot number. Determines which "slot" the new SnapShot will be stored in. 
WindowHandle [optional] Window handle to be used. 

 

Return Value

Success: Returns a three-element array of area's coordinates and number of pixels found. (Array[0] = x, Array[1] = y, Array[2] = Number of pixels found). 
Failure: Returns 0 and sets @ERROR 

 

Remarks

This feature is similar to FFNearestSpot, but will perform a more extensive search to try to find the area with the best number of "right" pixels.

First, this function will try to find a spot with at least the optimal number of pixels of the specified color, returning the one closest to PosX, PosY. If there is no area with the optimal number of pixels (or more), it will look for the spot with the highest number of pixels of the specified color, over the minimum acceptable amount.

If it cannot find an area with at least the minimum number of pixels of the specified color, it will try the same two searches again, but now with ShadeVariation as set in the parameter (if this parameter is not 0).

Setting the Color parameter to -1 will cause the search to match on any color in the FastFind color list.

A new SnapShot will be saved in the default slot if ForceNewSnap remains True.


 

Example


#include "FastFind.au3"

$FFhWnd = WinGetHandle("[ACTIVE]")
FFSetWnd($FFhWnd)
FFSnapShot()

Local $aCoords = FFBestSpot(20, 25, 150, 0, 0, 0x00FFFFFF, False)

If Not @error Then
    MsgBox(0, "Coords", $aCoords[0] & ", " & $aCoords[1])
Else
    MsgBox(0, "Coords", "Match not found.")
EndIf
FFNearestPixel 

Searches a SnapShot for a pixel of the given color, closest to the given point.


FFNearestPixel ( PosX, PosY, Color [, ForceNewSnap [, Left [, Top [, Right [, Bottom [, NoSnapShot [, WindowHandle]]]]]]] )


 

Parameters

PosX X coordinate of proximity position. 
PosY Y coordinate of proximity position. 
Color Colour value of pixel to find (in decimal or hex). -1 to use the FastFind color list. 
ForceNewSnap [optional] If true, a new SnapShot will be made and the search will be done on that. Default is True. 
Left [optional] Left coordinate of the new SnapShot area. Default is 0. 
Top [optional] Top coordinate of the new SnapShot area. Default is 0. 
Right [optional] Right coordinate of the new SnapShot area. Default is 0. 
Bottom [optional] Bottom coordinate of the new SnapShot area. Default is 0. 
NoSnapShot [optional] SnapShot number. Determines which "slot" the new SnapShot will be stored in. 
WindowHandle [optional] Window handle to be used. 

 

Return Value

Success: Returns a two-element array of pixel's coordinates. (Array[0] = x, Array[1] = y). 
Failure: Returns 0 and sets @ERROR 

 

Remarks

This function works like PixelSearch, except that instead of returning the first pixel found, it returns the closest to a given position. Setting the Color parameter to -1 will cause the search to match on any color in the FastFind color list.

A new SnapShot will be saved in the default slot unless ForceNewSnap is set to false.



Example


#include "FastFind.au3"

$FFhWnd = WinGetHandle("[ACTIVE]")
FFSetWnd($FFhWnd)
FFSnapShot()

Local $aCoords = FFNearestPixel(50, 20, 0x00FFFFFF, False)

If Not @error Then
    MsgBox(0, "Coords", $aCoords[0] & ", " & $aCoords[1])
Else
    MsgBox(0, "Coords", "Match not found.")
EndIf
FFNearestSpot 


Searches a SnapShot for an area containing a minimum number of pixels of the given color, closest to the given point.


FFNearestSpot ( SizeSearch, NbPixel, PosX, PosY, Color [, ShadeVariation [, ForceNewSnap [, Left [, Top [, Right [, Bottom [, NoSnapShot [, WindowHandle]]]]]]]] )


 

Parameters

SizeSearch The width and height of the area to search for. 
NbPixel Minimum number of pixels in the area. 
PosX X coordinate of proximity position. 
PosY Y coordinate of proximity position. 
Color Colour value of pixel to find (in decimal or hex). -1 to use the FastFind color list. 
ShadeVariation [optional] A number between 0 and 255 to indicate the allowed number of shades of variation of the red, green, and blue components of the colour. Default is 0 (exact match). 
ForceNewSnap [optional] If true, a new SnapShot will be made and the search will be done on that. Default is True. 
Left [optional] Left coordinate of the new SnapShot area. Default is 0. 
Top [optional] Top coordinate of the new SnapShot area. Default is 0. 
Right [optional] Right coordinate of the new SnapShot area. Default is 0. 
Bottom [optional] Bottom coordinate of the new SnapShot area. Default is 0. 
NoSnapShot [optional] SnapShot number. Determines which "slot" the new SnapShot will be stored in. 
WindowHandle [optional] Window handle to be used. 

 

Return Value

Success: Returns a three-element array of area's coordinates and number of pixels found. (Array[0] = x, Array[1] = y, Array[2] = Number of pixels found). 
Failure: Returns 0 and sets @ERROR 

 

Remarks

The coordinates returned specify the barycenter (center of mass) of the area found.

If more than one acceptable area exists within the SnapShot, this function will return the one closest to PosX, PosY. This is useful for finding clusters of pixels of a particular color. Setting the Color parameter to -1 will cause the search to match on any color in the FastFind color list.

A new SnapShot will be saved in the default slot if ForceNewSnap remains True.


 

Related

FFSnapShot, FFAddColor, FFAddExcludedArea, FFGetPixel, FFNearestPixel, FFBestSpot 
 

Example


#include "FastFind.au3"

$FFhWnd = WinGetHandle("[ACTIVE]")
FFSetWnd($FFhWnd)
FFSnapShot()

Local $aCoords = FFNearestSpot(10, 25, 0, 0, 0x00FFFFFF, False)

If Not @error Then
    MsgBox(0, "Coords", $aCoords[0] & ", " & $aCoords[1])
Else
    MsgBox(0, "Coords", "Match not found.")
EndIf

 

Link to comment
Share on other sites

I use this example to Search in part of the screen

#include "FastFind.au3"
$FFhWnd = WinGetHandle("[ACTIVE]")
FFSetWnd($FFhWnd)
FFSnapShot()

$aCoords= FFNearestSpot ( 1,1,0,0, 0x000000 ,0, True ,455,52,948,326  )

If Not @error Then
    MsgBox(0, "Coords", $aCoords[0] & ", " & $aCoords[1])
Else
    MsgBox(0, "Coords", "Match not found.")
EndIf

when i run this examble

I want to search at a part of the screen ,

but the problem search at  full screen

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