QuickMail to FileMaker Applescript
QuickMail to FileMaker Applescript
- Subject: QuickMail to FileMaker Applescript
- From: Bill Ferguson <email@hidden>
- Date: Tue, 2 Apr 2002 17:07:55 -0800
Hi Applescripters,
I'm trying to modify an Applescript to move email messages from QuickMail
to a FileMaker database. CE Soft has an Applescript to do this, however,
one item is missing from it; There is no TO field. I would like to keep
the TO info, to know who the messge was sent TO.
Could someone tell me how to add the TO field (also called Recipients) to
this script? I've tried and can't get it to work.
Below is the whole applescript that works, but has no TO (Recipients)
field. I've cut a section out and brought it to the top.
I opened QuickMail Dictionary and found "Recipients" is the field for TO:
I tried this line, but it doesn't seem to work.
set myWhoTo to first item of Recipients of messageData
Does anyone has experience with Applescript and QuickMail 1.5.4 ?
------ My attempt -----
-- Opening the message is required to get these items.
open theFolderName Message Message ID of messageInfo
set messageData to Get Message
Message Close
set myTopic to Topic of messageData
set myBody to Body of messageData
set theSender to first item of Senders list of messageData
set myWhoTo to first item of Recipients of messageData
set myFirstName to First name of theSender
set myLastName to Last name of theSender
------------------
2. Also I'm trying to add the folder name. I'd like to keep the name of
the folder that the email was stored in, and move that to the FileMaker
database also.
----------
Thanks for your help,
Bill Ferguson
Career Action Center
www.careeraction.org
------------ Whole original starts here -------------------
-- QuickMail Pro script
-- Archive Selected Messages
-- Author: Chris Tyrrell, CE Software Quality Assurance
-- Date: 12/5/96
on Alert(alertText)
display dialog alertText buttons {"OK"} default button "OK"
end Alert
on OpenArchive()
tell application "FileMaker Pro"
activate
if not (exists database "Mail Archive") then
-- The next few lines get the path to QuickMail Pro. The
-- Archive database is expected to be in the same folder.
tell application "3 QuickMail Pro"
copy (path to application "3 QuickMail Pro") as string to thePath
end tell
set oldDelimiters to AppleScript's text item delimiters
set AppleScript's text item delimiters to {":"}
set theString to ""
repeat with x from 1 to ((count text items of thePath) - 1)
set theString to theString & (text item x of thePath) & ":"
end repeat
set AppleScript's text item delimiters to oldDelimiters
try
open file (theString & "Mail Archive")
on error
my Alert("The Mail Archive database could not be opened." & return & ,
"Please make sure that it is in the same folder as QuickMail Pro.")
end try
end if
return (exists database "Mail Archive")
end tell
end OpenArchive
on ArchiveMessages(messageList, theFolderName)
--Make sure that FileMaker is running and the mail database is open
if my OpenArchive() then
repeat with x from 1 to count of messageList
tell application "3 QuickMail Pro"
-- These items are available without ever opening the message.
set messageInfo to (item x of messageList)
set myWhoFrom to Who from of messageInfo
set myPriority to Priority of messageInfo
set myEnclosures to Enclosures of messageInfo
set myDateSent to (Date sent of messageInfo)
set myDateReceived to Date received of messageInfo
set mySize to Size of messageInfo
-- Opening the message is required to get these items.
open theFolderName Message Message ID of messageInfo
set messageData to Get Message
Message Close
set myTopic to Topic of messageData
set myBody to Body of messageData
set theSender to first item of Senders list of messageData
set myFirstName to First name of theSender
set myLastName to Last name of theSender
set myMailAccount to Mail Account of theSender
set myContent to Content of theSender
set myEncoding to Encoding of theSender
end tell
tell application "FileMaker Pro"
create record at database "Mail Archive" with data {myTopic, myBody,
myWhoFrom, ,
myFirstName, myLastName, myMailAccount, myContent, myEncoding,
myPriority, ,
myEnclosures, myDateSent, myDateReceived, mySize}
end tell
end repeat
end if
end ArchiveMessages
tell application "3 QuickMail Pro"
activate
copy (Get Mail Folders) to theFolderList --Get a list of folders,
including Inbox, Outbox, Sent Items, and Trash
set FolderCount to count of theFolderList
set messageCount to 0
--Step through the folders, handling each folder's selection.
repeat with x from 1 to FolderCount
set whichFolder to (item x of theFolderList) -- 'Tis better to store an
item than to calculate it more than once
set theMailList to (Get Mail List Selected Folder Name whichFolder)
set itemCount to count of theMailList -- The number of messages
selected in the current folder.
set messageCount to messageCount + itemCount -- The total number of
messages selected.
if itemCount > 0 then
my ArchiveMessages(theMailList, whichFolder)
end if
end repeat
if messageCount = 0 then
my Alert("There were no messages selected, so no messages were
archived.")
end if
end tell
_______________________________________________
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.