FastFind

Introduction

FastFind is an advanced pixel search library for AutoIt scripts. It replaces and improves upon the functionality of the standard AutoIt pixel search functions, PixelGetColor and PixelSearch, allowing for more complex searches to be performed at much faster speeds.

It consists of a .dll file that contains the pixel searching logic, and an AutoIt wrapper file, which acts as an interface between your AutoIt script and the DLL. To start using FastFind, simply copy the files into the same folder as your script, and insert #include "FastFind.au3" near the top of your script file. You will then be able to reference the FastFind functions listed in this help file.

Required Files:

FastFind.au3 | AutoIt wrapper (include)
FastFind.dll | Library for 32bit systems
FastFind64.dll | Library for 64bit systems

How FastFind Works

One of the reasons FastFind is so much quicker than AutoIt's native pixel search functions is it's use of SnapShots. A SnapShot is basically a pixel map of a specified area on screen as it looked at the time the SnapShot was taken. This pixel information is stored in active memory, which means your script can access it much, much faster than the time it would take to make a new pixel request from the screen. Once a SnapShot is taken, search operations can be performed on that SnapShot until that memory is freed or overwritten.

It is possible to retain up to 1024 different SnapShots simultaneously, but storing an 800x600 SnapShot will divert about 1.8MB of available RAM, so the size and quantity of SnapShots in use at any given time should be kept to a minimum.

FastFind pixel search functions will automatically take a new SnapShot and store it in the default 'slot' when they are called, unless you specify otherwise in the function parameters. This will cause a previous SnapShot to be overwritten if it is also stored in the default 'slot'. Check the individual function help pages for more details and instructions on how to change this behavior.

More advanced operations can be performed with the pixel search functions by maintaining a list of colors and exclusion zones.


Function FFAddColor

Function Reference

FFAddColor

Add one or more colors to the color list maintained by FastFind.

FFAddColor ( NewColor )

Parameters

NewColor Color value or an array of color values.

Return Value

Success: | Returns 1
Failure: | Returns 0

Remarks

The color list can be used when calling search functions, to search for multiple colors instead of one.

Related

FFRemoveColor, FFResetColors, FFNearestPixel, FFNearestSpot, FFBestSpot

Example

#include "FastFind.au3"

Local $aColorArray[2] = [0x00FFFFFF, 0x00000000]

FFAddColor($aColorArray)
FFAddColor(0x00FF0000)


Function FFAddExcludedArea

Function Reference

FFAddExcludedArea

Adds an exclusion zone.

FFAddExcludedArea ( x1, y1, x2, y2 )

Parameters

x1 | Left coordinate of exlusion area.
y1 | Top coordinate of exlusion area.
x2 | Right coordinate of exlusion area.
y2 | Bottom coordinate of exlusion area.

Return Value

Success: | Returns 1
Failure: | Returns 0

Remarks

Exclusion zones are used to restrict the search area in the FastFind search functions. It is possible to have up to 1024 rectangles of exclusion, thereby precisely removing any search area. Once set, the exclusion zones will apply to all FastFind searches until they're reset.

Related

FFResetExcludedAreas, FFIsExcluded, FFNearestPixel, FFNearestSpot, FFBestSpot


Function FFGetPixel

Function Reference

FFApplyFilterOnSnapShot

Applies an AND filter on each pixels in the SnapShot.

FFApplyFilterOnSnapShot ( Red, Green, Blue [, NoSnapShot ] )

Parameters

Red | Filter to apply on the Red Chanel. Value are in [0, 255] range : 0 will completely remove the Red component on each pixel. 255 will not change the Red component.
Green | Filter to apply on the Green Chanel. Value are in [0, 255] range : 0 will completely remove the Green component on each pixel. 255 will not change the Green component.
Blue | Filter to apply on the Blue Chanel. Value are in [0, 255] range : 0 will completely remove the Blue component on each pixel. 255 will not change the Blue component.
NoSnapShot | [optional] SnapShot number. Default is the most recent SnapShot taken.

Return Value

Success: | Returns the color value of the pixel.
Failure: | Returns -1 and sets @ERROR

Remarks

You can use this function to lower color resolution (number of useful bits per pixel) : FFApplyFilterOnSnapShot ( 0xF0, 0xF0, 0xF0) for instance will keep only 12 bits / pixels instead of 24.
With FFDuplicateSnapShot, it can also split Red, Green and Blue components on different Snapshots.

