SelectiveQuotedDestructor

From 40tude Dialog Wiki

If you want delete only a part of the quoted line when answering, the Q command is not appropriate as it deletes all the quoted lines of a post. Selective quoted line destructor replace the lines selected in the writing window by one quoted line with the indicatio of the number of replaced quoted lines.

Program SelectiveQuotedDestructor;

{**********************************************
version beta 1.02 - 28/07/2003
This script replace all the quoted lines
coiped in the clipboard by a single quoted
line with the number of replaced quoted line

In the Write Window, select the quoted lines
to be replaced. Copy them in clipboard (Ctrl-C)
select a scriptable Dialog Window (see below)
and run the script, come back to the write
window and then past the result (Ctrl-V)

This script cannot be run directly form the
writewindow, as Keybord Shortcut running
script are not recognised in it.

Or you select the Dialog main Window (Alt-Tab)
and press the short cut (if defined)
or you select the Dialog Script Window, select
the script and run it.

There is no check to see if the lines in the
clipboard are or are not actual quoted lines


***********************************************}


uses
   Forms,
   StdCtrls;

VAR
   DummyForm : TForm;
   DummyMemo : TMemo;
   QuotedLines : String;

BEGIN
   DummyForm := TForm.Create(Nil);
   try
   DummyMemo := TMemo.Create(DummyForm);
   DummyMemo.Parent := DummyForm;
   DummyMemo.WordWrap := false;
   DummyMemo.PasteFromClipBoard;
   IF DummyMemo.Lines.Count > 0 THEN
   BEGIN
      IF DummyMemo.Lines.Count = 1 THEN
         QuotedLines := '> ['+ inttostr(DummyMemo.Lines.Count) + ' quoted line supressed]'
      ELSE
         QuotedLines := '> ['+inttostr(DummyMemo.Lines.Count)+ ' quoted lines supressed]';
      DummyMemo.Clear;
      DummyMemo.Lines.Add(QuotedLines);
      DummyMemo.SelectAll;
      DummyMemo.CopyToClipBoard;
      beep;
   END;
   finally
   DummyForm.Free
   end
END.