Title: Re: importing messages: date field
On 17/2/01 2:27 am, "Rob Wheaton" <[EMAIL PROTECTED]> wrote:

> Does anyone know of a nice little droplet applescript or program that would
> do this job for me? I have searched the archives for this list, and oe-talk,
> but haven't found anything quite right.

here is the script code to convert a line from one format to the other:

set theLine to "Sent:        1/5/97 9:08 pm"
if theLine starts with "Sent:" then
    set newLine to {"Date:"}
    set theDate to date (text 6 thru -1 of theLine)
    set end of newLine to text -2 thru -1 of ("0" & day of theDate)
    set end of newLine to text 1 thru 3 of (month of theDate as text)-- won't work with versions of AS prior to OS8.5!!
    set end of newLine to year of theDate
    set theHours to text -2 thru -1 of ("0" & ((time of theDate) div hours))
    set theMins to text -2 thru -1 of ("0" & ((time of theDate) div minutes) mod 60)
    set end of newLine to theHours & ":" & theMins
end if
set {oldTIDS, AppleScript's text item delimiters} to {AppleScript's text item delimiters, " "}
set newline to newLine as text
set AppleScript's text item delimiters to oldTIDS

Can you do the code to take the files in a droplet, read the contents, convert to a list of paragraphs, check through the paragraphs for the 'Sent:' line & apply this code then write the result back to the original file?

if not, get in touch off list and I'll lead you through it
--
=Barry Wainwright=
<http://homepage.mac.com/barryw>

"The first human being who hurled an insult instead of a stone was the founder of civilization."
 -- Sigmund Freud

Reply via email to