Jump to content
FHannes

SCAR Divi 3.35 Pre-Alpha (Unstable!!!)

Recommended Posts

I mean for SCAR 4, multithreading...would be cool

Multithreading is cool but is a very complex thing to use in Delphi let alone in scar. You need interrupts and everything also need call stack info and heap memory access ect. I think having true pointers in scar woulde be pretty cool. It would also be cool If scar had a pre loaded thread that we could put a procedure or function on a loop with in it. kinda like setup exude timeout but actually have its own thread.

Link to comment
Share on other sites

I've uploaded a new copy.

 

New:
- function BoxToStr(const Box: TBox): string;
- RESOURCE_MANAGEMENT preprocessor option (can only disable resourcemanagement for TSCARObject subclasses)
- TSCARClient = class(TSCARObject);
- TSCARWindowClient = class(TSCARClient);
- function GetClient: TSCARClient;
- procedure SetClient(const Client: TSCARClient);
- function DesktopClient: TSCARWindowClient;
- procedure KeyDown(const Key: Char);
- procedure KeyUp(const Key: Char);
- procedure MoveMouseExpert(const X, Y, Gravity, Wind, MinWait, MaxWait, MaxStep, TargetArea: Extended);
- procedure MoveMouseEx(const X, Y, RX, RY, MouseSpeed: Integer);
- procedure MoveMouse(const X, Y: Integer); {MouseSpeed = 25}
- procedure ClickMouseEx(const X, Y: Integer; const Btn: TMouseButton; const Interval: Integer);
- procedure MoveMouseBox(const X1, Y1, X2, Y2: Integer);
- procedure MoveMouseBoxEx(const X1, Y1, X2, Y2, MouseSpeed: Integer);
- procedure PressVKey(const VKey: Byte);
- procedure PressVKeyEx(const VKey: Byte; const Interval: Integer);
- procedure PressKey(const Key: Char);
- procedure PressKeyEx(const Key: Char; const Interval: Integer);
- procedure TypeTextEx(const Str: string; const UseNumpad, UseDelays: Boolean);
- procedure TypeText(const Str: string);
- VK_XBUTTON1, VK_XBUTTON2, VK_CAPITAL, VK_KANA, VK_HANGUL, VK_JUNJA, VK_FINAL, VK_HANJA, VK_KANJI, VK_CONVERT
- VK_NONCONVERT, VK_ACCEPT, VK_MODECHANGE, VK_LWIN, VK_RWIN, VK_APPS, VK_SLEEP, VK_NUMPAD0-VK_NUMPAD9
- VK_F13-VK_F24, VK_NUMLOCK, VK_SCROLL, VK_LSHIFT, VK_RSHIFT, VK_LCONTROL, VK_RCONTROL, VK_LMENU, VK_RMENU
- VK_BROWSER_BACK, VK_BROWSER_FORWARD, VK_BROWSER_REFRESH, VK_BROWSER_STOP, VK_BROWSER_SEARCH, VK_BROWSER_FAVORITES
- VK_BROWSER_HOME, VK_VOLUME_MUTE, VK_VOLUME_DOWN, VK_VOLUME_UP, VK_MEDIA_NEXT_TRACK, VK_MEDIA_PREV_TRACK
- VK_MEDIA_STOP, VK_MEDIA_PLAY_PAUSE, VK_LAUNCH_MAIL, VK_LAUNCH_MEDIA_SELECT, VK_LAUNCH_APP1, VK_LAUNCH_APP2
- function GetKeyState(const VKey: Byte): Boolean;
- function GetCurrentKeyState(const VKey: Byte): Boolean;
- function GetToggleKeyState(const VKey: Byte): Boolean;
- function FindColors(out X, Y: Integer; const Colors: TIntArray; const XS, YS, XE, YE: Integer): Boolean;
- function FindColorsTol(out X, Y: Integer; const Colors: TIntArray; const XS, YS, XE, YE, Tol: Integer): Boolean;

Tweaks:
- procedure MouseBtnDown(const X, Y: Integer; const Btn: TMouseButton);
- procedure MouseBtnUp(const X, Y: Integer; const Btn: TMouseButton);
- procedure ClickMouse(const X, Y: Integer; const Btn: TMouseButton);
- Renamed:
    * FindBitmapIn -> FindBitmap
    * FindBitmapToleranceIn -> FindBitmapTol
    * HoldMouse -> MouseBtnDown
    * ReleaseMouse -> MouseBtnUp
    * KeyDown -> VKeyDown
    * KeyUp -> VKeyUp
    * GetKeyCode -> CharToVKey
    * MoveMouse -> SetMousePos
    * FindColorTolerance -> FindColorTol
    * FindColors -> FindColorEx
    * FindColorsTolerance -> FindColorTolEx
    * FindColorSpiralTolerance -> FindColorSpiralTol
    * FindColorsSpiralTolerance -> FindColorSpiralTolEx
    * FindColorsSpiral -> FindColorSpiralEx
- Performance tweak for GetCursorType

Removed:
- procedure ClearDebugLine(const Line: Integer);
- procedure DeleteDebugLine(const Line: Integer);
- function GetDebugLineCount: Integer;
- function GetDebugLine(const Line: Integer): AnsiString;
- procedure ReplaceDebugLine(const Line: Integer; const Str: AnsiString);
- function GetDebugText: AnsiString;
- procedure GetClientDimensions(out Width, Height: Integer);
- function GetClientWindowHandle: Hwnd;
- procedure SetClientWindowHandle(const H: Hwnd);
- function GetTargetDC: HDC;
- procedure SetTargetDC(const DC: HDC);
- procedure ResetDC;
- procedure SetDesktopAsClient;
- procedure ClickMouseMid(x, y: Integer);
- procedure HoldMouseMid(x, y: Integer);
- procedure ReleaseMouseMid(x, y: Integer);
- function FindBitmap(Bitmap: Integer; var x, y: Integer): Boolean;
- function FindBitmapTolerance(Bitmap: Integer; var x, y: Integer; Tolerance: Integer): Boolean;
- procedure SendKeysVB(const Str: AnsiString; const Wait: Boolean);
- procedure SendArrow(const Key: Byte);
- procedure SendArrowWait(const Key: Byte; const WaitTime: Integer);
- procedure MoveMouseCC(x, y, range, segments, pcount, delay: Integer);
- procedure MoveMouseSmoothFrom(x1, y1, x2, y2: Integer);
- procedure MoveMouseSmoothFromEx(x1, y1, x2, y2: Integer; minsleeptime, maxsleeptime, maxdistance, gravity, forces: Integer);
- procedure MoveMouseSmoothEx(const X, Y, MinSleepTime, MaxSleepTime, MaxDistance, Gravity, Forces: Integer);
- procedure MoveMouseSmooth(const X, Y: Integer);
- procedure ClickWindMouse(X, Y, rx, ry: Integer; Btn: TMouseButton);
- procedure ClickMouseBox(x1, y1, x2, y2: Integer; Btn: TMouseButton);
- procedure MouseBox(x1, y1, x2, y2: Integer);
- procedure SendKeys(const Str: AnsiString);
- procedure TypeKeys(const Str: AnsiString);
- procedure SendKeysWait(const Str: AnsiString; const WaitTime, RndTime: Integer);
- function IsNumpadEnabled: Boolean;
- function IsCapsLockEnabled: Boolean;
- function IsArrowDown(const Num: Byte): Boolean;
- function IsNumpadKeyDown(const Key: Byte): Boolean;
- TMusic
- function CreateMusicPlayer: TMusic;
- function FreeMusicPlayer(const Player: TMusic): Boolean;

 

I've started tinkering on the colorfinding API. I've also added new functions which can search for multiple different colors at once. There's more of those to come and already ready, but I still have to write front-ends for those. If you use these new colorfinding functions, make sure to test them properly, I don't think they have any bugs, but you never know...

Link to comment
Share on other sites

I've uploaded a new copy.

 

New:
- function BoxToStr(const Box: TBox): string;
- RESOURCE_MANAGEMENT preprocessor option (can only disable resourcemanagement for TSCARObject subclasses)
- TSCARClient = class(TSCARObject);
- TSCARWindowClient = class(TSCARClient);
- function GetClient: TSCARClient;
- procedure SetClient(const Client: TSCARClient);
- function DesktopClient: TSCARWindowClient;
- procedure KeyDown(const Key: Char);
- procedure KeyUp(const Key: Char);
- procedure MoveMouseExpert(const X, Y, Gravity, Wind, MinWait, MaxWait, MaxStep, TargetArea: Extended);
- procedure MoveMouseEx(const X, Y, RX, RY, MouseSpeed: Integer);
- procedure MoveMouse(const X, Y: Integer); {MouseSpeed = 25}
- procedure ClickMouseEx(const X, Y: Integer; const Btn: TMouseButton; const Interval: Integer);
- procedure MoveMouseBox(const X1, Y1, X2, Y2: Integer);
- procedure MoveMouseBoxEx(const X1, Y1, X2, Y2, MouseSpeed: Integer);
- procedure PressVKey(const VKey: Byte);
- procedure PressVKeyEx(const VKey: Byte; const Interval: Integer);
- procedure PressKey(const Key: Char);
- procedure PressKeyEx(const Key: Char; const Interval: Integer);
- procedure TypeTextEx(const Str: string; const UseNumpad, UseDelays: Boolean);
- procedure TypeText(const Str: string);
- VK_XBUTTON1, VK_XBUTTON2, VK_CAPITAL, VK_KANA, VK_HANGUL, VK_JUNJA, VK_FINAL, VK_HANJA, VK_KANJI, VK_CONVERT
- VK_NONCONVERT, VK_ACCEPT, VK_MODECHANGE, VK_LWIN, VK_RWIN, VK_APPS, VK_SLEEP, VK_NUMPAD0-VK_NUMPAD9
- VK_F13-VK_F24, VK_NUMLOCK, VK_SCROLL, VK_LSHIFT, VK_RSHIFT, VK_LCONTROL, VK_RCONTROL, VK_LMENU, VK_RMENU
- VK_BROWSER_BACK, VK_BROWSER_FORWARD, VK_BROWSER_REFRESH, VK_BROWSER_STOP, VK_BROWSER_SEARCH, VK_BROWSER_FAVORITES
- VK_BROWSER_HOME, VK_VOLUME_MUTE, VK_VOLUME_DOWN, VK_VOLUME_UP, VK_MEDIA_NEXT_TRACK, VK_MEDIA_PREV_TRACK
- VK_MEDIA_STOP, VK_MEDIA_PLAY_PAUSE, VK_LAUNCH_MAIL, VK_LAUNCH_MEDIA_SELECT, VK_LAUNCH_APP1, VK_LAUNCH_APP2
- function GetKeyState(const VKey: Byte): Boolean;
- function GetCurrentKeyState(const VKey: Byte): Boolean;
- function GetToggleKeyState(const VKey: Byte): Boolean;
- function FindColors(out X, Y: Integer; const Colors: TIntArray; const XS, YS, XE, YE: Integer): Boolean;
- function FindColorsTol(out X, Y: Integer; const Colors: TIntArray; const XS, YS, XE, YE, Tol: Integer): Boolean;

Tweaks:
- procedure MouseBtnDown(const X, Y: Integer; const Btn: TMouseButton);
- procedure MouseBtnUp(const X, Y: Integer; const Btn: TMouseButton);
- procedure ClickMouse(const X, Y: Integer; const Btn: TMouseButton);
- Renamed:
    * FindBitmapIn -> FindBitmap
    * FindBitmapToleranceIn -> FindBitmapTol
    * HoldMouse -> MouseBtnDown
    * ReleaseMouse -> MouseBtnUp
    * KeyDown -> VKeyDown
    * KeyUp -> VKeyUp
    * GetKeyCode -> CharToVKey
    * MoveMouse -> SetMousePos
    * FindColorTolerance -> FindColorTol
    * FindColors -> FindColorEx
    * FindColorsTolerance -> FindColorTolEx
    * FindColorSpiralTolerance -> FindColorSpiralTol
    * FindColorsSpiralTolerance -> FindColorSpiralTolEx
    * FindColorsSpiral -> FindColorSpiralEx
- Performance tweak for GetCursorType

Removed:
- procedure ClearDebugLine(const Line: Integer);
- procedure DeleteDebugLine(const Line: Integer);
- function GetDebugLineCount: Integer;
- function GetDebugLine(const Line: Integer): AnsiString;
- procedure ReplaceDebugLine(const Line: Integer; const Str: AnsiString);
- function GetDebugText: AnsiString;
- procedure GetClientDimensions(out Width, Height: Integer);
- function GetClientWindowHandle: Hwnd;
- procedure SetClientWindowHandle(const H: Hwnd);
- function GetTargetDC: HDC;
- procedure SetTargetDC(const DC: HDC);
- procedure ResetDC;
- procedure SetDesktopAsClient;
- procedure ClickMouseMid(x, y: Integer);
- procedure HoldMouseMid(x, y: Integer);
- procedure ReleaseMouseMid(x, y: Integer);
- function FindBitmap(Bitmap: Integer; var x, y: Integer): Boolean;
- function FindBitmapTolerance(Bitmap: Integer; var x, y: Integer; Tolerance: Integer): Boolean;
- procedure SendKeysVB(const Str: AnsiString; const Wait: Boolean);
- procedure SendArrow(const Key: Byte);
- procedure SendArrowWait(const Key: Byte; const WaitTime: Integer);
- procedure MoveMouseCC(x, y, range, segments, pcount, delay: Integer);
- procedure MoveMouseSmoothFrom(x1, y1, x2, y2: Integer);
- procedure MoveMouseSmoothFromEx(x1, y1, x2, y2: Integer; minsleeptime, maxsleeptime, maxdistance, gravity, forces: Integer);
- procedure MoveMouseSmoothEx(const X, Y, MinSleepTime, MaxSleepTime, MaxDistance, Gravity, Forces: Integer);
- procedure MoveMouseSmooth(const X, Y: Integer);
- procedure ClickWindMouse(X, Y, rx, ry: Integer; Btn: TMouseButton);
- procedure ClickMouseBox(x1, y1, x2, y2: Integer; Btn: TMouseButton);
- procedure MouseBox(x1, y1, x2, y2: Integer);
- procedure SendKeys(const Str: AnsiString);
- procedure TypeKeys(const Str: AnsiString);
- procedure SendKeysWait(const Str: AnsiString; const WaitTime, RndTime: Integer);
- function IsNumpadEnabled: Boolean;
- function IsCapsLockEnabled: Boolean;
- function IsArrowDown(const Num: Byte): Boolean;
- function IsNumpadKeyDown(const Key: Byte): Boolean;
- TMusic
- function CreateMusicPlayer: TMusic;
- function FreeMusicPlayer(const Player: TMusic): Boolean;

 

