Target

Target related methods.


TTarget.SetDesktop

procedure TTarget.SetDesktop;

Sets the desktop as the target.


TTarget.SetImage

procedure TTarget.SetImage(TImage: TImage);

Sets the TSimbaImage as a target.

Note

Ownership of the TSimbaImage is not taken. Make sure you do not free the image while using this target.


TTarget.SetWindow

procedure TTarget.SetWindow(Window: TWindowHandle);

Sets a window handle as a target.


TTarget.SetEIOS

procedure TTarget.SetEIOS(Plugin, Args: String);

Sets a plugin (via EIOS API) as the target.


TTarget.SetPlugin

procedure TTarget.SetPlugin(FileName, Args: String);

Sets a plugin (via SimbaPluginTarget API) as the target. For more details about the API see http://villavu.github.io/Simba/tutorials/plugins/plugin-target.html


TTarget.SetPlugin

procedure TTarget.SetPlugin(FileName, Args: String; out DebugImage: TExternalCanvas);

Overloaded version that returns a “external canvas” to draw on.


TTarget.RemoveTargetInvalidEvent

procedure TTarget.RemoveTargetInvalidEvent(Event: TTargetEvent);

TTarget.AddTargetChangeEvent

function TTarget.AddTargetChangeEvent(Event: TTargetEvent): TTargetEvent;

TTarget.RemoveTargetChangeEvent

procedure TTarget.RemoveTargetChangeEvent(Event: TTargetEvent);

TTarget.FreezeImage

procedure TTarget.FreezeImage(ABounds: TBox);

TTarget.UnFreezeImage

procedure TTarget.UnFreezeImage;

TTarget.IsImageFrozen

function TTarget.IsImageFrozen: Boolean;

TTarget.GetImage

function TTarget.GetImage(Bounds: TBox = [-1,-1,-1,-1]): TImage;

TTarget.IsValid

function TTarget.IsValid: Boolean;

TTarget.IsFocused

function TTarget.IsFocused: Boolean;

TTarget.Focus

function TTarget.Focus: Boolean;

TTarget.ToString

function TTarget.ToString: String;

TTarget.TargetKind

property TTarget.TargetKind: ETargetKind;

TTarget.TargetWindow

property TTarget.TargetWindow: TWindowHandle;

TTarget.TargetImage

property TTarget.TargetImage: TImage;

TTarget.CustomClientArea

property TTarget.CustomClientArea: TBox;
property TTarget.CustomClientArea(Value: TBox);

Set a custom client area within the bounds of the target.

Target.CustomClientArea := [100,100,600,600];
Input.MouseMove([1,1]); // Will move the mouse to [101,101] on the "real" bounds

TTarget.AutoFocus

property TTarget.AutoFocus(Value: Boolean);
property TTarget.AutoFocus: Boolean;

TTarget.Bounds

property TTarget.Bounds: TBox;

TTarget.Width

property TTarget.Width: Integer;

TTarget.Height

property TTarget.Height: Integer;

TTarget.Size

property TTarget.Size: TSize;

Returns the targets dimensions as in a TSize.


TTarget.AddMouseEvent

function TTarget.AddMouseEvent(Event: TMouseButtonEvent): TMouseButtonEvent;
function TTarget.AddMouseEvent(Event: TMouseTeleportEvent): TMouseTeleportEvent;
function TTarget.AddMouseEvent(Event: TMouseMovingEvent): TMouseMovingEvent;

TTarget.RemoveMouseEvent

procedure TTarget.RemoveMouseEvent(Event: TMouseButtonEvent); overload;
procedure TTarget.RemoveMouseEvent(Event: TMouseTeleportEvent); overload;
procedure TTarget.RemoveMouseEvent(Event: TMouseMovingEvent); overload;

TTarget.MouseTeleport

procedure TTarget.MouseTeleport(P: TPoint);

Instantly moves the mouse to P


TTarget.MouseClick

procedure TTarget.MouseClick(Button: EMouseButton);

TTarget.MouseDown

procedure TTarget.MouseDown(Button: EMouseButton);

TTarget.MouseUp

procedure TTarget.MouseUp(Button: EMouseButton);

