-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathUnit1.pas
More file actions
108 lines (95 loc) · 2.19 KB
/
Unit1.pas
File metadata and controls
108 lines (95 loc) · 2.19 KB
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
Button2: TButton;
Edit2: TEdit;
Button3: TButton;
od: TOpenDialog;
sd: TSaveDialog;
Button4: TButton;
Edit3: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
pb: TProgressBar;
procedure Button4Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var fname,ext:string;
begin
if od.Execute then
begin
edit1.Text:=od.FileName;
ext:=ExtractFileExt(od.FileName);
fname:=copy(od.FileName,1,length(od.FileName)-length(ext));
edit2.Text:=fname+'(çâîíêè ïî ïèíêîäó)'+ext;
edit3.Text:=fname+'(ÎÑÒÀËÜÍÛÅ çâîíêè)'+ext;;
pb.Position:=0;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
if sd.Execute then edit2.Text:=sd.FileName;
end;
procedure TForm1.Button3Click(Sender: TObject);
var
inf,outf,outf2 : system.Text;
s: string;
le:integer;
pbp:double;
begin
button3.Enabled:=false;
if not fileexists(edit1.text) then exit;
assignfile(inf,edit1.text);
assignfile(outf,edit2.text);
assignfile(outf2,edit3.text);
reset(inf);
rewrite(outf);
rewrite(outf2);
le:=FileSize(inf)*128;
pb.Max:=1000;
pb.Position:=0;
pbp:=0;
while not EOF(inf) do
begin
readln(inf,s);
pbp:=pbp+length(s);
pb.Position:=round(pbp/le*1000);
if length(s)>19 then
if s[19]='*' then
begin
writeln(outf,s);
continue;
end;
if length(s)>0 then
if (s[1]>='0') and (s[1]<='9') then
writeln(outf2,s);
end;
closefile(inf);
closefile(outf);
closefile(outf2);
pb.Position:=pb.Max;
button3.Enabled:=true;
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
if sd.Execute then edit3.Text:=sd.FileName;
end;
end.