I've started tinkering on the colorfinding API. I've also added new functions which can search for multiple different colors at once. There's more of those to come and already ready, but I still have to write front-ends for those. If you use these new colorfinding functions, make sure to test them properly, I don't think they have any bugs, but you never know...

 

I think a class for setting the hue sat and color speed would be nice, also maybe a function to reset the color finding settings to default. Nothing major but something cleaner would be nice.

Link to comment
Share on other sites

I think a class for setting the hue sat and color speed would be nice, also maybe a function to reset the color finding settings to default. Nothing major but something cleaner would be nice.

 

SCAR has been using classes for tolerance for quite some time, but I'm not going to expose it to scripts at this time.

Link to comment
Share on other sites

I've started work on the new bitmap API. I've created the first new bitmap functions as well, do note that FindBitmapTol doesn't work in this current copy because of a bug, I've already fixed it though, it will work in the next build.

 

New:
- function BoxToStr(const Box: TBox): string;
- RESOURCE_MANAGEMENT preprocessor option (can only disable resourcemanagement for TSCARObject subclasses)
- TSCARClient = class(TSCARObject);
- TSCARWindowClient = class(TSCARClient);
- function GetClient: TSCARClient;
- procedure SetClient(const Client: TSCARClient);
- function DesktopClient: TSCARWindowClient;
- procedure KeyDown(const Key: Char);
- procedure KeyUp(const Key: Char);
- procedure MoveMouseExpert(const X, Y, Gravity, Wind, MinWait, MaxWait, MaxStep, TargetArea: Extended);
- procedure MoveMouseEx(const X, Y, RX, RY, MouseSpeed: Integer);
- procedure MoveMouse(const X, Y: Integer); {MouseSpeed = 25}
- procedure ClickMouseEx(const X, Y: Integer; const Btn: TMouseButton; const Interval: Integer);
- procedure MoveMouseBox(const X1, Y1, X2, Y2: Integer);
- procedure MoveMouseBoxEx(const X1, Y1, X2, Y2, MouseSpeed: Integer);
- procedure PressVKey(const VKey: Byte);
- procedure PressVKeyEx(const VKey: Byte; const Interval: Integer);
- procedure PressKey(const Key: Char);
- procedure PressKeyEx(const Key: Char; const Interval: Integer);
- procedure TypeTextEx(const Str: string; const UseNumpad, UseDelays: Boolean);
- procedure TypeText(const Str: string);
- VK_XBUTTON1, VK_XBUTTON2, VK_CAPITAL, VK_KANA, VK_HANGUL, VK_JUNJA, VK_FINAL, VK_HANJA, VK_KANJI, VK_CONVERT
- VK_NONCONVERT, VK_ACCEPT, VK_MODECHANGE, VK_LWIN, VK_RWIN, VK_APPS, VK_SLEEP, VK_NUMPAD0-VK_NUMPAD9
- VK_F13-VK_F24, VK_NUMLOCK, VK_SCROLL, VK_LSHIFT, VK_RSHIFT, VK_LCONTROL, VK_RCONTROL, VK_LMENU, VK_RMENU
- VK_BROWSER_BACK, VK_BROWSER_FORWARD, VK_BROWSER_REFRESH, VK_BROWSER_STOP, VK_BROWSER_SEARCH, VK_BROWSER_FAVORITES
- VK_BROWSER_HOME, VK_VOLUME_MUTE, VK_VOLUME_DOWN, VK_VOLUME_UP, VK_MEDIA_NEXT_TRACK, VK_MEDIA_PREV_TRACK
- VK_MEDIA_STOP, VK_MEDIA_PLAY_PAUSE, VK_LAUNCH_MAIL, VK_LAUNCH_MEDIA_SELECT, VK_LAUNCH_APP1, VK_LAUNCH_APP2
- function GetKeyState(const VKey: Byte): Boolean;
- function GetCurrentKeyState(const VKey: Byte): Boolean;
- function GetToggleKeyState(const VKey: Byte): Boolean;
- function FindColors(out X, Y: Integer; const Colors: TIntArray; const XS, YS, XE, YE: Integer): Boolean;
- function FindColorsTol(out X, Y: Integer; const Colors: TIntArray; const XS, YS, XE, YE, Tol: Integer): Boolean;
- function FindColorsEx(out Points: TPointArray; const Colors: TIntArray; const XS, YS, XE, YE: Integer): Boolean;
- function FindColorsTolEx(out Points: TPointArray; const Colors: TIntArray; const XS, YS, XE, YE, Tol: Integer): Boolean;
- function FindColorsSpiral(const SX, SY: Integer; out X, Y: Integer; const Colors: TIntArray; const XS, YS, XE, YE: Integer): Boolean;
- function FindColorsSpiralTol(const SX, SY: Integer; out X, Y: Integer; const Colors: TIntArray; const XS, YS, XE, YE, Tol: Integer): Boolean;
- function FindColorsSpiralEx(const SX, SY: Integer; out Points: TPointArray; const Colors: TIntArray; const XS, YS, XE, YE: Integer): Boolean;
- function FindColorsSpiralTolEx(const SX, SY: Integer; out Points: TPointArray; const Colors: TIntArray; const XS, YS, XE, YE, Tol: Integer): Boolean;
- function CountColors(const Colors: TIntArray; const XS, YS, XE, YE: Integer): Integer;
- function CountColorsTol(const Colors: TIntArray; const XS, YS, XE, YE, Tol: Integer): Integer;
- TSCARBitmap = class(TSCARObject);

Tweaks:
- procedure MouseBtnDown(const X, Y: Integer; const Btn: TMouseButton);
- procedure MouseBtnUp(const X, Y: Integer; const Btn: TMouseButton);
- procedure ClickMouse(const X, Y: Integer; const Btn: TMouseButton);
- Renamed:
    * FindBitmapIn -> FindBitmap
    * FindBitmapToleranceIn -> FindBitmapTol
    * HoldMouse -> MouseBtnDown
    * ReleaseMouse -> MouseBtnUp
    * KeyDown -> VKeyDown
    * KeyUp -> VKeyUp
    * GetKeyCode -> CharToVKey
    * MoveMouse -> SetMousePos
    * FindColorTolerance -> FindColorTol
    * FindColors -> FindColorEx
    * FindColorsTolerance -> FindColorTolEx
    * FindColorSpiralTolerance -> FindColorSpiralTol
    * FindColorsSpiralTolerance -> FindColorSpiralTolEx
    * FindColorsSpiral -> FindColorSpiralEx
    * CountColorTolerance -> CountColorTol
- Performance tweak for GetCursorType
- function FindColorSpiral(const SX, SY: Integer; out X, Y: Integer; const Color, XS, YS, XE, YE: Integer): Boolean;
- function FindColorSpiralTol(const SX, SY: Integer; out X, Y: Integer; const Color, XS, YS, XE, YE, Tol: Integer): Boolean;
- function FindBitmap(out X, Y: Integer; const Bmp: TSCARBitmap; const XS, YS, XE, YE: Integer): Boolean;
- function FindBitmapTol(out X, Y: Integer; const Bmp: TSCARBitmap; const XS, YS, XE, YE, Tol: Integer): Boolean;

Removed:
- procedure ClearDebugLine(const Line: Integer);
- procedure DeleteDebugLine(const Line: Integer);
- function GetDebugLineCount: Integer;
- function GetDebugLine(const Line: Integer): AnsiString;
- procedure ReplaceDebugLine(const Line: Integer; const Str: AnsiString);
- function GetDebugText: AnsiString;
- procedure GetClientDimensions(out Width, Height: Integer);
- function GetClientWindowHandle: Hwnd;
- procedure SetClientWindowHandle(const H: Hwnd);
- function GetTargetDC: HDC;
- procedure SetTargetDC(const DC: HDC);
- procedure ResetDC;
- procedure SetDesktopAsClient;
- procedure ClickMouseMid(x, y: Integer);
- procedure HoldMouseMid(x, y: Integer);
- procedure ReleaseMouseMid(x, y: Integer);
- function FindBitmap(Bitmap: Integer; var x, y: Integer): Boolean;
- function FindBitmapTolerance(Bitmap: Integer; var x, y: Integer; Tolerance: Integer): Boolean;
- procedure SendKeysVB(const Str: AnsiString; const Wait: Boolean);
- procedure SendArrow(const Key: Byte);
- procedure SendArrowWait(const Key: Byte; const WaitTime: Integer);
- procedure MoveMouseCC(x, y, range, segments, pcount, delay: Integer);
- procedure MoveMouseSmoothFrom(x1, y1, x2, y2: Integer);
- procedure MoveMouseSmoothFromEx(x1, y1, x2, y2: Integer; minsleeptime, maxsleeptime, maxdistance, gravity, forces: Integer);
- procedure MoveMouseSmoothEx(const X, Y, MinSleepTime, MaxSleepTime, MaxDistance, Gravity, Forces: Integer);
- procedure MoveMouseSmooth(const X, Y: Integer);
- procedure ClickWindMouse(X, Y, rx, ry: Integer; Btn: TMouseButton);
- procedure ClickMouseBox(x1, y1, x2, y2: Integer; Btn: TMouseButton);
- procedure MouseBox(x1, y1, x2, y2: Integer);
- procedure SendKeys(const Str: AnsiString);
- procedure TypeKeys(const Str: AnsiString);
- procedure SendKeysWait(const Str: AnsiString; const WaitTime, RndTime: Integer);
- function IsNumpadEnabled: Boolean;
- function IsCapsLockEnabled: Boolean;
- function IsArrowDown(const Num: Byte): Boolean;
- function IsNumpadKeyDown(const Key: Byte): Boolean;
- TMusic
- function CreateMusicPlayer: TMusic;
- function FreeMusicPlayer(const Player: TMusic): Boolean;
- function FindColorSpiral2(var X, Y: Integer; const Color, XS, YS, XE, YE: Integer): Boolean;
- function GetBitmapDC(const Bmp: Integer): HDC;
- function BitmapAssigned(const iBmp: Integer): Boolean;
- function CreateBitmap(const Width, Height, Color: Integer): Integer;
- procedure GetBitmapSize(const Bmp: Integer; out Width, Height: Integer);
- function BitmapToString(Bmp: Integer): AnsiString;
- function BitmapFromString(Width, Height: Integer; str: AnsiString): Integer;
- function FindTransparentBitmap(Bitmap: Integer; var x, y: Integer; TranspCol, xs, ys, xe, ye: Integer): Boolean;
- function FindTransparentBitmapTolerance(Bitmap: Integer; var x, y: Integer; TranspCol, xs, ys, xe, ye, Tol: Integer): Boolean;
- function FreeBitmap(const Bmp: Integer): Boolean;

 

You'll notice that FindTransparentBitmap has been removed, The long name was really bothering me. As a replacement you can now set a TranspColor for a TSCARBitmap object, which will then be ignored in a search. By default the field is set to -1, which means it won't ignore a transparent color.

 

Here's an example of the new system in use:

[scar]var

Bmp: TSCARBitmap;

X, Y: Integer;

begin

Bmp := TSCARBitmap.Create('');

try

Bmp.LoadFromPng('image.png');

Bmp.TranspColor := 0;

if FindBitmap(X, Y, Bmp, 0, 0, 1000, 500) then

WriteLn('Found! (' + IntToStr(X) + ', ' + IntToStr(Y) + ')');

finally

Bmp.Free;

end;

end.[/scar]

 

There's also a new bitmap string encoding format available, but it hasn't been implemented into the bitmap to string tool yet.

Link to comment
Share on other sites

I have been having problems with SCAR's input api today. For 3.34. Do NONE of the Virtual Keys work? I can get SendKeys to work everrrrryyttimmeeee. But never any virtual keys, or {end} in SendKeys. I thought atleast those would work but I guess not. I haven't tried TypeKeys or w/e yet though.

 

I think I'll give your new build a go with my new thing I started making. That TransColor thing reminds of the TForms transparent propertys. Would it be possible to implement alpha blend values somehow?

Link to comment
Share on other sites

I've started work on the new bitmap API. I've created the first new bitmap functions as well, do note that FindBitmapTol doesn't work in this current copy because of a bug, I've already fixed it though, it will work in the next build.

 

New:
- function BoxToStr(const Box: TBox): string;
- RESOURCE_MANAGEMENT preprocessor option (can only disable resourcemanagement for TSCARObject subclasses)
- TSCARClient = class(TSCARObject);
- TSCARWindowClient = class(TSCARClient);
- function GetClient: TSCARClient;
- procedure SetClient(const Client: TSCARClient);
- function DesktopClient: TSCARWindowClient;
- procedure KeyDown(const Key: Char);
- procedure KeyUp(const Key: Char);
- procedure MoveMouseExpert(const X, Y, Gravity, Wind, MinWait, MaxWait, MaxStep, TargetArea: Extended);
- procedure MoveMouseEx(const X, Y, RX, RY, MouseSpeed: Integer);
- procedure MoveMouse(const X, Y: Integer); {MouseSpeed = 25}
- procedure ClickMouseEx(const X, Y: Integer; const Btn: TMouseButton; const Interval: Integer);
- procedure MoveMouseBox(const X1, Y1, X2, Y2: Integer);
- procedure MoveMouseBoxEx(const X1, Y1, X2, Y2, MouseSpeed: Integer);
- procedure PressVKey(const VKey: Byte);
- procedure PressVKeyEx(const VKey: Byte; const Interval: Integer);
- procedure PressKey(const Key: Char);
- procedure PressKeyEx(const Key: Char; const Interval: Integer);
- procedure TypeTextEx(const Str: string; const UseNumpad, UseDelays: Boolean);
- procedure TypeText(const Str: string);
- VK_XBUTTON1, VK_XBUTTON2, VK_CAPITAL, VK_KANA, VK_HANGUL, VK_JUNJA, VK_FINAL, VK_HANJA, VK_KANJI, VK_CONVERT
- VK_NONCONVERT, VK_ACCEPT, VK_MODECHANGE, VK_LWIN, VK_RWIN, VK_APPS, VK_SLEEP, VK_NUMPAD0-VK_NUMPAD9
- VK_F13-VK_F24, VK_NUMLOCK, VK_SCROLL, VK_LSHIFT, VK_RSHIFT, VK_LCONTROL, VK_RCONTROL, VK_LMENU, VK_RMENU
- VK_BROWSER_BACK, VK_BROWSER_FORWARD, VK_BROWSER_REFRESH, VK_BROWSER_STOP, VK_BROWSER_SEARCH, VK_BROWSER_FAVORITES
- VK_BROWSER_HOME, VK_VOLUME_MUTE, VK_VOLUME_DOWN, VK_VOLUME_UP, VK_MEDIA_NEXT_TRACK, VK_MEDIA_PREV_TRACK
- VK_MEDIA_STOP, VK_MEDIA_PLAY_PAUSE, VK_LAUNCH_MAIL, VK_LAUNCH_MEDIA_SELECT, VK_LAUNCH_APP1, VK_LAUNCH_APP2
- function GetKeyState(const VKey: Byte): Boolean;
- function GetCurrentKeyState(const VKey: Byte): Boolean;
- function GetToggleKeyState(const VKey: Byte): Boolean;
- function FindColors(out X, Y: Integer; const Colors: TIntArray; const XS, YS, XE, YE: Integer): Boolean;
- function FindColorsTol(out X, Y: Integer; const Colors: TIntArray; const XS, YS, XE, YE, Tol: Integer): Boolean;
- function FindColorsEx(out Points: TPointArray; const Colors: TIntArray; const XS, YS, XE, YE: Integer): Boolean;
- function FindColorsTolEx(out Points: TPointArray; const Colors: TIntArray; const XS, YS, XE, YE, Tol: Integer): Boolean;
- function FindColorsSpiral(const SX, SY: Integer; out X, Y: Integer; const Colors: TIntArray; const XS, YS, XE, YE: Integer): Boolean;
- function FindColorsSpiralTol(const SX, SY: Integer; out X, Y: Integer; const Colors: TIntArray; const XS, YS, XE, YE, Tol: Integer): Boolean;
- function FindColorsSpiralEx(const SX, SY: Integer; out Points: TPointArray; const Colors: TIntArray; const XS, YS, XE, YE: Integer): Boolean;
- function FindColorsSpiralTolEx(const SX, SY: Integer; out Points: TPointArray; const Colors: TIntArray; const XS, YS, XE, YE, Tol: Integer): Boolean;
- function CountColors(const Colors: TIntArray; const XS, YS, XE, YE: Integer): Integer;
- function CountColorsTol(const Colors: TIntArray; const XS, YS, XE, YE, Tol: Integer): Integer;
- TSCARBitmap = class(TSCARObject);

