unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}
var
  Namen : Array[1..82] of string;
  Waardes : Array[1..82] of integer;



procedure TForm1.Button1Click(Sender: TObject);
var
  Inlees : Textfile;
  tab : Boolean;
  karakter : char;
  naam : string;
  teller : integer;

begin
  Assignfile(Inlees,'Dartwaardes.txt');
  Reset(Inlees);
  teller := 0;
  while teller <> 82 do begin
  teller := teller + 1;
  tab := false;
  naam := '';
    while tab = false do begin
      Read(Inlees,karakter);
      If karakter = #9 then begin
        tab := True;
      end
      else begin
        naam := naam + karakter;
      end;
    end;
    Namen[teller]:=naam;
    Readln(Inlees,Waardes[teller]);

  end;
  CloseFile(Inlees);
  Showmessage('ingelezen');
end;

procedure TForm1.Button2Click(Sender: TObject);
var
  ExtUses : Textfile;
  ExtProc : Textfile;
  teller : integer;
  M, MM2 : string;
  MD2 : string;


begin
  M := 'procedure TForm2.';
  MM2 := 'MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);';
  MD2 := 'MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);';
  Assignfile(ExtUses,'ExtUses.txt');
  Assignfile(ExtProc,'ExtProc.txt');
  Rewrite(ExtUses);
  Rewrite(ExtProc);
  For Teller:= 1 to 82 do begin
   Writeln(ExtProc,M + Namen[teller] + MM2);
   Writeln(ExtProc,'begin');
   Writeln(ExtProc,'Score(''' + IntToStr(Waardes[teller]) + ''');');
   Writeln(ExtProc,'End;');
   Writeln(ExtProc,'');

   Writeln(ExtProc,M + Namen[teller] + MD2);
   Writeln(ExtProc,'begin');
   Writeln(ExtProc,'GeefScore(''' + IntToStr(Waardes[teller]) + ''');');
   Writeln(ExtProc,'End;');
   Writeln(ExtProc,'');

   Writeln(ExtUses,'Procedure ' + Namen[teller] + 'MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);');
   Writeln(ExtUses,'Procedure ' + Namen[teller] + 'MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);');

  end;
  CloseFile(ExtUses);
  CloseFile(ExtProc);
  Showmessage('Gedaan!');



end;

end.
