Saving Entourage Attachment solution
Saving Entourage Attachment solution
- Subject: Saving Entourage Attachment solution
- From: Dan Doughtie <email@hidden>
- Date: Fri, 02 Apr 2004 09:54:24 -0500
For those who care.
This script grabs attachments in an incoming email and saves them to a
folder that is determined by comments the sender puts in the subject line.
Another system checks that folder and inserts it into a database.
It checks the beginning of the subject line as a simple security test to
make sure the sender followed instructions. I could make it more elaborate
using a scrambled date code. That comes next after I get some sleep.
Not shown in this version is check where I get the sender's address and if I
don9t know them then MyProcess is set to a value that throws it in the
failed folder.
First this has to be under a try statement or it fusses when it doesn9t see
an attachment. The script that this us pulled from also does other tasks
other than grab photos, it also cleans up text so it clean for editorial
use.
This checks to make sure the attachment is a jpeg. If not then it gets moved
to a failed folder in Entourage. It also checked to make sure that the
first 4 characters of the subject line is a number less than 1300 (the
intent being something less than the highest date of 1231).
Assume that the script has already set a starting path (MyPhotoDisk) to save
the attachment.
An Entourage Rule moves everything to folder "XYZ" then it launches the
Applescript.
tell application "Microsoft Entourage"
set mymessages to every message in folder "XYZ"
repeat with x in mymessages
set mySubject to subject of x
set AttachCheck to the name of attachment 1 of x
if AttachCheck ends with ".jpg" then
set myDateProcess to characters 1 thru 4 of mySubject as string
set myDateProcess to myDateProcess as number
if myDateProcess is greater than 1 and myDateProcess is less
than 1300 then
set myProcess to "PIX"
else
set myProcess to ""
end if
else
set myProcess to ""
end if
***********
Later
**********
if myProcess = "PIX" then
if mySubject contains "-a-" then
set myPixCat to "Gen_News_JPGs:"
else if mySubject contains "-b-" then
set myPixCat to "SpecialProjects_JPGs:"
else if mySubject contains "-c-" then
set myPixCat to "Features_JPGs:"
else if mySubject contains "-s-" then
set myPixCat to "Sports_JPGs:"
else if mySubject contains "-BRV-" then
set myPixCat to "Sports_JPGs:"
else if mySubject contains "-car-" then
set myPixCat to "Sports_JPGs:"
else
set myPixCat to "Gen_News_JPGs:"
end if
set myPixFolder to myPhotoDisk & myPixCat & AttachCheck as
string
set mySavedPix to save attachment 1 of x in myPixFolder
end if
--
Dan Doughtie
Business Analyst
Morris Technology Services
_______________________________________________
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.