Tweaks:
- procedure MouseBtnDown(const X, Y: Integer; const Btn: TMouseButton);
- procedure MouseBtnUp(const X, Y: Integer; const Btn: TMouseButton);
- procedure ClickMouse(const X, Y: Integer; const Btn: TMouseButton);
- Renamed:
    * FindBitmapIn -> FindBitmap
    * FindBitmapToleranceIn -> FindBitmapTol
    * HoldMouse -> MouseBtnDown
    * ReleaseMouse -> MouseBtnUp
    * KeyDown -> VKeyDown
    * KeyUp -> VKeyUp
    * GetKeyCode -> CharToVKey
    * MoveMouse -> SetMousePos
    * FindColorTolerance -> FindColorTol
    * FindColors -> FindColorEx
    * FindColorsTolerance -> FindColorTolEx
    * FindColorSpiralTolerance -> FindColorSpiralTol
    * FindColorsSpiralTolerance -> FindColorSpiralTolEx
    * FindColorsSpiral -> FindColorSpiralEx
    * CountColorTolerance -> CountColorTol
- Performance tweak for GetCursorType
- function FindColorSpiral(const SX, SY: Integer; out X, Y: Integer; const Color, XS, YS, XE, YE: Integer): Boolean;
- function FindColorSpiralTol(const SX, SY: Integer; out X, Y: Integer; const Color, XS, YS, XE, YE, Tol: Integer): Boolean;
- function FindBitmap(out X, Y: Integer; const Bmp: TSCARBitmap; const XS, YS, XE, YE: Integer): Boolean;
- function FindBitmapTol(out X, Y: Integer; const Bmp: TSCARBitmap; const XS, YS, XE, YE, Tol: Integer): Boolean;

Removed:
- procedure ClearDebugLine(const Line: Integer);
- procedure DeleteDebugLine(const Line: Integer);
- function GetDebugLineCount: Integer;
- function GetDebugLine(const Line: Integer): AnsiString;
- procedure ReplaceDebugLine(const Line: Integer; const Str: AnsiString);
- function GetDebugText: AnsiString;
- procedure GetClientDimensions(out Width, Height: Integer);
- function GetClientWindowHandle: Hwnd;
- procedure SetClientWindowHandle(const H: Hwnd);
- function GetTargetDC: HDC;
- procedure SetTargetDC(const DC: HDC);
- procedure ResetDC;
- procedure SetDesktopAsClient;
- procedure ClickMouseMid(x, y: Integer);
- procedure HoldMouseMid(x, y: Integer);
- procedure ReleaseMouseMid(x, y: Integer);
- function FindBitmap(Bitmap: Integer; var x, y: Integer): Boolean;
- function FindBitmapTolerance(Bitmap: Integer; var x, y: Integer; Tolerance: Integer): Boolean;
- procedure SendKeysVB(const Str: AnsiString; const Wait: Boolean);
- procedure SendArrow(const Key: Byte);
- procedure SendArrowWait(const Key: Byte; const WaitTime: Integer);
- procedure MoveMouseCC(x, y, range, segments, pcount, delay: Integer);
- procedure MoveMouseSmoothFrom(x1, y1, x2, y2: Integer);
- procedure MoveMouseSmoothFromEx(x1, y1, x2, y2: Integer; minsleeptime, maxsleeptime, maxdistance, gravity, forces: Integer);
- procedure MoveMouseSmoothEx(const X, Y, MinSleepTime, MaxSleepTime, MaxDistance, Gravity, Forces: Integer);
- procedure MoveMouseSmooth(const X, Y: Integer);
- procedure ClickWindMouse(X, Y, rx, ry: Integer; Btn: TMouseButton);
- procedure ClickMouseBox(x1, y1, x2, y2: Integer; Btn: TMouseButton);
- procedure MouseBox(x1, y1, x2, y2: Integer);
- procedure SendKeys(const Str: AnsiString);
- procedure TypeKeys(const Str: AnsiString);
- procedure SendKeysWait(const Str: AnsiString; const WaitTime, RndTime: Integer);
- function IsNumpadEnabled: Boolean;
- function IsCapsLockEnabled: Boolean;
- function IsArrowDown(const Num: Byte): Boolean;
- function IsNumpadKeyDown(const Key: Byte): Boolean;
- TMusic
- function CreateMusicPlayer: TMusic;
- function FreeMusicPlayer(const Player: TMusic): Boolean;
- function FindColorSpiral2(var X, Y: Integer; const Color, XS, YS, XE, YE: Integer): Boolean;
- function GetBitmapDC(const Bmp: Integer): HDC;
- function BitmapAssigned(const iBmp: Integer): Boolean;
- function CreateBitmap(const Width, Height, Color: Integer): Integer;
- procedure GetBitmapSize(const Bmp: Integer; out Width, Height: Integer);
- function BitmapToString(Bmp: Integer): AnsiString;
- function BitmapFromString(Width, Height: Integer; str: AnsiString): Integer;
- function FindTransparentBitmap(Bitmap: Integer; var x, y: Integer; TranspCol, xs, ys, xe, ye: Integer): Boolean;
- function FindTransparentBitmapTolerance(Bitmap: Integer; var x, y: Integer; TranspCol, xs, ys, xe, ye, Tol: Integer): Boolean;
- function FreeBitmap(const Bmp: Integer): Boolean;

 

You'll notice that FindTransparentBitmap has been removed, The long name was really bothering me. As a replacement you can now set a TranspColor for a TSCARBitmap object, which will then be ignored in a search. By default the field is set to -1, which means it won't ignore a transparent color.

 

Here's an example of the new system in use:

[scar]var

Bmp: TSCARBitmap;

X, Y: Integer;

begin

Bmp := TSCARBitmap.Create('');

try

Bmp.LoadFromPng('image.png');

Bmp.TranspColor := 0;

if FindBitmap(X, Y, Bmp, 0, 0, 1000, 500) then

WriteLn('Found! (' + IntToStr(X) + ', ' + IntToStr(Y) + ')');

finally

Bmp.Free;

end;

end.[/scar]

 

There's also a new bitmap string encoding format available, but it hasn't been implemented into the bitmap to string tool yet.

 

 

I absolutely love the new bitmap system! That is tight as hell! Love Love TScarBitmap. =)

Link to comment
Share on other sites

Virtual Keys. {end} support in SendKeys. Windows Docs here on {end} crap.

 

SCAR no longer supports the Visual Basic SendKeys syntax... SendKeys in SCAR never did, only SendKeysVB. As for the virtual key codes, you must be doing something wrong, it works just fine here... You have to use VKeyDown, VKeyUp and PressVKey(Ex) for those.

 

I absolutely love the new bitmap system! That is tight as hell! Love Love TScarBitmap. =)

 

TSCARBitmap has been used internally for quite a few versions, but now I'm exposing, at least part of it to the user.

 

How do you use FindWindow now with 3.35? It won't set the client.

 

I haven't implemented new window finding routines into the system yet.

Link to comment
Share on other sites

SCAR no longer supports the Visual Basic SendKeys syntax... SendKeys in SCAR never did, only SendKeysVB. As for the virtual key codes, you must be doing something wrong, it works just fine here... You have to use VKeyDown, VKeyUp and PressVKey(Ex) for those.

 

Well for the Virtual key codes, i was talking about KeyDown and KeyUp in SCAR 3.34. Couldn't get them to work, but SendKeys worked. It was on this game. Is there a difference in the input? I thought both were virtual? :confused:

 

TSCARBitmap has been used internally for quite a few versions, but now I'm exposing, at least part of it to the user.

 

Ima expose you one day Freddy :P

 

I haven't implemented new window finding routines into the system yet.

 

Once you do you'll make my day.

 

For WINDOWS XP, I'm getting bugs from this version. Every time I open it, my start menu, the Start button, below it becomes see through. It messes up my taskbar somewhat its weird. Also! A big bug is when I select a client with the Crosshairs, sometimes it makes the client go black? It was weird. But it messed up with my firefox and I ended up getting this to happen:

 

Freddys Crosshair.png

 

Told you, YOU'RE NOW EXPOSED FREDDY! B|

 

also say hi to cody.

Edited by LordJashin
Link to comment
Share on other sites

I'm not sure the issues you're experiencing are caused by SCAR, it seems the window isn't redrawn when it should be. As for the taskbar or crosshair, I'm not sure what could be causing that... Do keep in mind that, though I'm not officially dropping support for Windows XP, SCAR Divi 3.25 is designed to run on Windows 7. I don't have any Windows XP installations to test it on properly.

 

As for KeyDown and KeyUp, before 3.35 they used functions which SendKeys/TypeKeys were based on, it's unlikely they don't work if SendKeys works... Have you tried the new functions in 3.35?

Link to comment
Share on other sites

I've uploaded another new copy.

 

New:
- function BoxToStr(const Box: TBox): string;
- RESOURCE_MANAGEMENT preprocessor option (can only disable resourcemanagement for TSCARObject subclasses)
- TSCARClient = class(TSCARObject);
- TSCARWindowClient = class(TSCARClient);
- function GetClient: TSCARClient;
- procedure SetClient(const Client: TSCARClient);
- function DesktopClient: TSCARWindowClient;
- procedure KeyDown(const Key: Char);
- procedure KeyUp(const Key: Char);
- procedure MoveMouseExpert(const X, Y, Gravity, Wind, MinWait, MaxWait, MaxStep, TargetArea: Extended);
- procedure MoveMouseEx(const X, Y, RX, RY, MouseSpeed: Integer);
- procedure MoveMouse(const X, Y: Integer); {MouseSpeed = 25}
- procedure ClickMouseEx(const X, Y: Integer; const Btn: TMouseButton; const Interval: Integer);
- procedure MoveMouseBox(const X1, Y1, X2, Y2: Integer);
- procedure MoveMouseBoxEx(const X1, Y1, X2, Y2, MouseSpeed: Integer);
- procedure PressVKey(const VKey: Byte);
- procedure PressVKeyEx(const VKey: Byte; const Interval: Integer);
- procedure PressKey(const Key: Char);
- procedure PressKeyEx(const Key: Char; const Interval: Integer);
- procedure TypeTextEx(const Str: string; const UseNumpad, UseDelays: Boolean);
- procedure TypeText(const Str: string);
- VK_XBUTTON1, VK_XBUTTON2, VK_CAPITAL, VK_KANA, VK_HANGUL, VK_JUNJA, VK_FINAL, VK_HANJA, VK_KANJI, VK_CONVERT
- VK_NONCONVERT, VK_ACCEPT, VK_MODECHANGE, VK_LWIN, VK_RWIN, VK_APPS, VK_SLEEP, VK_NUMPAD0-VK_NUMPAD9
- VK_F13-VK_F24, VK_NUMLOCK, VK_SCROLL, VK_LSHIFT, VK_RSHIFT, VK_LCONTROL, VK_RCONTROL, VK_LMENU, VK_RMENU
- VK_BROWSER_BACK, VK_BROWSER_FORWARD, VK_BROWSER_REFRESH, VK_BROWSER_STOP, VK_BROWSER_SEARCH, VK_BROWSER_FAVORITES
- VK_BROWSER_HOME, VK_VOLUME_MUTE, VK_VOLUME_DOWN, VK_VOLUME_UP, VK_MEDIA_NEXT_TRACK, VK_MEDIA_PREV_TRACK
- VK_MEDIA_STOP, VK_MEDIA_PLAY_PAUSE, VK_LAUNCH_MAIL, VK_LAUNCH_MEDIA_SELECT, VK_LAUNCH_APP1, VK_LAUNCH_APP2
- function GetKeyState(const VKey: Byte): Boolean;
- function GetCurrentKeyState(const VKey: Byte): Boolean;
- function GetToggleKeyState(const VKey: Byte): Boolean;
- function FindColors(out X, Y: Integer; const Colors: TIntArray; const XS, YS, XE, YE: Integer): Boolean;
- function FindColorsTol(out X, Y: Integer; const Colors: TIntArray; const XS, YS, XE, YE, Tol: Integer): Boolean;
- function FindColorsEx(out Points: TPointArray; const Colors: TIntArray; const XS, YS, XE, YE: Integer): Boolean;
- function FindColorsTolEx(out Points: TPointArray; const Colors: TIntArray; const XS, YS, XE, YE, Tol: Integer): Boolean;
- function FindColorsSpiral(const SX, SY: Integer; out X, Y: Integer; const Colors: TIntArray; const XS, YS, XE, YE: Integer): Boolean;
- function FindColorsSpiralTol(const SX, SY: Integer; out X, Y: Integer; const Colors: TIntArray; const XS, YS, XE, YE, Tol: Integer): Boolean;
- function FindColorsSpiralEx(const SX, SY: Integer; out Points: TPointArray; const Colors: TIntArray; const XS, YS, XE, YE: Integer): Boolean;
- function FindColorsSpiralTolEx(const SX, SY: Integer; out Points: TPointArray; const Colors: TIntArray; const XS, YS, XE, YE, Tol: Integer): Boolean;
- function CountColors(const Colors: TIntArray; const XS, YS, XE, YE: Integer): Integer;
- function CountColorsTol(const Colors: TIntArray; const XS, YS, XE, YE, Tol: Integer): Integer;
- TSCARBitmap = class(TSCARObject);
- procedure FloodFill(const Bmp: TSCARBitmap; const X, Y, Color: Integer);
- procedure FloodFillTol(const Bmp: TSCARBitmap; const X, Y, Color, Tol: Integer);
- function FloodFillEx(const Bmp: TSCARBitmap; const X, Y: Integer): TPointArray;
- function FloodFillTolEx(const Bmp: TSCARBitmap; const X, Y, Tol: Integer): TPointArray;
- procedure TPAFilterTriangle(var TPA: TPointArray; const X1, Y1, X2, Y2, X3, Y3: Integer);
- procedure TPAExtractTriangle(var TPA: TPointArray; const X1, Y1, X2, Y2, X3, Y3: Integer);
- function TPAFromCircle(const Center: TPoint; const Radius: Integer): TPointArray;
- function TPAFromTriangle(const X1, Y1, X2, Y2, X3, Y3: Integer): TPointArray;
- function FindColorTPA(out X, Y: Integer; const Color: Integer; const TPA: TPointArray): Boolean;
- function FindColorTPATol(out X, Y: Integer; const Color: Integer; const TPA: TPointArray; const Tol: Integer): Boolean;

