Re: Outlook Express: deleting HTML
Re: Outlook Express: deleting HTML
- Subject: Re: Outlook Express: deleting HTML
- From: Paul Berkowitz <email@hidden>
- Date: Sun, 10 Feb 2002 19:24:12 -0800
On 2/10/02 5:07 PM, "Gnarlodious" <email@hidden> wrote:
>
I'm trying to use a script to delete OE HTML fermatted e-mail, since it
>
doesn't have that choice in the Rules.
>
>
Has anyone figured this out, cause this is not working:
>
>
tell application "Outlook Express"
>
if has html of current messages is true then
>
--delete the sucker
>
end if
>
end tell
>
>
The plan is to run a script from the Rules as the messages come in.
>
>
And how do we do real time debugging in OE without sending ourselves HTML ?
>
'current messages' is a list - regular AppleScript list, not a collection of
individual application objects on which you can get a single property such
as 'has html') . you have to use a repeat loop on each item if you select a
group of messages. ('current messages' can also refer to selected messages,
even if they are not in the front window and you can't use 'selection')
Fortunately, Rules filters operate on message at a time anyway, so there's
no slowdown (other than that of running any rule: they all work on one
message at a time). In the case of a Rule, the 'selection' is just a
single-item list, such as
{message id 12345}
The way you get at the OE message on which the Rule calling the script is
filtering is like this:
set theMessage to item 1 of (get current messages)
OR
set currentMessages to (current messages)
set theMessage to item 1 of (current messages)
If you use the first way, you _must_ use the 'explicit get'; otherwise
evaluate it as a variable first. If you don't
item 1 of (current messages)
fails, because the class of (current messages), unevaluated, is 'property'
(it's an application [property) , not list, so it hasn't got any items. I
know it's weird, but there are a lot of apps like that, and quite a few
other such examples within OE.
So your script becomes:
tell application "Outlook Express"
set theMessage to item 1 of (get current messages)
if has html of theMessage then
delete the theMessage
end if
end tell
That actually just puts it in the Deleted Items folder. If you write
delete theMessage
a second time, that expunges it from the Deleted Items folder. Or you could
set read status of theMessage to read
so it doesn't shout at you (folder) from the trash.
But why not do this instead:
tell application "Outlook Express"
set theMessage to item 1 of (get current messages)
if has html of theMessage then
set content of theMessage to (get content of theMessage)
end if
end tell
Getting 'content of theMessage' converts it to plain text! - it's just a
string then. (It pays to remember that if you ever want to preserve HTML.)
--
Paul Berkowitz
_______________________________________________
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.