人気ブログランキング | 話題のタグを見る

私の人生無駄ばかり…そんな日々。


by dugong156
カレンダー
S M T W T F S
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

ブラウザの表面からコピーしたYahooの記事を

こないだYahooのブログをそのままブラウザの表面からコピーしたのを移す時に、コピペするのが面倒だったので、FaceStickのマクロで日付を「20060410」の8桁に直して先頭に付けて(別に直さなくてもいいんだけどNami2000で見た時にそれだけ短くなるからツリーが見やすいから‥‥^^;)、要らない所は削って‥‥最後に本文付ける様に並び替えようとしたら、こうなりました。

使う変数名、よく分かんない‥‥適当でいいんだろうけど。見てて自分で分かる言葉じゃないと困るし‥‥それだとさ‥‥「bunkatu1」とか「haihun80」とか、なが~いのになる‥‥(* ̄▽ ̄;A



var

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文を使ったら短くなるってやっと分かった‥‥。(だって使い方今日まで分かんなかったんだもん‥‥)
で、最初↓みたいに書いてたのも↑みたいに書けると今日知った‥‥のです。

n := 1;
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.....
by dugong156 | 2006-04-10 15:52 | パソコンあれこれ