TTarget.MouseScroll

procedure TTarget.MouseScroll(Scrolls: Integer);

TTarget.MousePressed

function TTarget.MousePressed(Button: EMouseButton): Boolean;

TTarget.MouseMove

procedure TTarget.MouseMove(Dest: TPoint);

Move the mouse in a human-like way.

Speed, Gravity and Wind variables affects this.

Note

The algorithm used is WindMouse. For more details see https://ben.land/post/2021/04/25/windmouse-human-mouse-movement


TTarget.MouseMove

procedure MouseMove(Box: TBox; ForcedMove: Boolean = False); overload;
procedure MouseMove(Quad: TQuad; ForcedMove: Boolean = False); overload;

MouseMove overloads. Use ForcedMove to determine if the mouse will still move if it’s already inside the box/quad.


TTarget.MouseXY

property TTarget.MouseXY: TPoint;
property TTarget.MouseXY(Value: TPoint);

TTarget.MouseX

property TTarget.MouseX: Integer;
property TTarget.MouseX(Value: Integer);

TTarget.MouseY

property TTarget.MouseY: Integer;
property TTarget.MouseY(Value: Integer);

TTarget.AddTargetInvalidEvent

function TTarget.AddTargetInvalidEvent(Event: TTargetEvent): TTargetEvent;

TTarget.KeySend

procedure TTarget.KeySend(Text: String);

TTarget.KeyDown

procedure TTarget.KeyDown(Key: EKeyCode);

TTarget.KeyUp

procedure TTarget.KeyUp(Key: EKeyCode);

TTarget.KeyPress

procedure TTarget.KeyPress(Key: EKeyCode);

TTarget.KeyPressed

function TTarget.KeyPressed(Key: EKeyCode): Boolean;

TTarget.KeyCodeFromChar

function TTarget.KeyCodeFromChar(C: Char): EKeyCode;

TTarget.MatchColor

function TTarget.MatchColor(Color: TColor; ColorSpace: EColorSpace; Multipliers: TChannelMultipliers; Bounds: TBox): TSingleMatrix;

TTarget.FindColor

function TTarget.FindColor(Color: TColor; Tolerance: Single; Bounds: TBox = [-1,-1,-1,-1]): TPointArray;

TTarget.FindColor

function TTarget.FindColor(Color: TColor; Tolerance: Single; ColorSpace: EColorSpace; Multipliers: TChannelMultipliers; Bounds: TBox = [-1,-1,-1,-1]): TPointArray;

TTarget.FindColor

function TTarget.FindColor(Color: TColorTolerance; Bounds: TBox = [-1,-1,-1,-1]): TPointArray;

TTarget.CountColor

function TTarget.CountColor(Color: TColor; Tolerance: Single; Bounds: TBox = [-1,-1,-1,-1]): Integer;

TTarget.CountColor

function TTarget.CountColor(Color: TColor; Tolerance: Single; ColorSpace: EColorSpace; Multipliers: TChannelMultipliers; Bounds: TBox = [-1,-1,-1,-1]): Integer;

TTarget.CountColor

function TTarget.CountColor(Color: TColorTolerance; Bounds: TBox = [-1,-1,-1,-1]): Integer;

TTarget.HasColor

function TTarget.HasColor(Color: TColor; Tolerance: Single; ColorSpace: EColorSpace; Multipliers: TChannelMultipliers; MinCount: Integer = 1; Bounds: TBox = [-1,-1,-1,-1]): Boolean;

TTarget.HasColor

function TTarget.HasColor(Color: TColor; Tolerance: Single; MinCount: Integer = 1; Bounds: TBox = [-1,-1,-1,-1]): Boolean;

TTarget.HasColor

function TTarget.HasColor(Color: TColorTolerance; MinCount: Integer = 1; Bounds: TBox = [-1,-1,-1,-1]): Boolean; overload;

TTarget.GetColor

function TTarget.GetColor(P: TPoint): TColor;

TTarget.GetColors

function TTarget.GetColors(Points: TPointArray): TColorArray;

TTarget.GetColorsMatrix

function TTarget.GetColorsMatrix(Bounds: TBox = [-1,-1,-1,-1]): TIntegerMatrix;

