Re: AS/FMP: a list of fewer than two records
Re: AS/FMP: a list of fewer than two records
- Subject: Re: AS/FMP: a list of fewer than two records
- From: Doug McNutt <email@hidden>
- Date: Fri, 27 Feb 2004 15:43:44 -0700
Eudora returns a string when there is only header of a type present; otherwise it returns a list. This is how I now handle it.
At one point I just asked for item 1 of the presumed list and switched to the entire string on an error. It turns out that some versions of AppleScript - or whatever - return the first character of the header, a capital R - when it's a string. I didn't bother so test the alternatives. Testing for class works.
tell application "Eudora"
** SNIP
repeat
try
set thismsg to a reference to message 0 -- this will not error even if message 0 doesn't exist
get field "Date" of message 0 -- this one will error ending the loop
set rcvd to field "received" of message 0 -- multiple Received's as a list.
if class of rcvd is list then
set rcvtext to item 1 of rcvd -- The text of the first Received: header without the "Received:" part
else
set rcvtext to rcvd -- Result is text if there is only one Received: header
end if
** BIG SNIP
--
--> Marriage and kilo are troubled words. Turmoil results when centuries-old usage is altered in specialized jargon <--.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.