Tweaks:
- procedure MouseBtnDown(const X, Y: Integer; const Btn: TMouseButton);
- procedure MouseBtnUp(const X, Y: Integer; const Btn: TMouseButton);
- procedure ClickMouse(const X, Y: Integer; const Btn: TMouseButton);
- Renamed:
    * FindBitmapIn -> FindBitmap
    * FindBitmapToleranceIn -> FindBitmapTol
    * HoldMouse -> MouseBtnDown
    * ReleaseMouse -> MouseBtnUp
    * KeyDown -> VKeyDown
    * KeyUp -> VKeyUp
    * GetKeyCode -> CharToVKey
    * MoveMouse -> SetMousePos
    * FindColorTolerance -> FindColorTol
    * FindColors -> FindColorEx
    * FindColorsTolerance -> FindColorTolEx
    * FindColorSpiralTolerance -> FindColorSpiralTol
    * FindColorsSpiralTolerance -> FindColorSpiralTolEx
    * FindColorsSpiral -> FindColorSpiralEx
    * CountColorTolerance -> CountColorTol
    * BitmapFromString -> BmpFromStrLegacy
- Performance tweak for GetCursorType
- function FindColorSpiral(const SX, SY: Integer; out X, Y: Integer; const Color, XS, YS, XE, YE: Integer): Boolean;
- function FindColorSpiralTol(const SX, SY: Integer; out X, Y: Integer; const Color, XS, YS, XE, YE, Tol: Integer): Boolean;
- function FindBitmap(out X, Y: Integer; const Bmp: TSCARBitmap; const XS, YS, XE, YE: Integer): Boolean;
- function FindBitmapTol(out X, Y: Integer; const Bmp: TSCARBitmap; const XS, YS, XE, YE, Tol: Integer): Boolean;

Removed:
- procedure ClearDebugLine(const Line: Integer);
- procedure DeleteDebugLine(const Line: Integer);
- function GetDebugLineCount: Integer;
- function GetDebugLine(const Line: Integer): AnsiString;
- procedure ReplaceDebugLine(const Line: Integer; const Str: AnsiString);
- function GetDebugText: AnsiString;
- procedure GetClientDimensions(out Width, Height: Integer);
- function GetClientWindowHandle: Hwnd;
- procedure SetClientWindowHandle(const H: Hwnd);
- function GetTargetDC: HDC;
- procedure SetTargetDC(const DC: HDC);
- procedure ResetDC;
- procedure SetDesktopAsClient;
- procedure ClickMouseMid(x, y: Integer);
- procedure HoldMouseMid(x, y: Integer);
- procedure ReleaseMouseMid(x, y: Integer);
- function FindBitmap(Bitmap: Integer; var x, y: Integer): Boolean;
- function FindBitmapTolerance(Bitmap: Integer; var x, y: Integer; Tolerance: Integer): Boolean;
- procedure SendKeysVB(const Str: AnsiString; const Wait: Boolean);
- procedure SendArrow(const Key: Byte);
- procedure SendArrowWait(const Key: Byte; const WaitTime: Integer);
- procedure MoveMouseCC(x, y, range, segments, pcount, delay: Integer);
- procedure MoveMouseSmoothFrom(x1, y1, x2, y2: Integer);
- procedure MoveMouseSmoothFromEx(x1, y1, x2, y2: Integer; minsleeptime, maxsleeptime, maxdistance, gravity, forces: Integer);
- procedure MoveMouseSmoothEx(const X, Y, MinSleepTime, MaxSleepTime, MaxDistance, Gravity, Forces: Integer);
- procedure MoveMouseSmooth(const X, Y: Integer);
- procedure ClickWindMouse(X, Y, rx, ry: Integer; Btn: TMouseButton);
- procedure ClickMouseBox(x1, y1, x2, y2: Integer; Btn: TMouseButton);
- procedure MouseBox(x1, y1, x2, y2: Integer);
- procedure SendKeys(const Str: AnsiString);
- procedure TypeKeys(const Str: AnsiString);
- procedure SendKeysWait(const Str: AnsiString; const WaitTime, RndTime: Integer);
- function IsNumpadEnabled: Boolean;
- function IsCapsLockEnabled: Boolean;
- function IsArrowDown(const Num: Byte): Boolean;
- function IsNumpadKeyDown(const Key: Byte): Boolean;
- TMusic
- function CreateMusicPlayer: TMusic;
- function FreeMusicPlayer(const Player: TMusic): Boolean;
- function FindColorSpiral2(var X, Y: Integer; const Color, XS, YS, XE, YE: Integer): Boolean;
- function GetBitmapDC(const Bmp: Integer): HDC;
- function BitmapAssigned(const iBmp: Integer): Boolean;
- function CreateBitmap(const Width, Height, Color: Integer): Integer;
- procedure GetBitmapSize(const Bmp: Integer; out Width, Height: Integer);
- function BitmapToString(Bmp: Integer): AnsiString;
- function FindTransparentBitmap(Bitmap: Integer; var x, y: Integer; TranspCol, xs, ys, xe, ye: Integer): Boolean;
- function FindTransparentBitmapTolerance(Bitmap: Integer; var x, y: Integer; TranspCol, xs, ys, xe, ye, Tol: Integer): Boolean;
- function FreeBitmap(const Bmp: Integer): Boolean;
- function CreateMirroredBitmap(const Bmp: Integer): Integer;
- function ResizeBitmap(const Bmp, Width, Height: Integer): Integer;
- function FindColorCircle(out X, Y: Integer; const Color, CX, CY, R: Integer): Boolean;
- function FindColorCircleTolerance(out X, Y: Integer; const Color, CX, CY, R, Tol: Integer): Boolean;
- function FindColorTriangle(out X, Y: Integer; const Color, X1, Y1, X2, Y2, X3, Y3: Integer): Boolean;
- function FindColorTriangleTolerance(out X, Y: Integer; const Color, X1, Y1, X2, Y2, X3, Y3, Tol: Integer): Boolean;
- function FindColorSkipCoords(out X, Y: Integer; const Color, XS, YS, XE, YE: Integer; const TPA: TPointArray): Boolean;
- function FindColorSkipCoordsTolerance(out X, Y: Integer; const Color, XS, YS, XE, YE, Tol: Integer; const TPA: TPointArray): Boolean;
- function FindColorSkipBox(out X, Y: Integer; const Color, XS, YS, XE, YE: Integer; const Box: TBox): Boolean;
- function FindColorSkipBoxTolerance(out X, Y: Integer; const Color, XS, YS, XE, YE, Tol: Integer; const Box: TBox): Boolean;
- function FindColorSkipBoxArray(out X, Y: Integer; const Color, XS, YS, XE, YE: Integer; const TBA: TBoxArray): Boolean;
- function FindColorSkipBoxArrayTolerance(out X, Y: Integer; const Color, XS, YS, XE, YE, Tol: Integer; const TBA: TBoxArray): Boolean;

 

For quite some time I've been wanting to get rid of the FindColor functions with Triangle/Circle areas and SkipPoint/Box exclusions. The reason for this si that the API would simply get huge if I'd have to create a Color(s)(Tol)(Ex) variant for each of these. I've finally come up with what I consider to be a solid solution for this issue. I've removed all of them and added FindColorTPA(Tol) (with more variants to come obviously). This funciton allows you to specify a search area with great precision, as you have to enter a TPA containing the coordinates of each pixel you want to search. You can easily use a new function like TPAFromCircle to create a circle search area to replace FindColorCircle. But you can also combine skipboxes and such with it, using the TPA filter functions and such. So to summarize, these new functions allow you to create any variety of search areas you want, making it extremely flexible.

 

I've also added FloodFill methods to use floodfill on a TSCARBitmap object. These are queue-based rather than recursion-based, so there's no chance of a stack overflow due to the recursion. The Ex variants also return a TPointArray containing all points that have been filled.

Link to comment
Share on other sites

A final upload for today:

New:
- function BoxToStr(const Box: TBox): string;
- RESOURCE_MANAGEMENT preprocessor option (can only disable resourcemanagement for TSCARObject subclasses)
- TSCARClient = class(TSCARObject);
- TSCARWindowClient = class(TSCARClient);
- function GetClient: TSCARClient;
- procedure SetClient(const Client: TSCARClient);
- function DesktopClient: TSCARWindowClient;
- procedure KeyDown(const Key: Char);
- procedure KeyUp(const Key: Char);
- procedure MoveMouseExpert(const X, Y, Gravity, Wind, MinWait, MaxWait, MaxStep, TargetArea: Extended);
- procedure MoveMouseEx(const X, Y, RX, RY, MouseSpeed: Integer);
- procedure MoveMouse(const X, Y: Integer); {MouseSpeed = 25}
- procedure ClickMouseEx(const X, Y: Integer; const Btn: TMouseButton; const Interval: Integer);
- procedure MoveMouseBox(const X1, Y1, X2, Y2: Integer);
- procedure MoveMouseBoxEx(const X1, Y1, X2, Y2, MouseSpeed: Integer);
- procedure PressVKey(const VKey: Byte);
- procedure PressVKeyEx(const VKey: Byte; const Interval: Integer);
- procedure PressKey(const Key: Char);
- procedure PressKeyEx(const Key: Char; const Interval: Integer);
- procedure TypeTextEx(const Str: string; const UseNumpad, UseDelays: Boolean);
- procedure TypeText(const Str: string);
- VK_XBUTTON1, VK_XBUTTON2, VK_CAPITAL, VK_KANA, VK_HANGUL, VK_JUNJA, VK_FINAL, VK_HANJA, VK_KANJI, VK_CONVERT
- VK_NONCONVERT, VK_ACCEPT, VK_MODECHANGE, VK_LWIN, VK_RWIN, VK_APPS, VK_SLEEP, VK_NUMPAD0-VK_NUMPAD9
- VK_F13-VK_F24, VK_NUMLOCK, VK_SCROLL, VK_LSHIFT, VK_RSHIFT, VK_LCONTROL, VK_RCONTROL, VK_LMENU, VK_RMENU
- VK_BROWSER_BACK, VK_BROWSER_FORWARD, VK_BROWSER_REFRESH, VK_BROWSER_STOP, VK_BROWSER_SEARCH, VK_BROWSER_FAVORITES
- VK_BROWSER_HOME, VK_VOLUME_MUTE, VK_VOLUME_DOWN, VK_VOLUME_UP, VK_MEDIA_NEXT_TRACK, VK_MEDIA_PREV_TRACK
- VK_MEDIA_STOP, VK_MEDIA_PLAY_PAUSE, VK_LAUNCH_MAIL, VK_LAUNCH_MEDIA_SELECT, VK_LAUNCH_APP1, VK_LAUNCH_APP2
- function GetKeyState(const VKey: Byte): Boolean;
- function GetCurrentKeyState(const VKey: Byte): Boolean;
- function GetToggleKeyState(const VKey: Byte): Boolean;
- function FindColors(out X, Y: Integer; const Colors: TIntArray; const XS, YS, XE, YE: Integer): Boolean;
- function FindColorsTol(out X, Y: Integer; const Colors: TIntArray; const XS, YS, XE, YE, Tol: Integer): Boolean;
- function FindColorsEx(out Points: TPointArray; const Colors: TIntArray; const XS, YS, XE, YE: Integer): Boolean;
- function FindColorsTolEx(out Points: TPointArray; const Colors: TIntArray; const XS, YS, XE, YE, Tol: Integer): Boolean;
- function FindColorsSpiral(const SX, SY: Integer; out X, Y: Integer; const Colors: TIntArray; const XS, YS, XE, YE: Integer): Boolean;
- function FindColorsSpiralTol(const SX, SY: Integer; out X, Y: Integer; const Colors: TIntArray; const XS, YS, XE, YE, Tol: Integer): Boolean;
- function FindColorsSpiralEx(const SX, SY: Integer; out Points: TPointArray; const Colors: TIntArray; const XS, YS, XE, YE: Integer): Boolean;
- function FindColorsSpiralTolEx(const SX, SY: Integer; out Points: TPointArray; const Colors: TIntArray; const XS, YS, XE, YE, Tol: Integer): Boolean;
- function CountColors(const Colors: TIntArray; const XS, YS, XE, YE: Integer): Integer;
- function CountColorsTol(const Colors: TIntArray; const XS, YS, XE, YE, Tol: Integer): Integer;
- TSCARBitmap = class(TSCARObject);
- procedure FloodFill(const Bmp: TSCARBitmap; const X, Y, Color: Integer);
- procedure FloodFillTol(const Bmp: TSCARBitmap; const X, Y, Color, Tol: Integer);
- function FloodFillEx(const Bmp: TSCARBitmap; const X, Y: Integer): TPointArray;
- function FloodFillTolEx(const Bmp: TSCARBitmap; const X, Y, Tol: Integer): TPointArray;
- procedure TPAFilterTriangle(var TPA: TPointArray; const X1, Y1, X2, Y2, X3, Y3: Integer);
- procedure TPAExtractTriangle(var TPA: TPointArray; const X1, Y1, X2, Y2, X3, Y3: Integer);
- function TPAFromCircle(const Center: TPoint; const Radius: Integer): TPointArray;
- function TPAFromTriangle(const X1, Y1, X2, Y2, X3, Y3: Integer): TPointArray;
- function FindColorTPA(out X, Y: Integer; const Color: Integer; const TPA: TPointArray): Boolean;
- function FindColorTPATol(out X, Y: Integer; const Color: Integer; const TPA: TPointArray; const Tol: Integer): Boolean;
- function FindColorTPAEx(out Points: TPointArray; const Color: Integer; const TPA: TPointArray): Boolean;
- function FindColorTPATolEx(out Points: TPointArray; const Color: Integer; const TPA: TPointArray; const Tol: Integer): Boolean;