Related

FFSnapShot, FFDuplicateSnapShot, FFSaveBMP, FFSaveJPG


Function FFBestSpot

Function Reference

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.

Related

FFSnapShot, FFAddColor, FFAddExcludedArea, FFGetPixel, FFNearestPixel, FFNearestSpot

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


Function FFColorCount

Function Reference

FFColorCount

Counts the number of pixels of a given color in a SnapShot.

FFColorCount ( ColorToCount, [ShadeVariation [, ForceNewSnap [, Left [, Top [, Right [, Bottom [, NoSnapShot [, WindowHandle]]]]]]]] )

Parameters

ColorToCount | Colour value of pixels to count (in decimal or hex).
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 count 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 the number of matching pixels
Failure: | Returns False

Remarks

None.

Related

FFSnapShot


Function FFGetPixel

Function Reference

FFComputeMeanValues

Gives mean Red, Green and Blue values, useful for detecting changed areas.

FFComputeMeanValues ( [ NoSnapShot ] )

Parameters

NoSnapShot [optional] SnapShot number. Default is the most recent SnapShot taken.

Return Value

Success: | It returns an array with: [0]: Mean Red [1]: Mean Green [2]: Mean Blue
Failure:: | Returns -1 and sets @ERROR

Remarks

None.

FFSnapShot


Function FFDrawSnapShot

Function Reference

FFDrawSnapShot

Draws the SnapShot back onto the screen.

FFDrawSnapShot ( [ NoSnapShot ] )

Parameters

NoSnapShot [optional] SnapShot number. Default is the most recent SnapShot taken.

Return Value

Success: | Returns 1
Failure: | Returns 0 and sets @ERROR

Remarks

The SnapShot will be drawn on the same Window and position it was taken from, and will include modifications.

Related

FFDrawSnapShotXY, FFSnapShot, FFSetPixel, FFKeepChanges, FFKeepColor


Function FFDrawSnapShot

Function Reference

FFDrawSnapShotXY

Draws the SnapShot back onto the screen, with specific top-left screen position for drawing.

FFDrawSnapShotXY ( X, Y [, NoSnapShot ])

Parameters

X | Left position (screen coordinates).
Y | Top position (screen coordinates).
NoSnapShot | [optional] SnapShot number. Default is the most recent SnapShot taken.

Return Value

Success: | Returns 1
Failure: | Returns 0 and sets @ERROR

Remarks

The SnapShot will be drawn at the given top-left position on the screen, and will include modifications.

Related

FFDrawSnapShot, FFSnapShot, FFSetPixel, FFKeepChanges, FFKeepColor


Function FFDuplicateSnapShot

Function Reference

FFDuplicateSnapShot

Makes a copy of a SnapShot.

FFDuplicateSnapShot ( NoSnapShotSrc, NoSnapShotDst )

Parameters

NoSnapShotSrc | The "slot" number of the source SnapShot.
NoSnapShotDst | The destination "slot" number where the duplicate SnapShot will be stored.

Return Value

Success: | Returns 1
Failure: | Returns 0 and sets @ERROR

Remarks

None.

Related

FFSnapShot


Function FFGetLastError

Function Reference

FFGetLastError

Returns the last error message from the DLL's debug channels.

FFGetLastError ( )

Parameters

None.

Return Value

Success: | Returns the error message.
Failure: | Returns an empty string and sets @ERROR

Remarks

This function won't work if all debug options are disabled, as error strings won't be initialized.

Related

FFSetDebugMode, FFTraceError


Function FFGetLastFileName

Function Reference

FFGetLastFileName

Returns the filename of the last BMP or JPG saved by FastFind.

FFGetLastFileName ( )

Parameters

None.

Return Value

Success: | Returns the file name.
Failure: | Returns an empty string.

Remarks

None.

Related

FFSaveBMP, FFSaveJPG


Function FFGetPixel

Function Reference

FFGetPixel

Returns the color value of a specified pixel in a SnapShot.

FFGetPixel ( x, y [, NoSnapShot ] )

Parameters

x | X coordinate of pixel.
y | Y coordinate of pixel.
NoSnapShot | [optional] SnapShot number. Default is the most recent SnapShot taken.

