mirror of
https://github.com/moparisthebest/Simba
synced 2024-12-23 07:48:50 -05:00
Methods are now in an Array, instead of directly added into the PS-Script engine.
git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@271 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
parent
13be2661cf
commit
6b73686cd0
@ -41,161 +41,6 @@ Sender.Comp.AddTypeS('TStringArray','Array of string;');
|
|||||||
Sender.Comp.AddTypeS('TMousePress', '(mouse_Down, mouse_Up);');
|
Sender.Comp.AddTypeS('TMousePress', '(mouse_Down, mouse_Up);');
|
||||||
|
|
||||||
|
|
||||||
Sender.AddFunction(@ThreadSafeCall,'function ThreadSafeCall(ProcName: string; var V: TVariantArray): Variant;');
|
|
||||||
Sender.AddFunction(@psWriteln,'procedure writeln(s : string);');
|
|
||||||
|
|
||||||
{ DTM }
|
|
||||||
|
|
||||||
Sender.AddFunction(@PrintpDTM, 'Procedure PrintpDTM(tDTM : pDTM);');
|
|
||||||
Sender.AddFunction(@ps_GetDTM ,'function GetDTM(index: Integer; out dtm: pDTM): Boolean;');
|
|
||||||
Sender.AddFunction(@pDTMToTDTM, 'Function pDTMToTDTM(Const DTM: pDTM): TDTM;');
|
|
||||||
Sender.AddFunction(@tDTMTopDTM, 'Function tDTMTopDTM(Const DTM: TDTM): pDTM;');
|
|
||||||
Sender.AddFunction(@ps_DTMFromString, 'function DTMFromString(DTMString: String): Integer;');
|
|
||||||
Sender.AddFunction(@ps_FreeDTM, 'procedure FreeDTM(DTM: Integer);');
|
|
||||||
Sender.AddFunction(@ps_FindDTM, 'function FindDTM(DTM: Integer; out x, y: Integer; x1, y1, x2, y2: Integer): Boolean;');
|
|
||||||
Sender.AddFunction(@ps_FindDTMs, 'function FindDTMs(DTM: Integer; out p: TPointArray; x1, y1, x2, y2: Integer): Boolean;');
|
|
||||||
Sender.AddFunction(@ps_FindDTMRotated, 'function FindDTMRotated(DTM: Integer; out x, y: Integer; x1, y1, x2, y2: Integer; sAngle, eAngle, aStep: Extended; out aFound: Extended): Boolean;');
|
|
||||||
Sender.AddFunction(@ps_FindDTMsRotated, 'function FindDTMsRotated(DTM: Integer; out Points: TPointArray; x1, y1, x2, y2: Integer; sAngle, eAngle, aStep: Extended; out aFound: T2DExtendedArray) : Boolean;');
|
|
||||||
Sender.AddFunction(@ps_addDTM, 'function AddDTM(d: TDTM): Integer;');
|
|
||||||
Sender.AddFunction(@ps_addpDTM, 'function AddpDTM(d: pDTM): Integer;');
|
|
||||||
|
|
||||||
{maths}
|
|
||||||
|
|
||||||
sender.AddFunction(@ceil,'function ceil(e : extended) : integer');
|
|
||||||
sender.AddFunction(@power,'function pow(base,exponent : extended) : extended');
|
|
||||||
Sender.AddFunction(@max,'function Max(a, b: Integer): Integer;');
|
|
||||||
Sender.AddFunction(@min,'function Min(a, b: Integer): Integer;');
|
|
||||||
Sender.AddFunction(@minE,'function MinE(a, b: extended): Extended;');
|
|
||||||
Sender.AddFunction(@IntToBox,'function IntToBox(x1,y1,x2,y2 : integer) : TBox;');
|
|
||||||
Sender.AddFunction(@pssqr,'function Sqr(e : extended) : extended;');
|
|
||||||
Sender.AddFunction(@classes.point,'function Point(x,y:integer) : TPoint;');
|
|
||||||
Sender.AddFunction(@Distance,'function Distance(x1,y1,x2,y2 : integer) : integer;');
|
|
||||||
Sender.AddFunction(@hypot,'function Hypot(X, Y: Extended): Extended;');
|
|
||||||
Sender.AddFunction(@RandomRange,'function RandomRange(aFrom,aTo: Integer): Integer;');
|
|
||||||
|
|
||||||
{window}
|
|
||||||
Sender.AddFunction(@Freeze, 'function freeze:boolean;');
|
|
||||||
Sender.AddFunction(@Unfreeze, 'function unfreeze: boolean;');
|
|
||||||
Sender.AddFunction(@GetClientDimensions, 'procedure GetClientDimensions(out w, h:integer);');
|
|
||||||
Sender.AddFunction(@SetTargetBitmap,'procedure SetTargetBitmap(Bitmap : integer);');
|
|
||||||
Sender.AddFunction(@SetDesktopAsClient,'procedure SetDesktopAsClient');
|
|
||||||
Sender.AddFunction(@SetTargetArray, 'procedure SetTargetArray(P: Integer; Size: TPoint);');
|
|
||||||
Sender.AddFunction(@ActivateClient, 'procedure activateclient;');
|
|
||||||
|
|
||||||
{files}
|
|
||||||
Sender.AddFunction(@ps_CreateFile, 'function CreateFile(Path: string): Integer;');
|
|
||||||
Sender.AddFunction(@ps_OpenFile, 'function OpenFile(Path: string; Shared: Boolean): Integer;');
|
|
||||||
Sender.AddFunction(@ps_RewriteFile, 'function RewriteFile(Path: string; Shared: Boolean): Integer;');
|
|
||||||
Sender.AddFunction(@ps_CloseFile, 'procedure CloseFile(FileNum: Integer);');
|
|
||||||
Sender.AddFunction(@ps_EndOfFile, 'function EndOfFile(FileNum: Integer): Boolean;');
|
|
||||||
Sender.AddFunction(@ps_FileSize, 'function FileSize(FileNum: Integer): LongInt;');
|
|
||||||
Sender.AddFunction(@ps_ReadFileString, 'function ReadFileString(FileNum: Integer; out s: string; x: Integer): Boolean;');
|
|
||||||
Sender.AddFunction(@ps_WriteFileString, 'function WriteFileString(FileNum: Integer; s: string): Boolean;');
|
|
||||||
Sender.AddFunction(@ps_SetFileCharPointer, 'Function SetFileCharPointer(FileNum, cChars, Origin: Integer): Integer;');
|
|
||||||
Sender.AddFunction(@ps_FilePointerPos, 'function FilePointerPos(FileNum: Integer): Integer;');
|
|
||||||
|
|
||||||
{other}
|
|
||||||
Sender.AddFunction(@SaveScreenshot,'procedure SaveScreenshot(FileName: string);');
|
|
||||||
Sender.AddFunction(@psWait, 'procedure wait(t: integer);');
|
|
||||||
Sender.AddFunction(@psWait, 'procedure Sleep(t: integer);');
|
|
||||||
Sender.AddFunction(@GetTickCount, 'function GetSystemTime: LongWord;');
|
|
||||||
Sender.AddFunction(@GetTickCount, 'function GetTickCount: LongWord;');
|
|
||||||
Sender.AddFunction(@GetTimeRunning,'function GetTimeRunning: LongWord;');
|
|
||||||
Sender.AddFunction(@CreateForm,'function CreateForm : TForm;');
|
|
||||||
Sender.AddFunction(@CreateButton,'function CreateButton(Owner : TComponent) : TButton');
|
|
||||||
Sender.AddFunction(@ConvertTime,'procedure ConvertTime(Time : integer; var h,m,s : integer);');
|
|
||||||
Sender.AddFunction(@HakunaMatata,'procedure HakunaMatata;');
|
|
||||||
Sender.AddFunction(@TerminateScript,'procedure TerminateScript;');
|
|
||||||
Sender.AddFunction(@DisplayDebugImgWindow,'procedure DisplayDebugImgWindow(w,h : integer);');
|
|
||||||
Sender.AddFunction(@DrawBitmapDebugImg,'procedure DrawBitmapDebugImg(bmp : integer);');
|
|
||||||
Sender.AddFunction(@Random,'function Random(Int : integer): integer;');
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{string}
|
|
||||||
Sender.AddFunction(@Capitalize,'function Capitalize(str : string) : string;');
|
|
||||||
{web}
|
|
||||||
Sender.AddFunction(@OpenWebPage,'procedure OpenWebPage(url : string);');
|
|
||||||
|
|
||||||
{Color + Color Finders}
|
|
||||||
Sender.AddFunction(@GetColor,'function GetColor(x, y: Integer): Integer;');
|
|
||||||
Sender.AddFunction(@FindColor, 'function findcolor(out x, y: integer; color, x1, y1, x2, y2: integer): boolean;');
|
|
||||||
Sender.AddFunction(@findcolortoleranceOptimised, 'function findcolortoleranceOptimised(out x, y: integer; color, x1, y1, x2, y2, tol: integer): boolean;');
|
|
||||||
Sender.AddFunction(@FindColorTolerance, 'function findcolortolerance(out x, y: integer; color, x1, y1, x2, y2, tol: integer): boolean;');
|
|
||||||
Sender.AddFunction(@FindColors, 'function findcolors(out TPA: TPointArray; color, x1, y1, x2, y2: integer): boolean;');
|
|
||||||
Sender.AddFunction(@SimilarColors,'function SimilarColors(Col1,Col2,Tolerance : integer) : boolean');
|
|
||||||
Sender.AddFunction(@CountColor,'function CountColor(Color, xs, ys, xe, ye: Integer): Integer;');
|
|
||||||
Sender.AddFunction(@CountColorTolerance,'function CountColorTolerance(Color, xs, ys, xe, ye, Tolerance: Integer): Integer;');
|
|
||||||
Sender.AddFunction(@FindColorsToleranceOptimised,'function FindColorsToleranceOptimised(out Points: TPointArray; Color, xs, ys, xe, ye, Tolerance: Integer): Boolean;');
|
|
||||||
Sender.AddFunction(@FindColorsTolerance,'function FindColorsTolerance(out Points: TPointArray; Color, xs, ys, xe, ye, Tolerance: Integer): Boolean;');
|
|
||||||
Sender.AddFunction(@FindColorSpiral,'function FindColorSpiral(var x, y: Integer; color, xs, ys, xe, ye: Integer): Boolean;');
|
|
||||||
Sender.AddFunction(@FindColorsSpiralTolerance,'function FindColorsSpiralTolerance(x, y: Integer; out Points: TPointArray; color, xs, ys, xe, ye: Integer; Tolerance: Integer) : boolean;');
|
|
||||||
Sender.AddFunction(@SetColorToleranceSpeed, 'procedure SetColorToleranceSpeed(cts: integer);');
|
|
||||||
|
|
||||||
Sender.AddFunction(@ColorToHSL, 'procedure ColorToHSL(c: integer; out r,g,b: extended);');
|
|
||||||
|
|
||||||
{Mouse etc.}
|
|
||||||
Sender.Comp.AddConstantN('mouse_Right','integer').SetInt(ps_mouse_right); //0
|
Sender.Comp.AddConstantN('mouse_Right','integer').SetInt(ps_mouse_right); //0
|
||||||
Sender.Comp.AddConstantN('mouse_Left','integer').SetInt(ps_mouse_left);//1
|
Sender.Comp.AddConstantN('mouse_Left','integer').SetInt(ps_mouse_left);//1
|
||||||
Sender.Comp.AddConstantN('mouse_Middle','integer').SetInt(ps_mouse_middle);//2
|
Sender.Comp.AddConstantN('mouse_Middle','integer').SetInt(ps_mouse_middle);//2
|
||||||
Sender.AddFunction(@MoveMouse, 'procedure MoveMouse(x, y: integer);');
|
|
||||||
Sender.AddFunction(@GetMousePos, 'procedure GetMousePos(out x, y: integer);');
|
|
||||||
Sender.AddFunction(@HoldMouse, 'procedure HoldMouse(x, y: integer; clickType: integer);');
|
|
||||||
Sender.AddFunction(@ReleaseMouse, 'procedure ReleaseMouse(x, y: integer; clickType: integer);');
|
|
||||||
Sender.AddFunction(@ClickMouse, 'procedure ClickMouse(x, y: integer; clickType: integer);');
|
|
||||||
|
|
||||||
|
|
||||||
{Keyboard}
|
|
||||||
Sender.AddFunction(@KeyDown, 'procedure KeyDown(key: Word);');
|
|
||||||
Sender.AddFunction(@KeyUp, 'procedure KeyUp(key: Word);');
|
|
||||||
Sender.AddFunction(@PressKey, 'procedure PressKey(key: Word);');
|
|
||||||
Sender.AddFunction(@SendKeys, 'procedure SendKeys(s: string);');
|
|
||||||
Sender.AddFunction(@isKeyDown, 'function isKeyDown(key: Word): Boolean;');
|
|
||||||
Sender.AddFunction(@GetKeyCode, 'function GetKeyCode(Key : char) : byte');
|
|
||||||
|
|
||||||
{ OCR}
|
|
||||||
|
|
||||||
Sender.AddFunction(@rs_GetUpText, 'function rs_GetUpText: string;');
|
|
||||||
|
|
||||||
|
|
||||||
{Bitmaps}
|
|
||||||
Sender.AddFunction(@CreateBitmap,'function CreateBitmap(w,h :integer) : integer;');
|
|
||||||
Sender.AddFunction(@FreeBitmap,'procedure FreeBitmap(Bmp : integer);');
|
|
||||||
Sender.AddFunction(@SaveBitmap,'procedure SaveBitmap(Bmp : integer; path : string);');
|
|
||||||
Sender.AddFunction(@BitmapFromString,'function BitmapFromString(Width,Height : integer; Data : string): integer;');
|
|
||||||
Sender.AddFunction(@LoadBitmap,'function LoadBitmap(Path : string) : integer;');
|
|
||||||
Sender.AddFunction(@SetBitmapSize,'procedure SetBitmapSize(Bmp,NewW,NewH : integer);');
|
|
||||||
Sender.AddFunction(@GetBitmapSize,'procedure GetBitmapSize(Bmp : integer; out BmpW,BmpH : integer);');
|
|
||||||
Sender.AddFunction(@StretchBitmapResize,'procedure StretchBitmapResize(Bmp,NewW,NewH : integer);');
|
|
||||||
Sender.AddFunction(@CreateMirroredBitmap,'function CreateMirroredBitmap(Bmp : integer) : integer;');
|
|
||||||
Sender.AddFunction(@CreateMirroredBitmapEx,'function CreateMirroredBitmapEx(Bmp : integer; MirrorStyle : TBmpMirrorStyle) : integer;');
|
|
||||||
Sender.AddFunction(@FastSetPixel,'procedure FastSetPixel(bmp,x,y : integer; Color : TColor);');
|
|
||||||
Sender.AddFunction(@FastSetPixels,'procedure FastSetPixels(bmp : integer; TPA : TPointArray; Colors : TIntegerArray);');
|
|
||||||
Sender.AddFunction(@FastGetPixel,'function FastGetPixel(bmp, x,y : integer) : TColor;');
|
|
||||||
Sender.AddFunction(@FastGetPixels,'function FastGetPixels(Bmp : integer; TPA : TPointArray) : TIntegerArray;');
|
|
||||||
Sender.AddFunction(@FastDrawClear,'procedure FastDrawClear(bmp : integer; Color : TColor)');
|
|
||||||
Sender.AddFunction(@FastDrawTransparent,'procedure FastDrawTransparent(x, y: Integer; SourceBitmap, TargetBitmap: Integer);');
|
|
||||||
Sender.AddFunction(@SetTransparentColor,'procedure SetTransparentColor(bmp : integer; Color : TColor);');
|
|
||||||
Sender.AddFunction(@GetTransparentColor,'function GetTransparentColor(bmp: integer) : TColor;');
|
|
||||||
Sender.AddFunction(@FastReplaceColor,'procedure FastReplaceColor(Bmp : integer; OldColor,NewColor : TColor);');
|
|
||||||
Sender.AddFunction(@ps_CopyClientToBitmap, 'procedure CopyClientToBitmap(bmp, xs, ys, xe, ye: Integer);');
|
|
||||||
Sender.AddFunction(@BitmapFromClient,'function BitmapFromClient(const xs, ys, xe, ye: Integer): Integer;');
|
|
||||||
Sender.AddFunction(@SetBitmapName, 'procedure SetBitmapName(Bmp : integer; name : string);');
|
|
||||||
Sender.AddFunction(@FindBitmap,'function FindBitmap(bitmap: integer; out x, y: Integer): Boolean;');
|
|
||||||
Sender.AddFunction(@FindBitmapIn,'function FindBitmapIn(bitmap: integer; out x, y: Integer; xs, ys, xe, ye: Integer): Boolean;');
|
|
||||||
sender.AddFunction(@FindBitmapToleranceIn,'function FindBitmapToleranceIn(bitmap: integer; out x, y: Integer; xs, ys, xe, ye: Integer; tolerance: Integer): Boolean;');
|
|
||||||
Sender.AddFunction(@FindBitmapSpiral,'function FindBitmapSpiral(bitmap: Integer; var x, y: Integer; xs, ys, xe, ye: Integer): Boolean;');
|
|
||||||
Sender.AddFunction(@FindBitmapsSpiralTolerance,'function FindBitmapsSpiralTolerance(bitmap: integer; x, y: Integer; out Points : TPointArray; xs, ys, xe, ye,tolerance: Integer): Boolean;');
|
|
||||||
Sender.AddFunction(@FindBitmapSpiralTolerance,'function FindBitmapSpiralTolerance(bitmap: integer; var x, y: Integer; xs, ys, xe, ye,tolerance : integer): Boolean;');
|
|
||||||
Sender.AddFunction(@RotateBitmap,'function RotateBitmap(bitmap: Integer; angle: Extended): Integer;');
|
|
||||||
Sender.AddFunction(@Desaturate,'function DesaturateBitmap(Bitmap : integer) : integer;');
|
|
||||||
sender.AddFunction(@InvertBitmap,'procedure InvertBitmap(Bitmap : integer);');
|
|
||||||
Sender.AddFunction(@CopyBitmap,'function CopyBitmap(Bitmap: integer) : integer)');
|
|
||||||
Sender.AddFunction(@GreyScaleBitmap,'function GreyScaleBitmap(bitmap : integer) : integer');
|
|
||||||
Sender.AddFunction(@BrightnessBitmap,'function BrightnessBitmap(Bitmap,br : integer) : integer;');
|
|
||||||
Sender.AddFunction(@ContrastBitmap,'function ContrastBitmap(bitmap : integer; co : extended) : integer;');
|
|
||||||
Sender.AddFunction(@PosterizeBitmap,'function PosterizeBitmap(Bitmap : integer; po : integer) : integer;');
|
|
||||||
Sender.AddFunction(@CreateBitmapMask,'function CreateBitmapMask(Bitmap : integer) : TMask;');
|
|
||||||
Sender.AddFunction(@FindMaskTolerance,'function FindMaskTolerance(mask: TMask; out x, y: Integer; xs,ys, xe, ye: Integer; Tolerance, ContourTolerance: Integer): Boolean;');
|
|
||||||
Sender.AddFunction(@FindBitmapMaskTolerance,'function FindBitmapMaskTolerance(mask: Integer; out x, y: Integer; xs, ys, xe, ye: Integer; Tolerance, ContourTolerance: Integer): Boolean;');
|
|
||||||
Sender.AddFunction(@FindDeformedBitmapToleranceIn,'function FindDeformedBitmapToleranceIn(bitmap: integer; out x,y: Integer; xs, ys, xe, ye: Integer; tolerance: Integer; Range: Integer; AllowPartialAccuracy: Boolean; out accuracy: Extended): Boolean;');
|
|
||||||
|
178
Units/MMLAddon/PSInc/psexportedmethods.inc
Normal file
178
Units/MMLAddon/PSInc/psexportedmethods.inc
Normal file
@ -0,0 +1,178 @@
|
|||||||
|
{
|
||||||
|
This file is part of the Mufasa Macro Library (MML)
|
||||||
|
Copyright (c) 2009 by Raymond van Venetië and Merlijn Wajer
|
||||||
|
|
||||||
|
MML is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
MML is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with MML. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
See the file COPYING, included in this distribution,
|
||||||
|
for details about the copyright.
|
||||||
|
|
||||||
|
psexportedmethods.inc for the Mufasa Macro Library
|
||||||
|
}
|
||||||
|
|
||||||
|
AddFunction(@ThreadSafeCall,'function ThreadSafeCall(ProcName: string; var V: TVariantArray): Variant;');
|
||||||
|
AddFunction(@psWriteln,'procedure writeln(s : string);');
|
||||||
|
|
||||||
|
{ DTM }
|
||||||
|
|
||||||
|
AddFunction(@PrintpDTM, 'Procedure PrintpDTM(tDTM : pDTM);');
|
||||||
|
AddFunction(@ps_GetDTM ,'function GetDTM(index: Integer; out dtm: pDTM): Boolean;');
|
||||||
|
AddFunction(@pDTMToTDTM, 'Function pDTMToTDTM(Const DTM: pDTM): TDTM;');
|
||||||
|
AddFunction(@tDTMTopDTM, 'Function tDTMTopDTM(Const DTM: TDTM): pDTM;');
|
||||||
|
AddFunction(@ps_DTMFromString, 'function DTMFromString(DTMString: String): Integer;');
|
||||||
|
AddFunction(@ps_FreeDTM, 'procedure FreeDTM(DTM: Integer);');
|
||||||
|
AddFunction(@ps_FindDTM, 'function FindDTM(DTM: Integer; out x, y: Integer; x1, y1, x2, y2: Integer): Boolean;');
|
||||||
|
AddFunction(@ps_FindDTMs, 'function FindDTMs(DTM: Integer; out p: TPointArray; x1, y1, x2, y2: Integer): Boolean;');
|
||||||
|
AddFunction(@ps_FindDTMRotated, 'function FindDTMRotated(DTM: Integer; out x, y: Integer; x1, y1, x2, y2: Integer; sAngle, eAngle, aStep: Extended; out aFound: Extended): Boolean;');
|
||||||
|
AddFunction(@ps_FindDTMsRotated, 'function FindDTMsRotated(DTM: Integer; out Points: TPointArray; x1, y1, x2, y2: Integer; sAngle, eAngle, aStep: Extended; out aFound: T2DExtendedArray) : Boolean;');
|
||||||
|
AddFunction(@ps_addDTM, 'function AddDTM(d: TDTM): Integer;');
|
||||||
|
AddFunction(@ps_addpDTM, 'function AddpDTM(d: pDTM): Integer;');
|
||||||
|
|
||||||
|
{maths}
|
||||||
|
|
||||||
|
AddFunction(@ceil,'function ceil(e : extended) : integer');
|
||||||
|
AddFunction(@power,'function pow(base,exponent : extended) : extended');
|
||||||
|
AddFunction(@max,'function Max(a, b: Integer): Integer;');
|
||||||
|
AddFunction(@min,'function Min(a, b: Integer): Integer;');
|
||||||
|
AddFunction(@minE,'function MinE(a, b: extended): Extended;');
|
||||||
|
AddFunction(@IntToBox,'function IntToBox(x1,y1,x2,y2 : integer) : TBox;');
|
||||||
|
AddFunction(@pssqr,'function Sqr(e : extended) : extended;');
|
||||||
|
AddFunction(@classes.point,'function Point(x,y:integer) : TPoint;');
|
||||||
|
AddFunction(@Distance,'function Distance(x1,y1,x2,y2 : integer) : integer;');
|
||||||
|
AddFunction(@hypot,'function Hypot(X, Y: Extended): Extended;');
|
||||||
|
AddFunction(@RandomRange,'function RandomRange(aFrom,aTo: Integer): Integer;');
|
||||||
|
|
||||||
|
{window}
|
||||||
|
AddFunction(@Freeze, 'function freeze:boolean;');
|
||||||
|
AddFunction(@Unfreeze, 'function unfreeze: boolean;');
|
||||||
|
AddFunction(@GetClientDimensions, 'procedure GetClientDimensions(out w, h:integer);');
|
||||||
|
AddFunction(@SetTargetBitmap,'procedure SetTargetBitmap(Bitmap : integer);');
|
||||||
|
AddFunction(@SetDesktopAsClient,'procedure SetDesktopAsClient');
|
||||||
|
AddFunction(@SetTargetArray, 'procedure SetTargetArray(P: Integer; Size: TPoint);');
|
||||||
|
AddFunction(@ActivateClient, 'procedure activateclient;');
|
||||||
|
|
||||||
|
{files}
|
||||||
|
AddFunction(@ps_CreateFile, 'function CreateFile(Path: string): Integer;');
|
||||||
|
AddFunction(@ps_OpenFile, 'function OpenFile(Path: string; Shared: Boolean): Integer;');
|
||||||
|
AddFunction(@ps_RewriteFile, 'function RewriteFile(Path: string; Shared: Boolean): Integer;');
|
||||||
|
AddFunction(@ps_CloseFile, 'procedure CloseFile(FileNum: Integer);');
|
||||||
|
AddFunction(@ps_EndOfFile, 'function EndOfFile(FileNum: Integer): Boolean;');
|
||||||
|
AddFunction(@ps_FileSize, 'function FileSize(FileNum: Integer): LongInt;');
|
||||||
|
AddFunction(@ps_ReadFileString, 'function ReadFileString(FileNum: Integer; out s: string; x: Integer): Boolean;');
|
||||||
|
AddFunction(@ps_WriteFileString, 'function WriteFileString(FileNum: Integer; s: string): Boolean;');
|
||||||
|
AddFunction(@ps_SetFileCharPointer, 'Function SetFileCharPointer(FileNum, cChars, Origin: Integer): Integer;');
|
||||||
|
AddFunction(@ps_FilePointerPos, 'function FilePointerPos(FileNum: Integer): Integer;');
|
||||||
|
|
||||||
|
{other}
|
||||||
|
AddFunction(@SaveScreenshot,'procedure SaveScreenshot(FileName: string);');
|
||||||
|
AddFunction(@psWait, 'procedure wait(t: integer);');
|
||||||
|
AddFunction(@psWait, 'procedure Sleep(t: integer);');
|
||||||
|
AddFunction(@GetTickCount, 'function GetSystemTime: LongWord;');
|
||||||
|
AddFunction(@GetTickCount, 'function GetTickCount: LongWord;');
|
||||||
|
AddFunction(@GetTimeRunning,'function GetTimeRunning: LongWord;');
|
||||||
|
AddFunction(@CreateForm,'function CreateForm : TForm;');
|
||||||
|
AddFunction(@CreateButton,'function CreateButton(Owner : TComponent) : TButton');
|
||||||
|
AddFunction(@ConvertTime,'procedure ConvertTime(Time : integer; var h,m,s : integer);');
|
||||||
|
AddFunction(@HakunaMatata,'procedure HakunaMatata;');
|
||||||
|
AddFunction(@TerminateScript,'procedure TerminateScript;');
|
||||||
|
AddFunction(@DisplayDebugImgWindow,'procedure DisplayDebugImgWindow(w,h : integer);');
|
||||||
|
AddFunction(@DrawBitmapDebugImg,'procedure DrawBitmapDebugImg(bmp : integer);');
|
||||||
|
AddFunction(@Random,'function Random(Int : integer): integer;');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{string}
|
||||||
|
AddFunction(@Capitalize,'function Capitalize(str : string) : string;');
|
||||||
|
{web}
|
||||||
|
AddFunction(@OpenWebPage,'procedure OpenWebPage(url : string);');
|
||||||
|
|
||||||
|
{Color + Color Finders}
|
||||||
|
AddFunction(@GetColor,'function GetColor(x, y: Integer): Integer;');
|
||||||
|
AddFunction(@FindColor, 'function findcolor(out x, y: integer; color, x1, y1, x2, y2: integer): boolean;');
|
||||||
|
AddFunction(@findcolortoleranceOptimised, 'function findcolortoleranceOptimised(out x, y: integer; color, x1, y1, x2, y2, tol: integer): boolean;');
|
||||||
|
AddFunction(@FindColorTolerance, 'function findcolortolerance(out x, y: integer; color, x1, y1, x2, y2, tol: integer): boolean;');
|
||||||
|
AddFunction(@FindColors, 'function findcolors(out TPA: TPointArray; color, x1, y1, x2, y2: integer): boolean;');
|
||||||
|
AddFunction(@SimilarColors,'function SimilarColors(Col1,Col2,Tolerance : integer) : boolean');
|
||||||
|
AddFunction(@CountColor,'function CountColor(Color, xs, ys, xe, ye: Integer): Integer;');
|
||||||
|
AddFunction(@CountColorTolerance,'function CountColorTolerance(Color, xs, ys, xe, ye, Tolerance: Integer): Integer;');
|
||||||
|
AddFunction(@FindColorsToleranceOptimised,'function FindColorsToleranceOptimised(out Points: TPointArray; Color, xs, ys, xe, ye, Tolerance: Integer): Boolean;');
|
||||||
|
AddFunction(@FindColorsTolerance,'function FindColorsTolerance(out Points: TPointArray; Color, xs, ys, xe, ye, Tolerance: Integer): Boolean;');
|
||||||
|
AddFunction(@FindColorSpiral,'function FindColorSpiral(var x, y: Integer; color, xs, ys, xe, ye: Integer): Boolean;');
|
||||||
|
AddFunction(@FindColorsSpiralTolerance,'function FindColorsSpiralTolerance(x, y: Integer; out Points: TPointArray; color, xs, ys, xe, ye: Integer; Tolerance: Integer) : boolean;');
|
||||||
|
AddFunction(@SetColorToleranceSpeed, 'procedure SetColorToleranceSpeed(cts: integer);');
|
||||||
|
|
||||||
|
AddFunction(@ColorToHSL, 'procedure ColorToHSL(c: integer; out r,g,b: extended);');
|
||||||
|
|
||||||
|
{Mouse etc.}
|
||||||
|
AddFunction(@MoveMouse, 'procedure MoveMouse(x, y: integer);');
|
||||||
|
AddFunction(@GetMousePos, 'procedure GetMousePos(out x, y: integer);');
|
||||||
|
AddFunction(@HoldMouse, 'procedure HoldMouse(x, y: integer; clickType: integer);');
|
||||||
|
AddFunction(@ReleaseMouse, 'procedure ReleaseMouse(x, y: integer; clickType: integer);');
|
||||||
|
AddFunction(@ClickMouse, 'procedure ClickMouse(x, y: integer; clickType: integer);');
|
||||||
|
|
||||||
|
|
||||||
|
{Keyboard}
|
||||||
|
AddFunction(@KeyDown, 'procedure KeyDown(key: Word);');
|
||||||
|
AddFunction(@KeyUp, 'procedure KeyUp(key: Word);');
|
||||||
|
AddFunction(@PressKey, 'procedure PressKey(key: Word);');
|
||||||
|
AddFunction(@SendKeys, 'procedure SendKeys(s: string);');
|
||||||
|
AddFunction(@isKeyDown, 'function isKeyDown(key: Word): Boolean;');
|
||||||
|
AddFunction(@GetKeyCode, 'function GetKeyCode(Key : char) : byte');
|
||||||
|
|
||||||
|
{ OCR}
|
||||||
|
|
||||||
|
AddFunction(@rs_GetUpText, 'function rs_GetUpText: string;');
|
||||||
|
|
||||||
|
|
||||||
|
{Bitmaps}
|
||||||
|
AddFunction(@CreateBitmap,'function CreateBitmap(w,h :integer) : integer;');
|
||||||
|
AddFunction(@FreeBitmap,'procedure FreeBitmap(Bmp : integer);');
|
||||||
|
AddFunction(@SaveBitmap,'procedure SaveBitmap(Bmp : integer; path : string);');
|
||||||
|
AddFunction(@BitmapFromString,'function BitmapFromString(Width,Height : integer; Data : string): integer;');
|
||||||
|
AddFunction(@LoadBitmap,'function LoadBitmap(Path : string) : integer;');
|
||||||
|
AddFunction(@SetBitmapSize,'procedure SetBitmapSize(Bmp,NewW,NewH : integer);');
|
||||||
|
AddFunction(@GetBitmapSize,'procedure GetBitmapSize(Bmp : integer; out BmpW,BmpH : integer);');
|
||||||
|
AddFunction(@StretchBitmapResize,'procedure StretchBitmapResize(Bmp,NewW,NewH : integer);');
|
||||||
|
AddFunction(@CreateMirroredBitmap,'function CreateMirroredBitmap(Bmp : integer) : integer;');
|
||||||
|
AddFunction(@CreateMirroredBitmapEx,'function CreateMirroredBitmapEx(Bmp : integer; MirrorStyle : TBmpMirrorStyle) : integer;');
|
||||||
|
AddFunction(@FastSetPixel,'procedure FastSetPixel(bmp,x,y : integer; Color : TColor);');
|
||||||
|
AddFunction(@FastSetPixels,'procedure FastSetPixels(bmp : integer; TPA : TPointArray; Colors : TIntegerArray);');
|
||||||
|
AddFunction(@FastGetPixel,'function FastGetPixel(bmp, x,y : integer) : TColor;');
|
||||||
|
AddFunction(@FastGetPixels,'function FastGetPixels(Bmp : integer; TPA : TPointArray) : TIntegerArray;');
|
||||||
|
AddFunction(@FastDrawClear,'procedure FastDrawClear(bmp : integer; Color : TColor)');
|
||||||
|
AddFunction(@FastDrawTransparent,'procedure FastDrawTransparent(x, y: Integer; SourceBitmap, TargetBitmap: Integer);');
|
||||||
|
AddFunction(@SetTransparentColor,'procedure SetTransparentColor(bmp : integer; Color : TColor);');
|
||||||
|
AddFunction(@GetTransparentColor,'function GetTransparentColor(bmp: integer) : TColor;');
|
||||||
|
AddFunction(@FastReplaceColor,'procedure FastReplaceColor(Bmp : integer; OldColor,NewColor : TColor);');
|
||||||
|
AddFunction(@ps_CopyClientToBitmap, 'procedure CopyClientToBitmap(bmp, xs, ys, xe, ye: Integer);');
|
||||||
|
AddFunction(@BitmapFromClient,'function BitmapFromClient(const xs, ys, xe, ye: Integer): Integer;');
|
||||||
|
AddFunction(@SetBitmapName, 'procedure SetBitmapName(Bmp : integer; name : string);');
|
||||||
|
AddFunction(@FindBitmap,'function FindBitmap(bitmap: integer; out x, y: Integer): Boolean;');
|
||||||
|
AddFunction(@FindBitmapIn,'function FindBitmapIn(bitmap: integer; out x, y: Integer; xs, ys, xe, ye: Integer): Boolean;');
|
||||||
|
AddFunction(@FindBitmapToleranceIn,'function FindBitmapToleranceIn(bitmap: integer; out x, y: Integer; xs, ys, xe, ye: Integer; tolerance: Integer): Boolean;');
|
||||||
|
AddFunction(@FindBitmapSpiral,'function FindBitmapSpiral(bitmap: Integer; var x, y: Integer; xs, ys, xe, ye: Integer): Boolean;');
|
||||||
|
AddFunction(@FindBitmapsSpiralTolerance,'function FindBitmapsSpiralTolerance(bitmap: integer; x, y: Integer; out Points : TPointArray; xs, ys, xe, ye,tolerance: Integer): Boolean;');
|
||||||
|
AddFunction(@FindBitmapSpiralTolerance,'function FindBitmapSpiralTolerance(bitmap: integer; var x, y: Integer; xs, ys, xe, ye,tolerance : integer): Boolean;');
|
||||||
|
AddFunction(@RotateBitmap,'function RotateBitmap(bitmap: Integer; angle: Extended): Integer;');
|
||||||
|
AddFunction(@Desaturate,'function DesaturateBitmap(Bitmap : integer) : integer;');
|
||||||
|
AddFunction(@InvertBitmap,'procedure InvertBitmap(Bitmap : integer);');
|
||||||
|
AddFunction(@CopyBitmap,'function CopyBitmap(Bitmap: integer) : integer)');
|
||||||
|
AddFunction(@GreyScaleBitmap,'function GreyScaleBitmap(bitmap : integer) : integer');
|
||||||
|
AddFunction(@BrightnessBitmap,'function BrightnessBitmap(Bitmap,br : integer) : integer;');
|
||||||
|
AddFunction(@ContrastBitmap,'function ContrastBitmap(bitmap : integer; co : extended) : integer;');
|
||||||
|
AddFunction(@PosterizeBitmap,'function PosterizeBitmap(Bitmap : integer; po : integer) : integer;');
|
||||||
|
AddFunction(@CreateBitmapMask,'function CreateBitmapMask(Bitmap : integer) : TMask;');
|
||||||
|
AddFunction(@FindMaskTolerance,'function FindMaskTolerance(mask: TMask; out x, y: Integer; xs,ys, xe, ye: Integer; Tolerance, ContourTolerance: Integer): Boolean;');
|
||||||
|
AddFunction(@FindBitmapMaskTolerance,'function FindBitmapMaskTolerance(mask: Integer; out x, y: Integer; xs, ys, xe, ye: Integer; Tolerance, ContourTolerance: Integer): Boolean;');
|
||||||
|
AddFunction(@FindDeformedBitmapToleranceIn,'function FindDeformedBitmapToleranceIn(bitmap: integer; out x,y: Integer; xs, ys, xe, ye: Integer; tolerance: Integer; Range: Integer; AllowPartialAccuracy: Boolean; out accuracy: Extended): Boolean;');
|
@ -51,6 +51,11 @@ type
|
|||||||
PSyncInfo = ^TSyncInfo;
|
PSyncInfo = ^TSyncInfo;
|
||||||
TErrorType = (errRuntime,errCompile);
|
TErrorType = (errRuntime,errCompile);
|
||||||
TOnError = procedure (ErrorAtLine,ErrorPosition : integer; ErrorStr : string; ErrorType : TErrorType) of object;
|
TOnError = procedure (ErrorAtLine,ErrorPosition : integer; ErrorStr : string; ErrorType : TErrorType) of object;
|
||||||
|
TExpMethod = record
|
||||||
|
FuncDecl : string;
|
||||||
|
FuncPtr : Pointer;
|
||||||
|
end;
|
||||||
|
|
||||||
TMMLPSThread = class(TThread)
|
TMMLPSThread = class(TThread)
|
||||||
procedure OnProcessDirective(Sender: TPSPreProcessor;
|
procedure OnProcessDirective(Sender: TPSPreProcessor;
|
||||||
Parser: TPSPascalPreProcessorParser; const Active: Boolean;
|
Parser: TPSPascalPreProcessorParser; const Active: Boolean;
|
||||||
@ -75,11 +80,13 @@ type
|
|||||||
procedure OnThreadTerminate(Sender: TObject);
|
procedure OnThreadTerminate(Sender: TObject);
|
||||||
procedure Execute; override;
|
procedure Execute; override;
|
||||||
public
|
public
|
||||||
|
ExportedMethods : array of TExpMethod;
|
||||||
PSScript : TPSScript; // Moved to public, as we can't kill it otherwise.
|
PSScript : TPSScript; // Moved to public, as we can't kill it otherwise.
|
||||||
Client : TClient;
|
Client : TClient;
|
||||||
StartTime : LongWord;
|
StartTime : LongWord;
|
||||||
SyncInfo : PSyncInfo; //We need this for callthreadsafe
|
SyncInfo : PSyncInfo; //We need this for callthreadsafe
|
||||||
property OnError : TOnError read FOnError write FOnError;
|
property OnError : TOnError read FOnError write FOnError;
|
||||||
|
procedure LoadMethods;
|
||||||
procedure SetPSScript(Script : string);
|
procedure SetPSScript(Script : string);
|
||||||
procedure SetDebug( writelnProc : TWritelnProc );
|
procedure SetDebug( writelnProc : TWritelnProc );
|
||||||
procedure SetDbgImg( DebugImageInfo : TDbgImgInfo);
|
procedure SetDbgImg( DebugImageInfo : TDbgImgInfo);
|
||||||
@ -178,10 +185,12 @@ begin
|
|||||||
OnError:= nil;
|
OnError:= nil;
|
||||||
// Set some defines
|
// Set some defines
|
||||||
{$I PSInc/psdefines.inc}
|
{$I PSInc/psdefines.inc}
|
||||||
|
// Load the methods we're going to export
|
||||||
|
Self.LoadMethods;
|
||||||
|
|
||||||
FreeOnTerminate := True;
|
FreeOnTerminate := True;
|
||||||
Self.OnTerminate := @Self.OnThreadTerminate;
|
Self.OnTerminate := @Self.OnThreadTerminate;
|
||||||
|
|
||||||
inherited Create(CreateSuspended);
|
inherited Create(CreateSuspended);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -255,9 +264,11 @@ begin
|
|||||||
PluginsGlob.MPlugins[PluginsToLoad[i]].Methods[i].FuncStr, cdStdCall);
|
PluginsGlob.MPlugins[PluginsToLoad[i]].Methods[i].FuncStr, cdStdCall);
|
||||||
for i := 0 to high(VirtualKeys) do
|
for i := 0 to high(VirtualKeys) do
|
||||||
PSScript.Comp.AddConstantN(Format('VK_%S',[VirtualKeys[i].Str]),'Byte').SetInt(VirtualKeys[i].Key);
|
PSScript.Comp.AddConstantN(Format('VK_%S',[VirtualKeys[i].Str]),'Byte').SetInt(VirtualKeys[i].Key);
|
||||||
|
// Here we add all the Consts/Types to the engine.
|
||||||
// Here we add all the functions to the engine.
|
|
||||||
{$I PSInc/pscompile.inc}
|
{$I PSInc/pscompile.inc}
|
||||||
|
//Export all the methods
|
||||||
|
for i := 0 to high(ExportedMethods) do
|
||||||
|
PSScript.AddFunction(ExportedMethods[i].FuncPtr,ExportedMethods[i].FuncDecl);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TMMLPSThread.RequireFile(Sender: TObject;
|
function TMMLPSThread.RequireFile(Sender: TObject;
|
||||||
@ -337,6 +348,7 @@ procedure TMMLPSThread.Execute;
|
|||||||
begin
|
begin
|
||||||
CurrThread := Self;
|
CurrThread := Self;
|
||||||
Starttime := lclintf.GetTickCount;
|
Starttime := lclintf.GetTickCount;
|
||||||
|
|
||||||
try
|
try
|
||||||
if PSScript.Compile then
|
if PSScript.Compile then
|
||||||
begin
|
begin
|
||||||
@ -359,6 +371,27 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMMLPSThread.LoadMethods;
|
||||||
|
var
|
||||||
|
c : integer;
|
||||||
|
procedure AddFunction( Ptr : Pointer; DeclStr : String);
|
||||||
|
begin;
|
||||||
|
// SetLength(ExportedMethods,c+1);
|
||||||
|
if c >= 200 then
|
||||||
|
raise exception.create('PSThread.LoadMethods: Exported more than 200 functions');
|
||||||
|
ExportedMethods[c].FuncDecl:= DeclStr;
|
||||||
|
ExportedMethods[c].FuncPtr:= Ptr;
|
||||||
|
inc(c);
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
c := 0;
|
||||||
|
SetLength(ExportedMethods,200);
|
||||||
|
{$i PSinc/psexportedmethods.inc}
|
||||||
|
|
||||||
|
SetLength(ExportedMethods,c);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TMMLPSThread.SetPSScript(Script: string);
|
procedure TMMLPSThread.SetPSScript(Script: string);
|
||||||
begin
|
begin
|
||||||
PSScript.Script.Text:= Script;
|
PSScript.Script.Text:= Script;
|
||||||
|
Loading…
Reference in New Issue
Block a user