Tweaks:
- procedure MouseBtnDown(const X, Y: Integer; const Btn: TMouseButton);
- procedure MouseBtnUp(const X, Y: Integer; const Btn: TMouseButton);
- procedure ClickMouse(const X, Y: Integer; const Btn: TMouseButton);
- Renamed:
    * FindBitmapIn -> FindBitmap
    * FindBitmapToleranceIn -> FindBitmapTol
    * HoldMouse -> MouseBtnDown
    * ReleaseMouse -> MouseBtnUp
    * KeyDown -> VKeyDown
    * KeyUp -> VKeyUp
    * GetKeyCode -> CharToVKey
    * MoveMouse -> SetMousePos
    * FindColorTolerance -> FindColorTol
    * FindColors -> FindColorEx
    * FindColorsTolerance -> FindColorTolEx
    * FindColorSpiralTolerance -> FindColorSpiralTol
    * FindColorsSpiralTolerance -> FindColorSpiralTolEx
    * FindColorsSpiral -> FindColorSpiralEx
    * CountColorTolerance -> CountColorTol
    * BitmapFromString -> BmpFromStrLegacy
- Performance tweak for GetCursorType
- function FindColorSpiral(const SX, SY: Integer; out X, Y: Integer; const Color, XS, YS, XE, YE: Integer): Boolean;
- function FindColorSpiralTol(const SX, SY: Integer; out X, Y: Integer; const Color, XS, YS, XE, YE, Tol: Integer): Boolean;
- function FindBitmap(out X, Y: Integer; const Bmp: TSCARBitmap; const XS, YS, XE, YE: Integer): Boolean;
- function FindBitmapTol(out X, Y: Integer; const Bmp: TSCARBitmap; const XS, YS, XE, YE, Tol: Integer): Boolean;

Removed:
- procedure ClearDebugLine(const Line: Integer);
- procedure DeleteDebugLine(const Line: Integer);
- function GetDebugLineCount: Integer;
- function GetDebugLine(const Line: Integer): AnsiString;
- procedure ReplaceDebugLine(const Line: Integer; const Str: AnsiString);
- function GetDebugText: AnsiString;
- procedure GetClientDimensions(out Width, Height: Integer);
- function GetClientWindowHandle: Hwnd;
- procedure SetClientWindowHandle(const H: Hwnd);
- function GetTargetDC: HDC;
- procedure SetTargetDC(const DC: HDC);
- procedure ResetDC;
- procedure SetDesktopAsClient;
- procedure ClickMouseMid(x, y: Integer);
- procedure HoldMouseMid(x, y: Integer);
- procedure ReleaseMouseMid(x, y: Integer);
- function FindBitmap(Bitmap: Integer; var x, y: Integer): Boolean;
- function FindBitmapTolerance(Bitmap: Integer; var x, y: Integer; Tolerance: Integer): Boolean;
- procedure SendKeysVB(const Str: AnsiString; const Wait: Boolean);
- procedure SendArrow(const Key: Byte);
- procedure SendArrowWait(const Key: Byte; const WaitTime: Integer);
- procedure MoveMouseCC(x, y, range, segments, pcount, delay: Integer);
- procedure MoveMouseSmoothFrom(x1, y1, x2, y2: Integer);
- procedure MoveMouseSmoothFromEx(x1, y1, x2, y2: Integer; minsleeptime, maxsleeptime, maxdistance, gravity, forces: Integer);
- procedure MoveMouseSmoothEx(const X, Y, MinSleepTime, MaxSleepTime, MaxDistance, Gravity, Forces: Integer);
- procedure MoveMouseSmooth(const X, Y: Integer);
- procedure ClickWindMouse(X, Y, rx, ry: Integer; Btn: TMouseButton);
- procedure ClickMouseBox(x1, y1, x2, y2: Integer; Btn: TMouseButton);
- procedure MouseBox(x1, y1, x2, y2: Integer);
- procedure SendKeys(const Str: AnsiString);
- procedure TypeKeys(const Str: AnsiString);
- procedure SendKeysWait(const Str: AnsiString; const WaitTime, RndTime: Integer);
- function IsNumpadEnabled: Boolean;
- function IsCapsLockEnabled: Boolean;
- function IsArrowDown(const Num: Byte): Boolean;
- function IsNumpadKeyDown(const Key: Byte): Boolean;
- TMusic
- function CreateMusicPlayer: TMusic;
- function FreeMusicPlayer(const Player: TMusic): Boolean;
- function FindColorSpiral2(var X, Y: Integer; const Color, XS, YS, XE, YE: Integer): Boolean;
- function GetBitmapDC(const Bmp: Integer): HDC;
- function BitmapAssigned(const iBmp: Integer): Boolean;
- function CreateBitmap(const Width, Height, Color: Integer): Integer;
- procedure GetBitmapSize(const Bmp: Integer; out Width, Height: Integer);
- function BitmapToString(Bmp: Integer): AnsiString;
- function FindTransparentBitmap(Bitmap: Integer; var x, y: Integer; TranspCol, xs, ys, xe, ye: Integer): Boolean;
- function FindTransparentBitmapTolerance(Bitmap: Integer; var x, y: Integer; TranspCol, xs, ys, xe, ye, Tol: Integer): Boolean;
- function FreeBitmap(const Bmp: Integer): Boolean;
- function CreateMirroredBitmap(const Bmp: Integer): Integer;
- function ResizeBitmap(const Bmp, Width, Height: Integer): Integer;
- function FindColorCircle(out X, Y: Integer; const Color, CX, CY, R: Integer): Boolean;
- function FindColorCircleTolerance(out X, Y: Integer; const Color, CX, CY, R, Tol: Integer): Boolean;
- function FindColorTriangle(out X, Y: Integer; const Color, X1, Y1, X2, Y2, X3, Y3: Integer): Boolean;
- function FindColorTriangleTolerance(out X, Y: Integer; const Color, X1, Y1, X2, Y2, X3, Y3, Tol: Integer): Boolean;
- function FindColorSkipCoords(out X, Y: Integer; const Color, XS, YS, XE, YE: Integer; const TPA: TPointArray): Boolean;
- function FindColorSkipCoordsTolerance(out X, Y: Integer; const Color, XS, YS, XE, YE, Tol: Integer; const TPA: TPointArray): Boolean;
- function FindColorSkipBox(out X, Y: Integer; const Color, XS, YS, XE, YE: Integer; const Box: TBox): Boolean;
- function FindColorSkipBoxTolerance(out X, Y: Integer; const Color, XS, YS, XE, YE, Tol: Integer; const Box: TBox): Boolean;
- function FindColorSkipBoxArray(out X, Y: Integer; const Color, XS, YS, XE, YE: Integer; const TBA: TBoxArray): Boolean;
- function FindColorSkipBoxArrayTolerance(out X, Y: Integer; const Color, XS, YS, XE, YE, Tol: Integer; const TBA: TBoxArray): Boolean;

 

Some more stuff was added to TSCARBitmap, like Clone, Assign, AssignTo, Mirror, ...

Assign can assign the data from any TSCARBitmap, TBitmap or TPicture object ot the bitmap, AssignTo does the opposite thing obviously. It's an easy way of copying a bitmap into a different object. Clone and Mirror don't really need much explaining I guess.

 

I've also fixed up the "picture to string" tool, the "string to picture" tool now accepts the new format as well, for the new string, you can ignore the width and height fields. The bitmap updating tool now updates all BitmapFromString bitmaps to the new format. You'll have to change the types and implementation manually though. I'll be making a post about the new format soon. It's basically the same as the previous one, but the raw string is encoded as:

{
 Width, 2 bytes
 Height, 2 bytes
 {
   RGB, 3 bytes
 }, #pixels times
}

Link to comment
Share on other sites

Some more work on the API and stuff today:

New:
- function BoxToStr(const Box: TBox): string;
- RESOURCE_MANAGEMENT preprocessor option (can only disable resourcemanagement for TSCARObject subclasses)
- TSCARClient = class(TSCARObject);
- TSCARWindowClient = class(TSCARClient);
- function GetClient: TSCARClient;
- procedure SetClient(const Client: TSCARClient);
- function DesktopClient: TSCARWindowClient;
- procedure KeyDown(const Key: Char);
- procedure KeyUp(const Key: Char);
- procedure MoveMouseExpert(const X, Y, Gravity, Wind, MinWait, MaxWait, MaxStep, TargetArea: Extended);
- procedure MoveMouseEx(const X, Y, RX, RY, MouseSpeed: Integer);
- procedure MoveMouse(const X, Y: Integer); {MouseSpeed = 25}
- procedure ClickMouseEx(const X, Y: Integer; const Btn: TMouseButton; const Interval: Integer);
- procedure MoveMouseBox(const X1, Y1, X2, Y2: Integer);
- procedure MoveMouseBoxEx(const X1, Y1, X2, Y2, MouseSpeed: Integer);
- procedure PressVKey(const VKey: Byte);
- procedure PressVKeyEx(const VKey: Byte; const Interval: Integer);
- procedure PressKey(const Key: Char);
- procedure PressKeyEx(const Key: Char; const Interval: Integer);
- procedure TypeTextEx(const Str: string; const UseNumpad, UseDelays: Boolean);
- procedure TypeText(const Str: string);
- VK_XBUTTON1, VK_XBUTTON2, VK_CAPITAL, VK_KANA, VK_HANGUL, VK_JUNJA, VK_FINAL, VK_HANJA, VK_KANJI, VK_CONVERT
- VK_NONCONVERT, VK_ACCEPT, VK_MODECHANGE, VK_LWIN, VK_RWIN, VK_APPS, VK_SLEEP, VK_NUMPAD0-VK_NUMPAD9
- VK_F13-VK_F24, VK_NUMLOCK, VK_SCROLL, VK_LSHIFT, VK_RSHIFT, VK_LCONTROL, VK_RCONTROL, VK_LMENU, VK_RMENU
- VK_BROWSER_BACK, VK_BROWSER_FORWARD, VK_BROWSER_REFRESH, VK_BROWSER_STOP, VK_BROWSER_SEARCH, VK_BROWSER_FAVORITES
- VK_BROWSER_HOME, VK_VOLUME_MUTE, VK_VOLUME_DOWN, VK_VOLUME_UP, VK_MEDIA_NEXT_TRACK, VK_MEDIA_PREV_TRACK
- VK_MEDIA_STOP, VK_MEDIA_PLAY_PAUSE, VK_LAUNCH_MAIL, VK_LAUNCH_MEDIA_SELECT, VK_LAUNCH_APP1, VK_LAUNCH_APP2
- function GetKeyState(const VKey: Byte): Boolean;
- function GetCurrentKeyState(const VKey: Byte): Boolean;
- function GetToggleKeyState(const VKey: Byte): Boolean;
- function FindColors(out X, Y: Integer; const Colors: TIntArray; const XS, YS, XE, YE: Integer): Boolean;
- function FindColorsTol(out X, Y: Integer; const Colors: TIntArray; const XS, YS, XE, YE, Tol: Integer): Boolean;
- function FindColorsEx(out Points: TPointArray; const Colors: TIntArray; const XS, YS, XE, YE: Integer): Boolean;
- function FindColorsTolEx(out Points: TPointArray; const Colors: TIntArray; const XS, YS, XE, YE, Tol: Integer): Boolean;
- function FindColorsSpiral(const SX, SY: Integer; out X, Y: Integer; const Colors: TIntArray; const XS, YS, XE, YE: Integer): Boolean;
- function FindColorsSpiralTol(const SX, SY: Integer; out X, Y: Integer; const Colors: TIntArray; const XS, YS, XE, YE, Tol: Integer): Boolean;
- function FindColorsSpiralEx(const SX, SY: Integer; out Points: TPointArray; const Colors: TIntArray; const XS, YS, XE, YE: Integer): Boolean;
- function FindColorsSpiralTolEx(const SX, SY: Integer; out Points: TPointArray; const Colors: TIntArray; const XS, YS, XE, YE, Tol: Integer): Boolean;
- function CountColors(const Colors: TIntArray; const XS, YS, XE, YE: Integer): Integer;
- function CountColorsTol(const Colors: TIntArray; const XS, YS, XE, YE, Tol: Integer): Integer;
- TSCARBitmap = class(TSCARObject);
- procedure FloodFill(const Bmp: TSCARBitmap; const X, Y, Color: Integer);
- procedure FloodFillTol(const Bmp: TSCARBitmap; const X, Y, Color, Tol: Integer);
- function FloodFillEx(const Bmp: TSCARBitmap; const X, Y: Integer): TPointArray;
- function FloodFillTolEx(const Bmp: TSCARBitmap; const X, Y, Tol: Integer): TPointArray;
- procedure TPAFilterTriangle(var TPA: TPointArray; const X1, Y1, X2, Y2, X3, Y3: Integer);
- procedure TPAExtractTriangle(var TPA: TPointArray; const X1, Y1, X2, Y2, X3, Y3: Integer);
- function TPAFromCircle(const Center: TPoint; const Radius: Integer): TPointArray;
- function TPAFromTriangle(const X1, Y1, X2, Y2, X3, Y3: Integer): TPointArray;
- function FindColorTPA(out X, Y: Integer; const Color: Integer; const TPA: TPointArray): Boolean;
- function FindColorTPATol(out X, Y: Integer; const Color: Integer; const TPA: TPointArray; const Tol: Integer): Boolean;
- function FindColorTPAEx(out Points: TPointArray; const Color: Integer; const TPA: TPointArray): Boolean;
- function FindColorTPATolEx(out Points: TPointArray; const Color: Integer; const TPA: TPointArray; const Tol: Integer): Boolean;
- function GetMouseBtnState(const Btn: TMouseButton): Boolean;

