Programovaný pohyb a klikanie myši.

procedure TForm1.Button1Click(Sender: TObject);
begin
  ShowMessage('Button 1 clicked');
end;
 
procedure TForm1.Button2Click(Sender: TObject);
var
  Pt : TPoint;
begin
 {Allow Button2 to repaint it's self}
  Application.ProcessMessages;
 {Get the point in the center of button 1}
  Pt.x := Button1.Left + (Button1.Width div 2);
  Pt.y := Button1.Top + (Button1.Height div 2);
 {Convert Pt to screen coordinates}
  Pt := ClientToScreen(Pt);
 {Convert Pt to mickeys}
  Pt.x := Round(Pt.x * (65535 / Screen.Width));
  Pt.y := Round(Pt.y * (65535 / Screen.Height));
 {Move the mouse}
  Mouse_Event(MOUSEEVENTF_ABSOLUTE or
              MOUSEEVENTF_MOVE,
              Pt.x,
              Pt.y,
              0,
              0);
 {Simulate the left mouse button down}
  Mouse_Event(MOUSEEVENTF_ABSOLUTE or
              MOUSEEVENTF_LEFTDOWN,
              Pt.x,
              Pt.y,
              0,
              0);
 {Simulate the left mouse button up}
  Mouse_Event(MOUSEEVENTF_ABSOLUTE or
              MOUSEEVENTF_LEFTUP,
              Pt.x,
              Pt.y,
              0,
              0);
end;