TTarget.HasImage

function TTarget.HasImage(Image: TSimbaImage; Tolerance: Single; ColorSpace: EColorSpace; Multipliers: TChannelMultipliers; MinCount: Integer = 1; Bounds: TBox  = [-1,-1,-1,-1]): Boolean;

TTarget.HasImage

function TTarget.HasImage(Image: TSimbaImage; Tolerance: Single; MinCount: Integer = 1; Bounds: TBox  = [-1,-1,-1,-1]): Boolean;

TTarget.FindImage

function TTarget.FindImage(Image: TImage; Tolerance: Single; Bounds: TBox = [-1,-1,-1,-1]): TPoint;

TTarget.FindImage

function TTarget.FindImage(Image: TImage; Tolerance: Single; ColorSpace: EColorSpace; Multipliers: TChannelMultipliers; Bounds: TBox = [-1,-1,-1,-1]): TPoint;

TTarget.FindImageEx

function TTarget.FindImageEx(Image: TImage; Tolerance: Single; MaxToFind: Integer = -1; Bounds: TBox = [-1,-1,-1,-1]): TPointArray;

TTarget.FindImageEx

function TTarget.FindImageEx(Image: TImage; Tolerance: Single; ColorSpace: EColorSpace; Multipliers: TChannelMultipliers; MaxToFind: Integer = -1; Bounds: TBox = [-1,-1,-1,-1]): TPointArray;

TTarget.FindTemplate

function TTarget.FindTemplate(Image: TImage; out Match: Single; Bounds: TBox = [-1,-1,-1,-1]): TPoint;

TTarget.HasTemplate

function TTarget.HasTemplate(Image: TImage; MinMatch: Single; Bounds: TBox = [-1,-1,-1,-1]): Boolean;

TTarget.FindDTM

function TTarget.FindDTM(DTM: TDTM; Bounds: TBox = [-1,-1,-1,-1]): TPoint;

TTarget.FindDTMEx

function TTarget.FindDTMEx(DTM: TDTM; MaxToFind: Integer = 1; Bounds: TBox = [-1,-1,-1,-1]): TPointArray;

TTarget.FindDTMRotated

function TTarget.FindDTMRotated(DTM: TDTM; StartDegrees, EndDegrees: Double; Step: Double; out FoundDegrees: TDoubleArray; Bounds: TBox = [-1,-1,-1,-1]): TPoint;

TTarget.FindDTMRotatedEx

function TTarget.FindDTMRotatedEx(DTM: TDTM; StartDegrees, EndDegrees: Double; Step: Double; out FoundDegrees: TDoubleArray; MaxToFind: Integer = 1; Bounds: TBox = [-1,-1,-1,-1]): TPointArray;

TTarget.FindEdges

function TTarget.FindEdges(MinDiff: Single; ColorSpace: EColorSpace; Multipliers: TChannelMultipliers; Bounds: TBox = [-1,-1,-1,-1]): TPointArray;

TTarget.FindEdges

function TTarget.FindEdges(MinDiff: Single; Bounds: TBox = [-1,-1,-1,-1]): TPointArray;

TTarget.GetPixelDifference

function TTarget.GetPixelDifference(WaitTime: Integer; Area: TBox = [-1,-1,-1,-1]): Integer;

TTarget.GetPixelDifference

function TTarget.GetPixelDifference(WaitTime, Tolerance: Single; Area: TBox = [-1,-1,-1,-1]): Integer;

TTarget.GetPixelDifferenceTPA

function TTarget.GetPixelDifferenceTPA(WaitTime: Integer; Area: TBox = [-1,-1,-1,-1]): TPointArray;

TTarget.GetPixelDifferenceTPA

function TTarget.GetPixelDifferenceTPA(WaitTime, Tolerance: Single; Area: TBox = [-1,-1,-1,-1]): TPointArray;

TTarget.AverageBrightness

function TTarget.AverageBrightness(Area: TBox = [-1,-1,-1,-1]): Integer;

TTarget.PeakBrightness

function TTarget.PeakBrightness(Area: TBox = [-1,-1,-1,-1]): Integer;