Tweaks:
- procedure MouseBtnDown(const X, Y: Integer; const Btn: TMouseButton);
- procedure MouseBtnUp(const X, Y: Integer; const Btn: TMouseButton);
- procedure ClickMouse(const X, Y: Integer; const Btn: TMouseButton);
- Renamed:
    * FindBitmapIn -> FindBitmap
    * FindBitmapToleranceIn -> FindBitmapTol
    * HoldMouse -> MouseBtnDown
    * ReleaseMouse -> MouseBtnUp
    * KeyDown -> VKeyDown
    * KeyUp -> VKeyUp
    * GetKeyCode -> CharToVKey
    * MoveMouse -> SetMousePos
    * FindColorTolerance -> FindColorTol
    * FindColors -> FindColorEx
    * FindColorsTolerance -> FindColorTolEx
    * FindColorSpiralTolerance -> FindColorSpiralTol
    * FindColorsSpiralTolerance -> FindColorSpiralTolEx
    * FindColorsSpiral -> FindColorSpiralEx
    * CountColorTolerance -> CountColorTol
    * BitmapFromString -> BmpFromStrLegacy
- Performance tweak for GetCursorType
- function FindColorSpiral(const SX, SY: Integer; out X, Y: Integer; const Color, XS, YS, XE, YE: Integer): Boolean;
- function FindColorSpiralTol(const SX, SY: Integer; out X, Y: Integer; const Color, XS, YS, XE, YE, Tol: Integer): Boolean;
- function FindBitmap(out X, Y: Integer; const Bmp: TSCARBitmap; const XS, YS, XE, YE: Integer): Boolean;
- function FindBitmapTol(out X, Y: Integer; const Bmp: TSCARBitmap; const XS, YS, XE, YE, Tol: Integer): Boolean;
- procedure DebugBitmap(const Bmp: TSCARBitmap);
- procedure SafeDrawBitmap(const Source: TSCARBitmap; const Dest: TCanvas; const X, Y: Integer);

Removed:
- procedure ClearDebugLine(const Line: Integer);
- procedure DeleteDebugLine(const Line: Integer);
- function GetDebugLineCount: Integer;
- function GetDebugLine(const Line: Integer): AnsiString;
- procedure ReplaceDebugLine(const Line: Integer; const Str: AnsiString);
- function GetDebugText: AnsiString;
- procedure GetClientDimensions(out Width, Height: Integer);
- function GetClientWindowHandle: Hwnd;
- procedure SetClientWindowHandle(const H: Hwnd);
- function GetTargetDC: HDC;
- procedure SetTargetDC(const DC: HDC);
- procedure ResetDC;
- procedure SetDesktopAsClient;
- procedure ClickMouseMid(x, y: Integer);
- procedure HoldMouseMid(x, y: Integer);
- procedure ReleaseMouseMid(x, y: Integer);
- function FindBitmap(Bitmap: Integer; var x, y: Integer): Boolean;
- function FindBitmapTolerance(Bitmap: Integer; var x, y: Integer; Tolerance: Integer): Boolean;
- procedure SendKeysVB(const Str: AnsiString; const Wait: Boolean);
- procedure SendArrow(const Key: Byte);
- procedure SendArrowWait(const Key: Byte; const WaitTime: Integer);
- procedure MoveMouseCC(x, y, range, segments, pcount, delay: Integer);
- procedure MoveMouseSmoothFrom(x1, y1, x2, y2: Integer);
- procedure MoveMouseSmoothFromEx(x1, y1, x2, y2: Integer; minsleeptime, maxsleeptime, maxdistance, gravity, forces: Integer);
- procedure MoveMouseSmoothEx(const X, Y, MinSleepTime, MaxSleepTime, MaxDistance, Gravity, Forces: Integer);
- procedure MoveMouseSmooth(const X, Y: Integer);
- procedure ClickWindMouse(X, Y, rx, ry: Integer; Btn: TMouseButton);
- procedure ClickMouseBox(x1, y1, x2, y2: Integer; Btn: TMouseButton);
- procedure MouseBox(x1, y1, x2, y2: Integer);
- procedure SendKeys(const Str: AnsiString);
- procedure TypeKeys(const Str: AnsiString);
- procedure SendKeysWait(const Str: AnsiString; const WaitTime, RndTime: Integer);
- function IsNumpadEnabled: Boolean;
- function IsCapsLockEnabled: Boolean;
- function IsArrowDown(const Num: Byte): Boolean;
- function IsNumpadKeyDown(const Key: Byte): Boolean;
- TMusic
- function CreateMusicPlayer: TMusic;
- function FreeMusicPlayer(const Player: TMusic): Boolean;
- function FindColorSpiral2(var X, Y: Integer; const Color, XS, YS, XE, YE: Integer): Boolean;
- function GetBitmapDC(const Bmp: Integer): HDC;
- function BitmapAssigned(const iBmp: Integer): Boolean;
- function CreateBitmap(const Width, Height, Color: Integer): Integer;
- procedure GetBitmapSize(const Bmp: Integer; out Width, Height: Integer);
- function BitmapToString(Bmp: Integer): AnsiString;
- function FindTransparentBitmap(Bitmap: Integer; var x, y: Integer; TranspCol, xs, ys, xe, ye: Integer): Boolean;
- function FindTransparentBitmapTolerance(Bitmap: Integer; var x, y: Integer; TranspCol, xs, ys, xe, ye, Tol: Integer): Boolean;
- function FreeBitmap(const Bmp: Integer): Boolean;
- function CreateMirroredBitmap(const Bmp: Integer): Integer;
- function ResizeBitmap(const Bmp, Width, Height: Integer): Integer;
- function FindColorCircle(out X, Y: Integer; const Color, CX, CY, R: Integer): Boolean;
- function FindColorCircleTolerance(out X, Y: Integer; const Color, CX, CY, R, Tol: Integer): Boolean;
- function FindColorTriangle(out X, Y: Integer; const Color, X1, Y1, X2, Y2, X3, Y3: Integer): Boolean;
- function FindColorTriangleTolerance(out X, Y: Integer; const Color, X1, Y1, X2, Y2, X3, Y3, Tol: Integer): Boolean;
- function FindColorSkipCoords(out X, Y: Integer; const Color, XS, YS, XE, YE: Integer; const TPA: TPointArray): Boolean;
- function FindColorSkipCoordsTolerance(out X, Y: Integer; const Color, XS, YS, XE, YE, Tol: Integer; const TPA: TPointArray): Boolean;
- function FindColorSkipBox(out X, Y: Integer; const Color, XS, YS, XE, YE: Integer; const Box: TBox): Boolean;
- function FindColorSkipBoxTolerance(out X, Y: Integer; const Color, XS, YS, XE, YE, Tol: Integer; const Box: TBox): Boolean;
- function FindColorSkipBoxArray(out X, Y: Integer; const Color, XS, YS, XE, YE: Integer; const TBA: TBoxArray): Boolean;
- function FindColorSkipBoxArrayTolerance(out X, Y: Integer; const Color, XS, YS, XE, YE, Tol: Integer; const TBA: TBoxArray): Boolean;
- function IsMouseButtonDown(LeftButton: Boolean): Boolean;
- function IsFunctionKeyDown(Key: Byte): Boolean;
- function IsFKeyDown(Num: Byte): Boolean;
- function IsKeyDown(C: Char): Boolean;
- function GetBitmapCanvas(bitmap: Integer): TCanvas;
- function LoadBitmap(path: AnsiString): Integer;
- procedure SaveBitmap(bitmap: Integer; path: AnsiString);
- function GetBitmapCanvas(bitmap: Integer): TCanvas;

Link to comment
Share on other sites

Here's the latest changelog from the copy I just uploaded, I'll be uploading a video shortly showcasing some/most of the changes.

 

Bugfixes:
- The study wasn't implemented correctly in the preg functions.

New:
- function BoxToStr(const Box: TBox): string;
- RESOURCE_MANAGEMENT preprocessor option (can only disable resourcemanagement for TSCARObject subclasses)
- TSCARClient = class(TSCARObject);
- TSCARWindowClient = class(TSCARClient);
- function GetClient: TSCARClient;
- procedure SetClient(const Client: TSCARClient);
- procedure KeyDown(const Key: Char);
- procedure KeyUp(const Key: Char);
- procedure MoveMouseExpert(const X, Y, Gravity, Wind, MinWait, MaxWait, MaxStep, TargetArea: Extended);
- procedure MoveMouseEx(const X, Y, RX, RY, MouseSpeed: Integer);
- procedure MoveMouse(const X, Y: Integer); {MouseSpeed = 25}
- procedure ClickMouseEx(const X, Y: Integer; const Btn: TMouseButton; const Interval: Integer);
- procedure MoveMouseBox(const X1, Y1, X2, Y2: Integer);
- procedure MoveMouseBoxEx(const X1, Y1, X2, Y2, MouseSpeed: Integer);
- procedure PressVKey(const VKey: Byte);
- procedure PressVKeyEx(const VKey: Byte; const Interval: Integer);
- procedure PressKey(const Key: Char);
- procedure PressKeyEx(const Key: Char; const Interval: Integer);
- procedure TypeTextEx(const Str: string; const UseNumpad, UseDelays: Boolean);
- procedure TypeText(const Str: string);
- VK_XBUTTON1, VK_XBUTTON2, VK_CAPITAL, VK_KANA, VK_HANGUL, VK_JUNJA, VK_FINAL, VK_HANJA, VK_KANJI, VK_CONVERT
- VK_NONCONVERT, VK_ACCEPT, VK_MODECHANGE, VK_LWIN, VK_RWIN, VK_APPS, VK_SLEEP, VK_NUMPAD0-VK_NUMPAD9
- VK_F13-VK_F24, VK_NUMLOCK, VK_SCROLL, VK_LSHIFT, VK_RSHIFT, VK_LCONTROL, VK_RCONTROL, VK_LMENU, VK_RMENU
- VK_BROWSER_BACK, VK_BROWSER_FORWARD, VK_BROWSER_REFRESH, VK_BROWSER_STOP, VK_BROWSER_SEARCH, VK_BROWSER_FAVORITES
- VK_BROWSER_HOME, VK_VOLUME_MUTE, VK_VOLUME_DOWN, VK_VOLUME_UP, VK_MEDIA_NEXT_TRACK, VK_MEDIA_PREV_TRACK
- VK_MEDIA_STOP, VK_MEDIA_PLAY_PAUSE, VK_LAUNCH_MAIL, VK_LAUNCH_MEDIA_SELECT, VK_LAUNCH_APP1, VK_LAUNCH_APP2
- function GetKeyState(const VKey: Byte): Boolean;
- function GetCurrentKeyState(const VKey: Byte): Boolean;
- function GetToggleKeyState(const VKey: Byte): Boolean;
- function FindColors(out X, Y: Integer; const Colors: TIntArray; const XS, YS, XE, YE: Integer): Boolean;
- function FindColorsTol(out X, Y: Integer; const Colors: TIntArray; const XS, YS, XE, YE, Tol: Integer): Boolean;
- function FindColorsEx(out Points: TPointArray; const Colors: TIntArray; const XS, YS, XE, YE: Integer): Boolean;
- function FindColorsTolEx(out Points: TPointArray; const Colors: TIntArray; const XS, YS, XE, YE, Tol: Integer): Boolean;
- function FindColorsSpiral(const SX, SY: Integer; out X, Y: Integer; const Colors: TIntArray; const XS, YS, XE, YE: Integer): Boolean;
- function FindColorsSpiralTol(const SX, SY: Integer; out X, Y: Integer; const Colors: TIntArray; const XS, YS, XE, YE, Tol: Integer): Boolean;
- function FindColorsSpiralEx(const SX, SY: Integer; out Points: TPointArray; const Colors: TIntArray; const XS, YS, XE, YE: Integer): Boolean;
- function FindColorsSpiralTolEx(const SX, SY: Integer; out Points: TPointArray; const Colors: TIntArray; const XS, YS, XE, YE, Tol: Integer): Boolean;
- function CountColors(const Colors: TIntArray; const XS, YS, XE, YE: Integer): Integer;
- function CountColorsTol(const Colors: TIntArray; const XS, YS, XE, YE, Tol: Integer): Integer;
- TSCARBitmap = class(TSCARObject);
- procedure FloodFill(const Bmp: TSCARBitmap; const X, Y, Color: Integer);
- procedure FloodFillTol(const Bmp: TSCARBitmap; const X, Y, Color, Tol: Integer);
- function FloodFillEx(const Bmp: TSCARBitmap; const X, Y: Integer): TPointArray;
- function FloodFillTolEx(const Bmp: TSCARBitmap; const X, Y, Tol: Integer): TPointArray;
- procedure TPAFilterTriangle(var TPA: TPointArray; const X1, Y1, X2, Y2, X3, Y3: Integer);
- procedure TPAExtractTriangle(var TPA: TPointArray; const X1, Y1, X2, Y2, X3, Y3: Integer);
- function TPAFromCircle(const Center: TPoint; const Radius: Integer): TPointArray;
- function TPAFromTriangle(const X1, Y1, X2, Y2, X3, Y3: Integer): TPointArray;
- function FindColorTPA(out X, Y: Integer; const Color: Integer; const TPA: TPointArray): Boolean;
- function FindColorTPATol(out X, Y: Integer; const Color: Integer; const TPA: TPointArray; const Tol: Integer): Boolean;
- function FindColorTPAEx(out Points: TPointArray; const Color: Integer; const TPA: TPointArray): Boolean;
- function FindColorTPATolEx(out Points: TPointArray; const Color: Integer; const TPA: TPointArray; const Tol: Integer): Boolean;
- function GetMouseBtnState(const Btn: TMouseButton): Boolean;
- function GetDesktopWnd: Hwnd;
- function GetShellWnd: Hwnd;
- function FindWindows(const Title: string): THwndArray;
- function FindWindowsEx(const ParentWnd: Hwnd; const Title, ClassName: string; const RecursiveSearch, CaseSensitive, PartialMatch: Boolean): THwndArray;
- function FindWindowsPreg(const ParentWnd: Hwnd; const TitlePattern, ClassNamePattern: string; const RecursiveSearch: Boolean): THwndArray;
- function GetParentWnd(const Wnd: Hwnd): Hwnd;
- function WrapText(const Str: string; const MaxColumnSize: Integer): string;

Tweaks:
- procedure MouseBtnDown(const X, Y: Integer; const Btn: TMouseButton);
- procedure MouseBtnUp(const X, Y: Integer; const Btn: TMouseButton);
- procedure ClickMouse(const X, Y: Integer; const Btn: TMouseButton);
- Renamed:
    * FindBitmapIn -> FindBitmap
    * FindBitmapToleranceIn -> FindBitmapTol
    * HoldMouse -> MouseBtnDown
    * ReleaseMouse -> MouseBtnUp
    * KeyDown -> VKeyDown
    * KeyUp -> VKeyUp
    * GetKeyCode -> CharToVKey
    * MoveMouse -> SetMousePos
    * FindColorTolerance -> FindColorTol
    * FindColors -> FindColorEx
    * FindColorsTolerance -> FindColorTolEx
    * FindColorSpiralTolerance -> FindColorSpiralTol
    * FindColorsSpiralTolerance -> FindColorSpiralTolEx
    * FindColorsSpiral -> FindColorSpiralEx
    * CountColorTolerance -> CountColorTol
    * BitmapFromString -> BmpFromStrLegacy