Return Value

Success: | Returns the color value of the pixel.
Failure: | Returns -1 and sets @ERROR

Remarks

None.

Related

FFSnapShot, FFNearestPixel, FFNearestSpot


Function FFGetPixel

Function Reference

FFGetRawData

Gives RawBytes of the SnapShot.

FFGetRawData ( [ NoSnapShot ])

Parameters

NoSnapShot [optional] SnapShot number. Default is the most recent SnapShot taken.

Return Value

Success: | It returns a string stride with the Raw bytes of the SnapShot in 8 Hex digits (BGRA) of pixels from left to right, top to bottom ; every pixel can be accessed like this: StringMid($sStride, $pixelNo *8 +1 ,8) and you get for example 685E5B00 (blue = 68, green = 5E, red = 5B, alpha = 00).
Failure: | Returns -1 and sets @ERROR

Remarks

This function is designed for advanced users only, as an example of how to use the GetRawData DLL function. In most cases, FFGetPixel is easier to use and fast enough.

Related

FFSnapShot, FFGetPixel


Function FFGetVersion

Function Reference

FFGetVersion

Returns the version of the FastFind DLL.

FFGetVersion ( )

Parameters

None.

Return Value

Success: | Returns the version number.
Failure: | Returns '???' and sets @ERROR

Remarks

None.

Related


Function FFIsDifferent

Function Reference

FFIsDifferent

Compares two SnapShots and determines whether they have any differences.

FFIsDifferent ( NoSnapShot1, NoSnapShot2 [, ShadeVariation] )

Parameters

NoSnapShot1 | The "slot" number of the first SnapShot to compare.
NoSnapShot2 | The "slot" number of the second SnapShot to compare.
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).

Return Value

Success: | Returns True
Failure: | Returns False

Remarks

None.

Related

FFSnapShot, FFLocalizeChanges


Function FFIsExcluded

Function Reference

FFIsExcluded

Checks if the point passed as a parameter is within the current exclusion zones.

FFIsExcluded ( x, y, hWnd )

Parameters

x | Horizontal coordinate of point.
y | Vertical coordinate of point.
hWnd | Window handle.

Return Value

Success: | Returns 1
Failure: | Returns 0

Remarks

None.

Related

FFAddExcludedArea, FFResetExcludedAreas


Function FFKeepChanges

Function Reference

FFKeepChanges

Change a SnapShot so that it keeps only the pixels that are different from another SnapShot.

FFKeepChanges ( NoSnapShot1, NoSnapShot2 [, ShadeVariation] )

Parameters

NoSnapShot1 | The "slot" number of the SnapShot to change.
NoSnapShot2 | The "slot" number of the SnapShot to compare against.
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).

Return Value

Success: | Returns 1
Failure: | Returns 0 and sets @ERROR

Remarks

The first SnapShot will be modified when this function is called, changing pixels that are the same in both SnapShots to black. The second SnapShot is kept unchanged.

Related

FFSnapShot, FFIsDifferent, FFLocalizeChanges, FFKeepColor, FFDrawSnapShot


Function FFKeepColor

Function Reference

FFKeepColor

Change a SnapShot so that it keeps only the color(s) specified.

FFKeepColor ( ColorToFind [, ShadeVariation [, ForceNewSnap [, Left [, Top [, Right [, Bottom [, NoSnapShot [, WindowHandle]]]]]]]] )

Parameters

ColorToFind | Color value of pixels to keep (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 change 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 1
Failure: | Returns 0 and sets @ERROR

Remarks

Pixels that don't match the specified color(s) will become black. Setting the ColorToFind parameter to -1 will cause this function 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.

Related

FFSnapShot, FFColorCount, FFKeepChanges, FFDrawSnapShot


Function FFLocalizeChanges

Function Reference

FFLocalizeChanges

Compares two SnapShots and specifies the number of differences, as well as the area in which they occur.

FFLocalizeChanges ( NoSnapShot1, NoSnapShot2 [, ShadeVariation] )

Parameters

NoSnapShot1 | The "slot" number of the first SnapShot to compare.
NoSnapShot2 | The "slot" number of the second SnapShot to compare.
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).

Return Value

Success: | Returns a five-element array specifying the area and number of differences.
Failure: | Returns 0 and sets @ERROR = 1

