From: Joseph Polanik
Problem: I save a lot of articles from this and other lists. I store them
in a Random Information Manager named InfoSelect 3. I want each msg to end
up as a separate note, not a part of a long text file. However, I don't
want to keep any header lines except for date, from and subject.
Solution:
//Declarations
string HeaderStart[7] = "Testing"
forward proc PurgeHeader()
forward proc PurgeMoveSubjLine()
forward proc PurgeDateFrom()
proc mStripper()
Set (Break, ON)
Set (WordWrap, OFF)
BegFile()
HeaderStart = GetText(1, 7) //Identify the start of a Msg
repeat
If Find(HeaderStart, "X^")
BegLine()
InsertLine(Format('~')) //Prepares file for InfoSelect
Down()
KillLine()
PurgeHeader()
PurgeMoveSubjLine()
PurgeDateFrom()
endif
until not Down()
BegFile()
KillLine()
Set (WordWrap, ON)
end mStripper
mStripper()
//Wipe out a variable number of characters
proc Purge(integer i)
while i
DelChar()
i = i - 1
endwhile
end
//Wipe out all but 'Date', 'From' and 'Subject' lines
proc PurgeHeader()
STRING TestString[5] = "Test:"
BegLine()
While iif(EndLine(),BegLine(),BegLine())
TestString = GetText(1, 5)
case TestString
when "Date:"
Down()
when "From:"
Down()
when "Subje"
Down()
otherwise
KillLine()
endcase
endwhile
end
//Make Subject line the first line of each msg
proc PurgeMoveSubjLine()
BegLine()
while Chr(CurrChar()) "S" //Locate Subject line
Up()
endwhile
Purge(9) //Wipes out the string 'Subject: '
DelLine() //Move to the Line following the '~'
repeat
Up()
until Chr(CurrChar()) == '~'
Down()
InsertLine()
Undelete() //Inserts line and its original CR
end
/*************************** PurgeDateFrom *************
Purges all but DD Mmm YY from the date line and all but name and
email address from "From:" line
Handles two formats:
Date: Sun, 22 Jun 97 18:25:17 PDT and
Date: 22 Jun 97 18:25:17 PDT
****************************************************************/
proc PurgeDateFrom()
STRING TestString[5] = "Test:"
string TestDigit[2] = "ZZ"
INTEGER Twice = 2
integer k = 3
BegLine()
while Twice //Purge 2 lines (Date & From)
TestString = GetText(1, 5)
If TestString == "Date:"
Twice = Twice - 1
Purge(6) //delete "Date: "
TestDigit = GetText(1, 2)
If not Val(TestDigit) //Detects DOW
Purge(5) //Purges if Present
endif
while k
NextChar()
if IsWhite() //skip DD mmm YY components
k = k - 1
endif
endwhile
DelToEol()
BegLine()
elseif TestString == "From:"
Purge(6)
Twice = Twice - 1
endif
Down()
endwhile
Down() // Add extra line after header
InsertLine()
end
/*****************************************************************************
Note 1: Inserting a '~' [tilde] at the beginning of each note prepares the
stripped file for importation by InfoSelect which treats the tilde as a
signal to start a new note.
Note 2: I don't sell InfoSelect nor work for its maker (MicroLogic). I just
use it.
Note 3: Stripper may not remove header lines that aren't in the msg header
as when they are part of a quoted msg.
Note 4: Stripper may have to be customized for different browsers or for
different types of lists or for msgs containing a list's archive files. I'd
appreciate hearing how you customize this macro.
****************************************************************************
***/
---
---------------
* Origin: apana>>>>>fidonet [sawasdi.apana.org.au] (3:800/846.13)
|