- Performance tweak for GetCursorType
- function FindColorSpiral(const SX, SY: Integer; out X, Y: Integer; const Color, XS, YS, XE, YE: Integer): Boolean;
- function FindColorSpiralTol(const SX, SY: Integer; out X, Y: Integer; const Color, XS, YS, XE, YE, Tol: Integer): Boolean;
- function FindBitmap(out X, Y: Integer; const Bmp: TSCARBitmap; const XS, YS, XE, YE: Integer): Boolean;
- function FindBitmapTol(out X, Y: Integer; const Bmp: TSCARBitmap; const XS, YS, XE, YE, Tol: Integer): Boolean;
- procedure DebugBitmap(const Bmp: TSCARBitmap);
- procedure SafeDrawBitmap(const Source: TSCARBitmap; const Dest: TCanvas; const X, Y: Integer);

Removed:
- procedure ClearDebugLine(const Line: Integer);
- procedure DeleteDebugLine(const Line: Integer);
- function GetDebugLineCount: Integer;
- function GetDebugLine(const Line: Integer): AnsiString;
- procedure ReplaceDebugLine(const Line: Integer; const Str: AnsiString);
- function GetDebugText: AnsiString;
- procedure GetClientDimensions(out Width, Height: Integer);
- function GetClientWindowHandle: Hwnd;
- procedure SetClientWindowHandle(const H: Hwnd);
- function GetTargetDC: HDC;
- procedure SetTargetDC(const DC: HDC);
- procedure ResetDC;
- procedure SetDesktopAsClient;
- procedure ClickMouseMid(x, y: Integer);
- procedure HoldMouseMid(x, y: Integer);
- procedure ReleaseMouseMid(x, y: Integer);
- function FindBitmap(Bitmap: Integer; var x, y: Integer): Boolean;
- function FindBitmapTolerance(Bitmap: Integer; var x, y: Integer; Tolerance: Integer): Boolean;
- procedure SendKeysVB(const Str: AnsiString; const Wait: Boolean);
- procedure SendArrow(const Key: Byte);
- procedure SendArrowWait(const Key: Byte; const WaitTime: Integer);
- procedure MoveMouseCC(x, y, range, segments, pcount, delay: Integer);
- procedure MoveMouseSmoothFrom(x1, y1, x2, y2: Integer);
- procedure MoveMouseSmoothFromEx(x1, y1, x2, y2: Integer; minsleeptime, maxsleeptime, maxdistance, gravity, forces: Integer);
- procedure MoveMouseSmoothEx(const X, Y, MinSleepTime, MaxSleepTime, MaxDistance, Gravity, Forces: Integer);
- procedure MoveMouseSmooth(const X, Y: Integer);
- procedure ClickWindMouse(X, Y, rx, ry: Integer; Btn: TMouseButton);
- procedure ClickMouseBox(x1, y1, x2, y2: Integer; Btn: TMouseButton);
- procedure MouseBox(x1, y1, x2, y2: Integer);
- procedure SendKeys(const Str: AnsiString);
- procedure TypeKeys(const Str: AnsiString);
- procedure SendKeysWait(const Str: AnsiString; const WaitTime, RndTime: Integer);
- function IsNumpadEnabled: Boolean;
- function IsCapsLockEnabled: Boolean;
- function IsArrowDown(const Num: Byte): Boolean;
- function IsNumpadKeyDown(const Key: Byte): Boolean;
- TMusic
- function CreateMusicPlayer: TMusic;
- function FreeMusicPlayer(const Player: TMusic): Boolean;
- function FindColorSpiral2(var X, Y: Integer; const Color, XS, YS, XE, YE: Integer): Boolean;
- function GetBitmapDC(const Bmp: Integer): HDC;
- function BitmapAssigned(const iBmp: Integer): Boolean;
- function CreateBitmap(const Width, Height, Color: Integer): Integer;
- procedure GetBitmapSize(const Bmp: Integer; out Width, Height: Integer);
- function BitmapToString(Bmp: Integer): AnsiString;
- function FindTransparentBitmap(Bitmap: Integer; var x, y: Integer; TranspCol, xs, ys, xe, ye: Integer): Boolean;
- function FindTransparentBitmapTolerance(Bitmap: Integer; var x, y: Integer; TranspCol, xs, ys, xe, ye, Tol: Integer): Boolean;
- function FreeBitmap(const Bmp: Integer): Boolean;
- function CreateMirroredBitmap(const Bmp: Integer): Integer;
- function ResizeBitmap(const Bmp, Width, Height: Integer): Integer;
- function FindColorCircle(out X, Y: Integer; const Color, CX, CY, R: Integer): Boolean;
- function FindColorCircleTolerance(out X, Y: Integer; const Color, CX, CY, R, Tol: Integer): Boolean;
- function FindColorTriangle(out X, Y: Integer; const Color, X1, Y1, X2, Y2, X3, Y3: Integer): Boolean;
- function FindColorTriangleTolerance(out X, Y: Integer; const Color, X1, Y1, X2, Y2, X3, Y3, Tol: Integer): Boolean;
- function FindColorSkipCoords(out X, Y: Integer; const Color, XS, YS, XE, YE: Integer; const TPA: TPointArray): Boolean;
- function FindColorSkipCoordsTolerance(out X, Y: Integer; const Color, XS, YS, XE, YE, Tol: Integer; const TPA: TPointArray): Boolean;
- function FindColorSkipBox(out X, Y: Integer; const Color, XS, YS, XE, YE: Integer; const Box: TBox): Boolean;
- function FindColorSkipBoxTolerance(out X, Y: Integer; const Color, XS, YS, XE, YE, Tol: Integer; const Box: TBox): Boolean;
- function FindColorSkipBoxArray(out X, Y: Integer; const Color, XS, YS, XE, YE: Integer; const TBA: TBoxArray): Boolean;
- function FindColorSkipBoxArrayTolerance(out X, Y: Integer; const Color, XS, YS, XE, YE, Tol: Integer; const TBA: TBoxArray): Boolean;
- function IsMouseButtonDown(LeftButton: Boolean): Boolean;
- function IsFunctionKeyDown(Key: Byte): Boolean;
- function IsFKeyDown(Num: Byte): Boolean;
- function IsKeyDown(C: Char): Boolean;
- function GetBitmapCanvas(bitmap: Integer): TCanvas;
- function LoadBitmap(path: AnsiString): Integer;
- procedure SaveBitmap(bitmap: Integer; path: AnsiString);
- function GetBitmapCanvas(bitmap: Integer): TCanvas;
- function RegexPos(const Subject, Pattern: AnsiString): Integer;
- function FindRegex(const Subject, Pattern: AnsiString): AnsiString;
- function ReplaceRegex(const Subject, Pattern, Replacement: AnsiString): AnsiString;
- function FindWindowTitlePart(Title: AnsiString; CaseSensitive: Boolean): Boolean;
- function TBitmapFromBmp(Bitmap: TBitmap; Bmp: Integer): Boolean;
- function GetBitmapAreaColors(xs, ys, xe, ye: Integer): T2DIntArray;
- procedure CopyClientToBitmap(bitmap: Integer; xs, ys, xe, ye: Integer);

Link to comment
Share on other sites

Ive started to work on porting the GMRL include system so it will be able to work with the new API but im still wondering what is going to go on with plugins and bitmaps. How is that going to work?

 

 

~ShadowRecon

 

Well, so far I've tried to keep plugins backwards compatible. Normally you shouldn't have to change a thing. But I will be pushing out a new plugin format in the (near) future, with a lot more functionality.

Link to comment
Share on other sites

Well, so far I've tried to keep plugins backwards compatible. Normally you shouldn't have to change a thing. But I will be pushing out a new plugin format in the (near) future, with a lot more functionality.

 

so how are TSCARbitmaps going to be passed? Would i just insert the DC of the bitmap and send it through as the int like its been done?

 

[scar]

Var

BMP: TSCARBitmap;

begin

BMP := TSCARBitmap.Create('');

PluginBitmapFunction(BMP.DC);

end.

[/scar]

Link to comment
Share on other sites

For the current plugin architecture, you have to cast the TSCARBitmap objects to an Integer. The integers which are accepted by the functions in the plugin system now use the integer pointer to the objects. So basically, nothing has to be changes in your plugin.

 

I've also uploaded a new copy, hopefully the last one before the Alpha copy.

Bugfixes:
- The study modifier wasn't implemented correctly in the preg functions.

New:
- function BoxToStr(const Box: TBox): string;
- RESOURCE_MANAGEMENT preprocessor option (can only disable resourcemanagement for TSCARObject subclasses)
- TSCARClient = class(TSCARObject);
- TSCARWindowClient = class(TSCARClient);
- function GetClient: TSCARClient;
- procedure SetClient(const Client: TSCARClient);
- procedure KeyDown(const Key: Char);
- procedure KeyUp(const Key: Char);
- procedure MoveMouseExpert(const X, Y, Gravity, Wind, MinWait, MaxWait, MaxStep, TargetArea: Extended);
- procedure MoveMouseEx(const X, Y, RX, RY, MouseSpeed: Integer);
- procedure MoveMouse(const X, Y: Integer); {MouseSpeed = 25}
- procedure ClickMouseEx(const X, Y: Integer; const Btn: TMouseButton; const Interval: Integer);
- procedure MoveMouseBox(const X1, Y1, X2, Y2: Integer);
- procedure MoveMouseBoxEx(const X1, Y1, X2, Y2, MouseSpeed: Integer);
- procedure PressVKey(const VKey: Byte);
- procedure PressVKeyEx(const VKey: Byte; const Interval: Integer);
- procedure PressKey(const Key: Char);
- procedure PressKeyEx(const Key: Char; const Interval: Integer);
- procedure TypeTextEx(const Str: string; const UseNumpad, UseDelays: Boolean);
- procedure TypeText(const Str: string);
- VK_XBUTTON1, VK_XBUTTON2, VK_CAPITAL, VK_KANA, VK_HANGUL, VK_JUNJA, VK_FINAL, VK_HANJA, VK_KANJI, VK_CONVERT
- VK_NONCONVERT, VK_ACCEPT, VK_MODECHANGE, VK_LWIN, VK_RWIN, VK_APPS, VK_SLEEP, VK_NUMPAD0-VK_NUMPAD9
- VK_F13-VK_F24, VK_NUMLOCK, VK_SCROLL, VK_LSHIFT, VK_RSHIFT, VK_LCONTROL, VK_RCONTROL, VK_LMENU, VK_RMENU
- VK_BROWSER_BACK, VK_BROWSER_FORWARD, VK_BROWSER_REFRESH, VK_BROWSER_STOP, VK_BROWSER_SEARCH, VK_BROWSER_FAVORITES
- VK_BROWSER_HOME, VK_VOLUME_MUTE, VK_VOLUME_DOWN, VK_VOLUME_UP, VK_MEDIA_NEXT_TRACK, VK_MEDIA_PREV_TRACK
- VK_MEDIA_STOP, VK_MEDIA_PLAY_PAUSE, VK_LAUNCH_MAIL, VK_LAUNCH_MEDIA_SELECT, VK_LAUNCH_APP1, VK_LAUNCH_APP2
- function GetKeyState(const VKey: Byte): Boolean;
- function GetCurrentKeyState(const VKey: Byte): Boolean;
- function GetToggleKeyState(const VKey: Byte): Boolean;
- function FindColors(out X, Y: Integer; const Colors: TIntArray; const XS, YS, XE, YE: Integer): Boolean;
- function FindColorsTol(out X, Y: Integer; const Colors: TIntArray; const XS, YS, XE, YE, Tol: Integer): Boolean;
- function FindColorsEx(out Points: TPointArray; const Colors: TIntArray; const XS, YS, XE, YE: Integer): Boolean;
- function FindColorsTolEx(out Points: TPointArray; const Colors: TIntArray; const XS, YS, XE, YE, Tol: Integer): Boolean;
- function FindColorsSpiral(const SX, SY: Integer; out X, Y: Integer; const Colors: TIntArray; const XS, YS, XE, YE: Integer): Boolean;
- function FindColorsSpiralTol(const SX, SY: Integer; out X, Y: Integer; const Colors: TIntArray; const XS, YS, XE, YE, Tol: Integer): Boolean;
- function FindColorsSpiralEx(const SX, SY: Integer; out Points: TPointArray; const Colors: TIntArray; const XS, YS, XE, YE: Integer): Boolean;
- function FindColorsSpiralTolEx(const SX, SY: Integer; out Points: TPointArray; const Colors: TIntArray; const XS, YS, XE, YE, Tol: Integer): Boolean;
- function CountColors(const Colors: TIntArray; const XS, YS, XE, YE: Integer): Integer;
- function CountColorsTol(const Colors: TIntArray; const XS, YS, XE, YE, Tol: Integer): Integer;
- TSCARBitmap = class(TSCARObject);
- procedure FloodFill(const Bmp: TSCARBitmap; const X, Y, Color: Integer);
- procedure FloodFillTol(const Bmp: TSCARBitmap; const X, Y, Color, Tol: Integer);
- function FloodFillEx(const Bmp: TSCARBitmap; const X, Y: Integer): TPointArray;
- function FloodFillTolEx(const Bmp: TSCARBitmap; const X, Y, Tol: Integer): TPointArray;
- procedure TPAFilterTriangle(var TPA: TPointArray; const X1, Y1, X2, Y2, X3, Y3: Integer);
- procedure TPAExtractTriangle(var TPA: TPointArray; const X1, Y1, X2, Y2, X3, Y3: Integer);
- function TPAFromCircle(const Center: TPoint; const Radius: Integer): TPointArray;
- function TPAFromTriangle(const X1, Y1, X2, Y2, X3, Y3: Integer): TPointArray;
- function FindColorTPA(out X, Y: Integer; const Color: Integer; const TPA: TPointArray): Boolean;
- function FindColorTPATol(out X, Y: Integer; const Color: Integer; const TPA: TPointArray; const Tol: Integer): Boolean;
- function FindColorTPAEx(out Points: TPointArray; const Color: Integer; const TPA: TPointArray): Boolean;
- function FindColorTPATolEx(out Points: TPointArray; const Color: Integer; const TPA: TPointArray; const Tol: Integer): Boolean;
- function GetMouseBtnState(const Btn: TMouseButton): Boolean;
- function GetDesktopWindow: Hwnd;
- function GetShellWindow: Hwnd;
- function FindWindows(const Title: string): THwndArray;
- function FindWindowsEx(const ParentWnd: Hwnd; const Title, ClassName: string; const RecursiveSearch, CaseSensitive, PartialMatch: Boolean): THwndArray;
- function FindWindowsPreg(const ParentWnd: Hwnd; const TitlePattern, ClassNamePattern: string; const RecursiveSearch: Boolean): THwndArray;
- function GetParentWindow(const Wnd: Hwnd): Hwnd;
- function WrapText(const Str: string; const MaxColumnSize: Integer): string;
- function GetWindowBoxEx(const Wnd: Hwnd; const ClientArea: Boolean): TBox;
- function GetWindowBox(const Wnd: Hwnd): TBox;
- function GetWindowText(const Wnd: Hwnd): string;
- function GetWindowClass(const Wnd: Hwnd): string;
- procedure GetBoxSize(const Box: TBox; out Width, Height: Integer);
- procedure SetWindowText(const Wnd: Hwnd; const Text: string);
- function GetOuterWindow(const Wnd: Hwnd): Hwnd;
- function IsWindowTopMost(const Wnd: Hwnd): Boolean;
- function IsWindowValid(const Wnd: Hwnd): Boolean;