Remarks

If successful, the elements of the array returned are as follows:
[0]: left edge of the rectangle
[1]: upper edge of the rectangle
[2]: right edge of the rectangle
[3]: lower edge of the rectangle
[4]: Number of pixels that changed

Related

FFSnapShot, FFIsDifferent


Function FFNearestPixel

Function Reference

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.

Related

FFSnapShot, FFAddColor, FFAddExcludedArea, FFGetPixel, FFNearestSpot, FFBestSpot

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


Function FFNearestSpot

Function Reference

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


Function FFRemoveColor

Function Reference

FFRemoveColor

Remove a color from the list of colors if it exists in the list.

FFRemoveColor ( OldColor )

Parameters

OldColor Color value to remove.

Return Value

Success: | Returns 1
Failure: | Returns 0

Remarks

None.

Related

FFAddColor, FFResetColors, FFNearestPixel, FFNearestSpot, FFBestSpot


Function FFResetColors

Function Reference

FFResetColors

Completely empty the list of colors.

FFResetColors ( )

Parameters

None.

Return Value

None.

Remarks

None.

Related

FFAddColor, FFRemoveColor, FFNearestPixel, FFNearestSpot, FFBestSpot


Function FFResetExcludedAreas

Function Reference

FFResetExcludedAreas

Clears the list of all exclusion zones.

FFResetExcludedAreas ( )

Parameters

None.

Return Value

None.

Remarks

None.

Related

FFAddExcludedArea, FFIsExcluded, FFNearestPixel, FFNearestSpot, FFBestSpot


Function FFSaveBMP

Function Reference

FFSaveBMP

Save a SnapShot to a .BMP file.

FFSaveBMP ( "FileNameWithNoExtension" [, ForceNewSnap [, Left [, Top [, Right [, Bottom [, NoSnapShot [, WindowHandle]]]]]]] )

Parameters

FileNameWithNoExtension | Name of the file to create.
ForceNewSnap | [optional] If true, a new SnapShot will be made and that will be saved. Default is False.
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 1
Failure: | Returns 0 and sets @ERROR

Remarks

None.

Related

FFSnapShot, FFSaveJPG


Function FFSaveJPG

Function Reference

FFSaveJPG

Save a SnapShot to a .JPG file.

FFSaveJPG ( "FileNameWithNoExtension" [, QualityFactor [, ForceNewSnap [, Left [, Top [, Right [, Bottom [, NoSnapShot [, WindowHandle]]]]]]]] )

Parameters

FileNameWithNoExtension | Name of the file to create.
QualityFactor | [optional] Quality level of the JPEG, from 1-100. Default is 85.
ForceNewSnap | [optional] If true, a new SnapShot will be made and that will be saved. 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 1
Failure: | Returns 0 and sets @ERROR

Remarks

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

Related

FFSnapShot, FFSaveBMP


Function FFSetDebugMode

Function Reference

FFSetDebugMode

Sets the types of debugging to be used.

FFSetDebugMode ( DebugMode )

Parameters

DebugMode Mode to use for debugging.
Can be a combination of the following:
0 = No debugging
1 = Information sent to the console (RequireAdmin)
2 = Debug information sent to a file (tracer.txt)
4 = Graphical display of points / areas identified
8 = Display MessageBox (blocking)
16 = Excludes internal traces from the DLL
32 = Excludes detailed internal traces from the DLL
64 = Excludes external traces (from the application)
128 = Error message (priority)

Return Value

None.

Remarks

Note that in case of an error, a MessageBox is displayed in the DLL if DebugMode > 0. Serious errors are displayed on all available channels (file, console and MessageBox) if DebugMode > 0.

To send information to the console in Windows Vista and Windows 7, you will need the #RequireAdmin tag in your AutoIt script.

Related

FFTrace, FFTraceError

Example

#include "FastFind.au3"
#Include <WinAPI.au3>

#RequireAdmin

FFSetDebugMode(7) ; console + file + graphical


Function FFSetDefaultSnapShot

Function Reference

FFSetDefaultSnapShot

Sets the default snapshot to be used when none is specified.

FFSetDefaultSnapShot ( NewSnapShot )

Parameters

NewSnapShot Snapshot number, from 0 to 1023.

Return Value

None.

Remarks

