1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
| unit Unit_AutoRobot;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,Utilitaires, ExtCtrls;
type
TForm1 = class(TForm)
Timer1: TTimer;
procedure FormCreate(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Déclarations privées }
public
{ Déclarations publiques }
end;
var
Form1: TForm1;
X,Y: Integer;
FichierIni: textfile;
Const
//NomFichier='C:\users\Gerard\Appdata\AutoRobot.ini';
NomFichier='AutoRobot.txt';
implementation
{$R *.dfm}
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Timer1.Enabled:= false;
AssignFile(FichierIni,NomFichier);
rewrite(FichierIni);
writeln(FichierIni,IntToStr(Top));
writeln(FichierIni,IntToStr(Left));
CloseFile(FichierIni);
end;
procedure TForm1.FormCreate(Sender: TObject);
Var Valeur: String;
begin
if FileExists(NomFichier) then
Begin
AssignFile(FichierIni,NomFichier);
try
reset(FichierIni);
readln(FichierIni,Valeur);
Top:=StrToInt(valeur);
readln(FichierIni,Valeur);
left:=StrToInt(valeur);
finally
CloseFile(FichierIni);
end;
End;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
X:= Left-5;
Y:=Top-5;
SetCursorPos(X,Y);
mouse_event(MOUSEEVENTF_LeftDOWN , 0, 0, 0, 0);
mouse_event(MOUSEEVENTF_LefTUP,0,0, 0, 0);
end;
end. |
Partager