Tweaks:
- procedure MouseBtnDown(const X, Y: Integer; const Btn: TMouseButton);
- procedure MouseBtnUp(const X, Y: Integer; const Btn: TMouseButton);
- procedure ClickMouse(const X, Y: Integer; const Btn: TMouseButton);
- Renamed:
    * FindBitmapIn -> FindBitmap
    * FindBitmapToleranceIn -> FindBitmapTol
    * HoldMouse -> MouseBtnDown
    * ReleaseMouse -> MouseBtnUp
    * KeyDown -> VKeyDown
    * KeyUp -> VKeyUp
    * GetKeyCode -> CharToVKey
    * MoveMouse -> SetMousePos
    * FindColorTolerance -> FindColorTol
    * FindColors -> FindColorEx
    * FindColorsTolerance -> FindColorTolEx
    * FindColorSpiralTolerance -> FindColorSpiralTol
    * FindColorsSpiralTolerance -> FindColorSpiralTolEx
    * FindColorsSpiral -> FindColorSpiralEx
    * CountColorTolerance -> CountColorTol
    * BitmapFromString -> BmpFromStrLegacy
    * MakeWindowTransparent -> SetWindowTransp
    * SetOnTop -> SetWindowTopMost
    * FastReplaceColor -> ReplaceColor
    * FastReplaceColorTolerance -> ReplaceColorTol
    * FindBitmaps -> FindBitmapEx
    * FindBitmapsTolerance -> FindBitmapTolEx
- Performance tweak for GetCursorType
- function FindColorSpiral(const SX, SY: Integer; out X, Y: Integer; const Color, XS, YS, XE, YE: Integer): Boolean;
- function FindColorSpiralTol(const SX, SY: Integer; out X, Y: Integer; const Color, XS, YS, XE, YE, Tol: Integer): Boolean;
- function FindBitmap(out X, Y: Integer; const Bmp: TSCARBitmap; const XS, YS, XE, YE: Integer): Boolean;
- function FindBitmapTol(out X, Y: Integer; const Bmp: TSCARBitmap; const XS, YS, XE, YE, Tol: Integer): Boolean;
- procedure DebugBitmap(const Bmp: TSCARBitmap);
- procedure SafeDrawBitmap(const Source: TSCARBitmap; const Dest: TCanvas; const X, Y: Integer);
- function FindDeformedBitmapToleranceRotationIn(const Bmp: TSCARBitmap; var x, y: Integer; x1, y1, x2, y2: Integer; tolerance: Integer; Range: Integer; var accuracy: Extended; AngleIntervals: Extended; StartAngle, MaxAngle: Extended; var angle: Extended): Boolean;
- function FindDeformedBitmapToleranceIn(const Bmp: TSCARBitmap; var x, y: Integer; x1, y1, x2, y2: Integer; tolerance: Integer; Range: Integer; AllowPartialAccuracy: Boolean; var accuracy: Extended): Boolean;
- function FindBitmapRotated(const Bmp: TSCARBitmap; var x, y, Angle: Integer; x1, y1, x2, y2: Integer): Boolean;
- function FindBitmapSpiral(const Bmp: TSCARBitmap; var x, y: Integer; x1, y1, x2, y2: Integer): Boolean;
- function FindBitmapSpiralTolerance(const Bmp: TSCARBitmap; var x, y: Integer; x1, y1, x2, y2: Integer; Tolerance: Integer): Boolean;
- function CreateBitmapMaskFromText(Text: AnsiString; Chars: Integer): TSCARBitmap;
- function CreateBitmapFromText(Text: AnsiString; Chars: Integer; TextColor: Integer): TSCARBitmap;
- function FindBitmapMaskTolerance(const Mask: TSCARBitmap; var x, y: Integer; x1, y1, x2, y2: Integer; Tolerance, ContourTolerance: Integer): Boolean;
- procedure ReplaceColor(const Bmp: TSCARBitmap; const Color, NewColor: Integer);
- procedure ReplaceColorTol(const Bmp: TSCARBitmap; const Color, NewColor, Tol: Integer);
- function FindBitmapEx(out Points: TPointArray; const Bmp: TSCARBitmap; const XS, YS, XE, YE: Integer): Boolean;
- function FindBitmapTolEx(out Points: TPointArray; const Bmp: TSCARBitmap; const XS, YS, XE, YE, Tol: Integer): Boolean;

Removed:
- procedure ClearDebugLine(const Line: Integer);
- procedure DeleteDebugLine(const Line: Integer);
- function GetDebugLineCount: Integer;
- function GetDebugLine(const Line: Integer): AnsiString;
- procedure ReplaceDebugLine(const Line: Integer; const Str: AnsiString);
- function GetDebugText: AnsiString;
- procedure GetClientDimensions(out Width, Height: Integer);
- function GetClientWindowHandle: Hwnd;
- procedure SetClientWindowHandle(const H: Hwnd);
- function GetTargetDC: HDC;
- procedure SetTargetDC(const DC: HDC);
- procedure ResetDC;
- procedure SetDesktopAsClient;
- procedure ClickMouseMid(x, y: Integer);
- procedure HoldMouseMid(x, y: Integer);
- procedure ReleaseMouseMid(x, y: Integer);
- function FindBitmap(Bitmap: Integer; var x, y: Integer): Boolean;
- function FindBitmapTolerance(Bitmap: Integer; var x, y: Integer; Tolerance: Integer): Boolean;
- procedure SendKeysVB(const Str: AnsiString; const Wait: Boolean);
- procedure SendArrow(const Key: Byte);
- procedure SendArrowWait(const Key: Byte; const WaitTime: Integer);
- procedure MoveMouseCC(x, y, range, segments, pcount, delay: Integer);
- procedure MoveMouseSmoothFrom(x1, y1, x2, y2: Integer);
- procedure MoveMouseSmoothFromEx(x1, y1, x2, y2: Integer; minsleeptime, maxsleeptime, maxdistance, gravity, forces: Integer);
- procedure MoveMouseSmoothEx(const X, Y, MinSleepTime, MaxSleepTime, MaxDistance, Gravity, Forces: Integer);
- procedure MoveMouseSmooth(const X, Y: Integer);
- procedure ClickWindMouse(X, Y, rx, ry: Integer; Btn: TMouseButton);
- procedure ClickMouseBox(x1, y1, x2, y2: Integer; Btn: TMouseButton);
- procedure MouseBox(x1, y1, x2, y2: Integer);
- procedure SendKeys(const Str: AnsiString);
- procedure TypeKeys(const Str: AnsiString);
- procedure SendKeysWait(const Str: AnsiString; const WaitTime, RndTime: Integer);
- function IsNumpadEnabled: Boolean;
- function IsCapsLockEnabled: Boolean;
- function IsArrowDown(const Num: Byte): Boolean;
- function IsNumpadKeyDown(const Key: Byte): Boolean;
- TMusic
- function CreateMusicPlayer: TMusic;
- function FreeMusicPlayer(const Player: TMusic): Boolean;
- function FindColorSpiral2(var X, Y: Integer; const Color, XS, YS, XE, YE: Integer): Boolean;
- function GetBitmapDC(const Bmp: Integer): HDC;
- function BitmapAssigned(const iBmp: Integer): Boolean;
- function CreateBitmap(const Width, Height, Color: Integer): Integer;
- procedure GetBitmapSize(const Bmp: Integer; out Width, Height: Integer);
- function BitmapToString(Bmp: Integer): AnsiString;
- function FindTransparentBitmap(Bitmap: Integer; var x, y: Integer; TranspCol, xs, ys, xe, ye: Integer): Boolean;
- function FindTransparentBitmapTolerance(Bitmap: Integer; var x, y: Integer; TranspCol, xs, ys, xe, ye, Tol: Integer): Boolean;
- function FreeBitmap(const Bmp: Integer): Boolean;
- function CreateMirroredBitmap(const Bmp: Integer): Integer;
- function ResizeBitmap(const Bmp, Width, Height: Integer): Integer;
- function FindColorCircle(out X, Y: Integer; const Color, CX, CY, R: Integer): Boolean;
- function FindColorCircleTolerance(out X, Y: Integer; const Color, CX, CY, R, Tol: Integer): Boolean;
- function FindColorTriangle(out X, Y: Integer; const Color, X1, Y1, X2, Y2, X3, Y3: Integer): Boolean;
- function FindColorTriangleTolerance(out X, Y: Integer; const Color, X1, Y1, X2, Y2, X3, Y3, Tol: Integer): Boolean;
- function FindColorSkipCoords(out X, Y: Integer; const Color, XS, YS, XE, YE: Integer; const TPA: TPointArray): Boolean;
- function FindColorSkipCoordsTolerance(out X, Y: Integer; const Color, XS, YS, XE, YE, Tol: Integer; const TPA: TPointArray): Boolean;
- function FindColorSkipBox(out X, Y: Integer; const Color, XS, YS, XE, YE: Integer; const Box: TBox): Boolean;
- function FindColorSkipBoxTolerance(out X, Y: Integer; const Color, XS, YS, XE, YE, Tol: Integer; const Box: TBox): Boolean;
- function FindColorSkipBoxArray(out X, Y: Integer; const Color, XS, YS, XE, YE: Integer; const TBA: TBoxArray): Boolean;
- function FindColorSkipBoxArrayTolerance(out X, Y: Integer; const Color, XS, YS, XE, YE, Tol: Integer; const TBA: TBoxArray): Boolean;
- function IsMouseButtonDown(LeftButton: Boolean): Boolean;
- function IsFunctionKeyDown(Key: Byte): Boolean;
- function IsFKeyDown(Num: Byte): Boolean;
- function IsKeyDown(C: Char): Boolean;
- function GetBitmapCanvas(bitmap: Integer): TCanvas;
- function LoadBitmap(path: AnsiString): Integer;
- procedure SaveBitmap(bitmap: Integer; path: AnsiString);
- function GetBitmapCanvas(bitmap: Integer): TCanvas;
- function RegexPos(const Subject, Pattern: AnsiString): Integer;
- function FindRegex(const Subject, Pattern: AnsiString): AnsiString;
- function ReplaceRegex(const Subject, Pattern, Replacement: AnsiString): AnsiString;
- function FindWindowTitlePart(Title: AnsiString; CaseSensitive: Boolean): Boolean;
- function TBitmapFromBmp(Bitmap: TBitmap; Bmp: Integer): Boolean;
- function GetBitmapAreaColors(xs, ys, xe, ye: Integer): T2DIntArray;
- procedure CopyClientToBitmap(bitmap: Integer; xs, ys, xe, ye: Integer);
- function FastGetPixel(const Bmp, x, y: Integer): Integer;
- procedure FastSetPixel(const Bmp, x, y, Color: Integer);
- procedure FastDrawClear(bitmap: Integer; Color: TColor);
- procedure SetTargetBitmap(bitmap: Integer);
- function RotateBitmap(bitmap: Integer; angle: Extended): Integer;
- procedure SetWindowText(const Wnd: Hwnd; const Text: string);
- function FindTransparentBitmaps(Bitmap: Integer; var Points: TPointArray; TranspCol, xs, ys, xe, ye: Integer): Boolean;
- function FindTransparentBitmapsTolerance(Bitmap: Integer; var Points: TPointArray; TranspCol, xs, ys, xe, ye, Tol: Integer): Boolean;

 

I've started to integrate the new bitmap objects into the old functions. So several of the functions in the Tweaks section haven't been changed aside from now using the TSCARBitmap object. This does mean that they will likely still be changed when the API updates continue in next versions. Do take in mind that this also means that these functions still function in the old way, with a standard transparency check for black. The new functions in the API use the TranspColor property. These are FindBitmap(Tol)(Ex) and soon also CountColor(Tol). FindBitmaps functions will also not be implemented in 3.35 and likely FindColorsTPA(Tol)(Ex) not either. For the color API, the only remaining functions that haven't been updated yet are FindColoredArea(Tolerance).

 

Atm I'm only aware of a bug which causes TypeText(Ex) to malfunction. FindColorTPA(Tol)(Ex) is rather slow ATM, but it has not been optimized yet, I'll get around to that soon as well.

 

Unfortunately I don't have time to make a video showcasing the changes tonight, but most of the new functions for the window API are fairly straightforward. (The window API should also be done now btw.)

Link to comment
Share on other sites

So this is "casting" that as a Integer.

 

[sCAR]

program New;

{$I GMRL\GMRL.scar}

 

var

bmp: Integer;

bmp1: TSCARBitmap;

 

begin

bmp1 := TSCARBitmap.Create('');

bmp1 := GetClient.Capture;

bmp := bmp1 as Integer

GMRL_SetBitmapContrast(bmp, 50);

DebugBitmap(bmp1);

end.

[/sCAR]

 

Cool. So you can cast that type/class as an Integer? How is this possible anyway? Never quite understood how that works with classes/types/w/e.

 

Didn't know you could do that in SCAR Divi.

Edited by LordJashin
Link to comment
Share on other sites

So this is "casting" that as a Integer.

 

[sCAR]

program New;

{$I GMRL\GMRL.scar}

 

var

bmp: Integer;

bmp1: TSCARBitmap;

 

begin

bmp1 := TSCARBitmap.Create('');

bmp1 := GetClient.Capture;

bmp := bmp1 as Integer

GMRL_SetBitmapContrast(bmp, 50);

DebugBitmap(bmp1);

end.

[/sCAR]

 

Cool. So you can cast that type/class as an Integer? How is this possible anyway? Never quite understood how that works with classes/types/w/e.

 

Didn't know you could do that in SCAR Divi.

 

Integer(Bitmap)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.




×
  • Create New...