Title: Re: Would like a printed list of messages in a Folder
On 2/5/02 3:23 am, "Jim Colgate"  wrote:


From: Barry Wainwright <[EMAIL PROTECTED]>
Reply-To: "Entourage:mac Talk" <[EMAIL PROTECTED]>
Date: Wed, 01 May 2002 10:22:10 +0100
To: "Entourage:mac Talk" <[EMAIL PROTECTED]>
Subject: Re: Would like a printed list of messages in a Folder

This is the second time in recent days that I have seen this request, so here's a script to summarise what you want.

It will create a tab-delimited text summary of the selected message, and put this data on the clipboard, ready to be pasted into word, excel or whatever you find appropriate.

It's been done quickly, so there's not been a lot of testing, but it seems to cope with multiple attachments, long recipient lists, recipients without full addresses etc. If you find it trips up on anything, let me know and I'll tweak it. I have only tried the script with Entourage vX, but I can see no reason why it wouldn't work in v2001 as well.

Post the script below into script editor and save it as a compiled script in the 'Entourage Script Menu Items' folder that you will find in your MUD folder.

(note, this message has been posted as HTML to avoid line wrapping in the script. If you can’t get the script to compile, mail me off-list and I’ll send you a precompiled version)

I will (in a day or two) send the script off to AppleScriptcentral.com, but I’ve submitted a few there in recent weeks and they haven’t been posted yet (are you there Eric?) so I don’t know how long it will take to get them up there.


-- Start of Script --
    [snip]
-- End of Script --

Barry,

Thanks a lot for the quick script. It was exactly what I was seeking; actually even  more since I get a list of all the attachments rather than just an indication that there are attachments. In testing it I did not find any errors, but did feel a need for a couple enhancements.

(1) The date field was complete, but did not allow for expected sorting in Excel. I dug in the Entourage dictionary, the applescript guide, and the Apple webpage to find a way to get the date and time without the day of the week. My hack is in the revised script below. Is there a better way of doing it?

There are ‘other’ ways of doing it, but yours works fine. I must admit that I didn’t try sorting in excel after pasting in – I just looked at the results and they ‘looked’ all right.

(2) The recipient display names ended up with a lot of extra double quotes. If there was no display name then there was an empty set of double quotes. If the display name already had quotes (single or double) around them then they ended up with two sets of quotes at the front and back. I also ran into a strange occurrence — the first displayed  name did not have any leading quotes, even if they were in the original display name and it was followed by no quotes if there were none in the original display  name and two quotes otherwise. The second and third recipient always showed two sets of quotes before and after the displayed name if the original display  name contained quotes and one set of quotes before and after otherwise.

Yes, I thought about that. I added the quotes in case there were commas or other illegal characters in the display name. These are allowed in the full display name is enclosed with quotes. However, I forgot that name already with quotes would get a double set. It would be fairly easy to check for this and only add the extra set if required. Just a few more lines of code.

For item (2), I decided that I only needed the display name (unless there was none — and then I used the address) for both the sender and the recipients. See my additions below.

Well, I wasn’t sure if you wanted display names, addresses or both. I decided that both would probably cover all bases. If you only want the display name, that’s a lot easier – I see you figured it out just fine.

I have no real background in scripting so I kind of use the bruit force method. I am always interested in learning more, so let me know if there is a more elegant way to accomplish what I did.

The basic rule in scripting is “if it works, it’s a good solution”. Your method works. I would probably have done something slightly different, but Paul B would have found a third way and Allen W a fourth...

One other thing I did once I got into Excel to make the sorting more useful there was to remove the “RE: “ and “FW: “ leaders on replies and forwards. It would be nice to remove them from the subject line while creating the list if it is easy. Since the links are lost in the mbox file, at least being able to sort the list by subject is helpful.

Good thought. Here’s how I would do it:

If theSub contains “:” then
If text 1 thru 3 of thesub is in {“re:”, “re[“, re(“, “fw:”, “fwd”} then
Set AppleScript’s text item delimiters to {“:”}
Set newSub to text items 2 thru –1 of thesub
Set AppleScript’s text item delimiters to {}
Set newsub to newsub as text
Repeat until first character of newsub is not space
Set newsub to text 2 thru –1 of newsub
End repeat
End if
End if

Thanks again Barry. Following is the script with my modifications highlighted.

The mods are fine. Glad it worked out for you :)

--
Barry Wainwright
<http://www.barryw.net>


The best things are not always the most popular.
The most popular things are not always the best.

Reply via email to