When using functions that require a snapshot and no snapshot number is specified, they will use the default snapshot. Unless changed, the default snapshot number is 0.

Related

FFSnapShot


Function FFSetPixel

Function Reference

FFSetPixel

Changes the color of a pixel in a given SnapShot.

FFSetPixel ( x, y, Color [, NoSnapShot ] )

Parameters

x | X coordinate of pixel.
y | Y coordinate of pixel.
Color | Color value to change the pixel to (in decimal or hex).
NoSnapShot | [optional] SnapShot number. Default is the most recent SnapShot taken.

Return Value

Success: | Returns 1
Failure: | Returns 0 and sets @ERROR

Remarks

None.

Related

FFSnapShot, FFGetPixel, FFKeepColor, FFDrawSnapShot


Function FFSetWnd

Function Reference

FFSetWnd

Sets the current window to use.

FFSetWnd ( "WindowHandle" [, ClientOnly] )

Parameters

WindowHandle | The window handle to use. If windowHandle = 0, the entire screen will be used.
ClientOnly | [optional] True = Only the client area of the window will be used (default). False = The entire window will be used.

Return Value

None.

Remarks

This will determine the area of the screen captured by snapshots. If not set, the entire screen is used by default. Once set, snapshots will capture only the specified window until it is changed.

Related

FFSnapShot


Function FFSnapShot

Function Reference

FFSnapShot

Makes a copy of the screen, window or area in memory.

FFSnapShot ( [Left [, Top [, Right [, Bottom [, NoSnapShot [, WindowHandle]]]]]] )

Parameters

Left | [optional] Left coordinate of SnapShot area. Default is 0.
Top | [optional] Top coordinate of SnapShot area. Default is 0.
Right | [optional] Right coordinate of SnapShot area. Default is 0.
Bottom | [optional] Bottom coordinate of SnapShot area. Default is 0.
NoSnapShot | [optional] SnapShot number. Determines which "slot" the SnapShot will be stored in.
WindowHandle | [optional] The window handle to capture, if only interested in a particular window.

Return Value

Success: | Returns 1
Failure: | Returns 0 and sets @ERROR

Remarks

NoSnapShot will default to the last slot written to by this function, or 0 if not previously set. The default SnapShot can be set separately with FFSetDefaultSnapShot.

WindowHandle will default to the last value used, or the whole screen if not previously set. The default window handle can be set separately with FFSetWnd.

If the area indicated is 0,0,0,0 then this will capture the entire window or screen.

If no SnapShot exists, many other FastFind functions will either fail or automatically take a SnapShot with the default values. SnapShots are an essential part of using FastFind, so it's important to use them correctly!

Warning: The use of this feature consumes memory. It takes about 1.8 MB of RAM to store a 800x600 area of the screen. Therefore, it is preferable to reuse the same SnapShot number each time. Nevertheless, it is possible to store up to 1024 SnapShots simultaneously.

Related

FFSetDefaultSnapShot, FFSetWnd, FFGetPixel, FFNearestPixel, FFNearestSpot, FFBestSpot, FFSaveBMP, FFSaveJPG, FFIsDifferent, FFLocalizeChanges, FFKeepChanges, FFKeepColor, FFDrawSnapShot, FFSetPixel, FFDuplicateSnapShot

Example

#include "FastFind.au3"

AutoItSetOption("WinTitleMatchMode", 4)

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

FFSnapShot(0, 0, 300, 150)
FFSaveBMP(@YEAR & "-" & @MON & "-" & @MDAY & "_" & @HOUR & @MIN & @SEC, false)


Function FFTrace

Function Reference

FFTrace

Inserts text into the DLL's debug channels.

FFTrace ( "DebugString" )

Parameters

DebugString String to insert into debug channels.

Return Value

None.

Remarks

The debug channels where this text appears will depend on the current debug mode.

Related

FFSetDebugMode, FFTraceError


Function FFTraceError

Function Reference

FFTraceError

Inserts an error message into the DLL's debug channels.

FFTraceError ( "DebugString" )

Parameters

DebugString Error message to insert into debug channels.

Return Value

None.

Remarks

This works similar to FFTrace, however it will be treated as an error and appear in a MessageBox. The debug channels where this message appears will depend on the current debug mode.

Related

FFSetDebugMode, FFTrace, FFGetLastError