Re: "[AS]" on subject line? Script solution
Re: "[AS]" on subject line? Script solution
- Subject: Re: "[AS]" on subject line? Script solution
- From: Chris Adams <email@hidden>
- Date: Sun, 06 May 2001 22:49:32 -0400
I manage and sort hundreds of emails from dozens of lists every day with OE5
using the following script:
http://www.cypresslakestudios.com/applescript/index.html#sortinbox
(color-coded script text is available from this link)
It looks at the reply address to figure out where to route the message (see
this by opening a message and hitting shift-apple-h. The script keeps 2
lists: one containing the first few letters of the reply-to address and the
other list keeps the destination folders. If the folder does not exist, the
script will create it.
I have used it for months now and I am very happy with it: it really
separates the wheat from the chaff, and I can wait until I have 50-100
messages in a folder before I even bother to open it.
(I can also sort each in box by thread, so that I only had to read one of
these messages to get the gist of the thread.)
I also include an "open the sort in box" script in the script folder for OE
so that it is easy to make adjustments.
I hope that this helps, and the text of the script follows:
============== script text:
global myKeywordMatches
on run
-- **************************************************************
-- set variables
-- **************************************************************
-- *********************************************************
set myKeywords to {"applescript", "dvd", "livestage", "cma", "BB", ,
"junk", "Chris", "quicktime", "data", "macos", "games",
"streaming-server-users", "apple-hi", "web-authoring", "owner-talk", ,
"quicktime-vr-admin", "quicktime-talk", "quicktime-api",
"quicktime-java", "sentto", "telecine-request", "MacDV-report", ,
"bounce-skunkworks", "bounce-cml", "bounce-filmandvideo",
"Cleaner-List-report", "owner-cleaner", "sentto-1218791", "lsp3beta", ,
"infolist-admin", "star", "mysql-return"}
-- both lists must have the same number of items for this to work
set targetfolderlist to {"in:applescript", "in: dvd", "in:livestage",
"in: cma", "in:BB edit", ,
"in: junk", "in: Chris", "in: Quicktime", "in: data", "in: macos",
"in:games", "in:streaming server", "in:human interface", "in:
web-authoring", "in: interarchy", ,
"in: QT VR", "in: QT talk", "in:QT API", "in: QT Java", "in: Media
Cleaner", "in:TIG", "IN: Mac DV", "in:skunkworks", "in: CML", "in: Film and
Video", ,
"in: Media Cleaner", "in: Media Cleaner", "in: theory edge",
"in:lsp3 beta", "in:MPEG4", "in:simulation", "in:mySQL"}
set myIncludeSubject to false
set myIncludeBody to false
-- **************************************************************
-- outlook express : check for folders and create
-- **************************************************************
tell application "Outlook Express"
-- if target folders do not exist then create them
repeat with targetfolder in targetfolderlist
if folder named targetfolder exists then
else
make new folder with properties {name:targetfolder}
end if
end repeat
end tell
-- **************************************************************
-- outlook express: move mail
-- **************************************************************
tell application "Outlook Express"
set myMessages to every message in folder "Inbox"
repeat with myMessage in myMessages -- look at every message
-- *********************** parse the header
-- there are 14 characters in the "Return-Path: <"
set thenumberofcharacters to 14
set theheader to headers of myMessage as string --recipient
--address
set thereturnpath to "Return-Path: <" as string
set theaddressee to "" as string
--the brute force method to get the return path
-- after it finds the thereturnpath phrase, it takes the
-- string of characters found after the "<" and before the
-- "@" and saves it as theaddressee string
repeat until (character thenumberofcharacters of theheader =
"@")
set theaddressee to theaddressee & character
thenumberofcharacters of theheader
set thenumberofcharacters to thenumberofcharacters + 1
end repeat
--********************* end parse the header
set myFound to false
set itemnumber to 0
-- ************************* look for keywords
repeat with myKeyword in myKeywords --look for the keywords
set itemnumber to itemnumber + 1 --matches keywords with
folder
if theaddressee contains myKeyword then
set myFound to true
set targetfolder to item itemnumber of targetfolderlist
end if
end repeat
if myFound then
my processMail(myMessage, targetfolder)
end if
end repeat
-- ************************* end look for keywords
end tell
end run
on processMail(myMessage, targetfolder)
tell application "Outlook Express"
move myMessage to folder named targetfolder
end tell
end processMail
--
Chris Adams
Cypress Lake Studios
Hypermedia, Quicktime, and Internet Design
http://www.cypresslakestudios.com
email@hidden