ブラウザの表面からコピーしたYahooの記事を
2006年 04月 10日
使う変数名、よく分かんない‥‥適当でいいんだろうけど。見てて自分で分かる言葉じゃないと困るし‥‥それだとさ‥‥「bunkatu1」とか「haihun80」とか、なが~いのになる‥‥(* ̄▽ ̄;A
Line,Text,Threebr: string;
DvText1,DvText2,DvText3,DvText4,DvText5: string;
DvText4a,DvText4b,DvText4c,Value: string;
Brhrbr: string;
n: integer;
begin
Line := '-';
for n := 1 to 79 do Line := Line + '-';
Text := GetClipBord;
Sleep(60);
Text := StringReplace(Text,' ' + '
','
',0);
Threebr := '
' + '
' + '
';
repeat
Text := StringReplace(Text,Threebr,'
',0)
until Pos(Threebr,Text) = 0;
for n := 1 to 5 4 do ←^^;「4」だった…。
begin
if n = 1 then DvText1 := Trim(StringDivide(Text,'
',0));
if n = 2 then DvText2 := Trim(StringDivide(Text,'
',0));
if n = 3 then DvText3 := Trim(StringDivide(Text,'
',0));
if n = 4 then DvText4 := Trim(StringDivide(Text,'
',0));
Text := Trim(StringDivide(Text,'
',-1));
end;
DvText5 := Text;
if Pos(Line,DvText5) = 1 then DvText5 := TrimLeft(Delete(DvText5,1,80));
if Pos(Line,DvText5) > 1 then
begin
DvText5 := StringReplace(DvText5,Line,'<HR>',0);
DvText5 := StringReplace(DvText5,'
','<BR>',0);
repeat
DvText5 := StringReplace(DvText5,' < BR > <HR> < BR > ','<HR>',0)
until Pos(' < BR > <HR> < BR > ',DvText5) = 0;
DvText5 := StringReplace(DvText5,' < BR > ','
',0);
end;
DvText4 := StringDivide(DvText4,'(',0);
Value := DvText4;
n := 1;
repeat
begin
if n = 1 then DvText4a := StringDivide(Value,'/',0);
if n = 2 then DvText4b := StringDivide(Value,'/',0);
Value := StringDivide(Value,'/',-1);
n := n + 1;
end
until n = 3;
DvText4c := Value;
if Length(DvText4b) = 1 then DvText4b := '0' + DvText4b;
if Length(DvText4c) = 1 then DvText4c := '0' + DvText4c;
DvText4 := DvText4a + DvText4b + DvText4c;
Text := DvText4 + DvText1 + '
' + DvText5;
SetClipBord(Text);
Sleep(60);
SetForegroundWindow(TargetWindow);
VKPaste(Text);
end;
最初「-」80個そのまま書いてて‥‥(* ̄▽ ̄;A for文を使ったら短くなるってやっと分かった‥‥。(だって使い方今日まで分かんなかったんだもん‥‥)
で、最初↓みたいに書いてたのも↑みたいに書けると今日知った‥‥のです。
repeat
begin
if n = 1 then DvText1 := Trim(StringDivide(Text,'
',0));
if n = 2 then DvText2 := Trim(StringDivide(Text,'
',0));
if n = 3 then DvText3 := Trim(StringDivide(Text,'
',0));
if n = 4 then DvText4 := Trim(StringDivide(Text,'
',0));
Text := Trim(StringDivide(Text,'
',-1));
n := n + 1;
end
until n = 5;
これよりは短くならないのかな‥‥。分かんない。
---追記---(2006/04/12)
短くしようとして散々失敗し、結局作れたのはもっと長かった‥‥orz.....