Re: Outlook Express rules?
Re: Outlook Express rules?
- Subject: Re: Outlook Express rules?
- From: Paul Berkowitz <email@hidden>
- Date: Thu, 24 May 2001 08:41:32 -0700
On 5/24/01 4:18 AM, "JollyRoger" <email@hidden> wrote:
>
on 5/23/2001 11:09 PM, Paul Berkowitz at email@hidden wrote:
>
>
> On 5/23/01 4:00 PM, "JollyRoger" <email@hidden> wrote:
>
>
>
>> Does anyone know if it is possible to create / manipulate Outlook Express
>
>> rules via AppleScript? I scanned the OE dictionary, but did not find
>
>> anything mentioning rules.
>
>
>
> No, Rules aren't scriptable in the sense of 'run Rule "Do Something"'. But
>
> since every single thing that can be done by a Rule can be done by
>
> AppleScript instead, using OE's object model and commands, just script the
>
> same things that the "Do Something" rule does instead and run the script.
>
>
I wanted to write a script for my grandfather that would create a rule on
>
his machine to add all incoming addresses to his address book. It's a shame
>
Outlook Express doesn't let you create rules via AppleScript.
>
That's true, but you don't need a script to do what you want in OE 5. If you
go to Tools --> Rules (Mail POP) --> New, just leave the criteria at <All
messages> and set the Action popup to <Add sender to Address Book>. (Uncheck
the box that says "Stop applying rules to this message".) I just tested it
and it's smart enough not to make duplicates.
As I said, you can usually script anything that a Rule can do, and then
some. Just supposing that there were no action to add the sender to the
Address Book you could do it yourself. On the "Send & Receive All" schedule,
you could add an action to <Run AppleScript> after the sending and receiving
actions, and set it to navigate to this script, saved as a compiled script
in the Script Menu Items folder:
---------------------
tell application "Outlook Express"
repeat while connection in progress
delay 1
end repeat
set newMsgs to every message in in box folder whose read status is
untouched
repeat with i from 1 to (count newMsgs)
set newMsg to item i of newMsgs
set {dName, eAddress} to {display name, address} of sender of newMsg
set foundContacts to find eAddress
if foundContacts = {} then
set AppleScript's text item delimiters to {space}
set lName to last text item of dName
try
set fName to "" & text items 1 thru -2 of dName
on error
set fName to ""
end try
set AppleScript's text item delimiters to {""}
set newContact to make new contact with properties {last
name:lName, first name:fName}
make new email address at newContact with properties
{contents:eAddress}
end if
end repeat
end tell
--------------------------
It's not as neat as filtering each new message one by one as it comes in,
but it will do the job. If there are other rules that move messages to the
folders, you'd have to check each folder.
--
Paul Berkowitz