quickmail-check if empty
quickmail-check if empty
- Subject: quickmail-check if empty
- From: Bill Ferguson <email@hidden>
- Date: Thu, 25 Apr 2002 15:54:39 -0700
hi applescripters,
i have a problem i'd like to ask your help on. i'm trying to modify a
script to move email messages from quickmail to filemaker pro database.
it mostly works, with this problem.
when i copy the CC (email address) to a variable, it works fine WHEN
there IS a CC address. When there is NO CC address, it doesn't work, the
script stops
the command i'm using is: set myWhoCC1 to first item of CC of messageData
i think one way to do this is to check if the CC field is empty:
QUESTION: how do i do this, what's the syntax for checking if something
is empty?:
-- Something like:
If first item of CC is NOT empty then
set myWhoCC1 to first item of CC of messageData
EndIf
Or how else could i do this?
thanks for any suggestions you can give,
bill f
-------------------------
-- 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 read 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
-- This is for the To or recipents of the email
-- I'me only taking first 5, but could be unlimited
set myWhoTo1 to first item of Recipients of messageData
set myWhoTo2 to second item of Recipients of messageData
set myWhoTo3 to third item of Recipients of messageData
set myWhoTo4 to fourth item of Recipients of messageData
set myWhoTo5 to fifth item of Recipients of messageData
set myWhoCC1 to first item of CC of messageData
set myWhoCC2 to second item of CC of messageData
set myWhoCC3 to third item of CC of messageData
set myWhoCC4 to fourth item of CC of messageData
set myWhoCC5 to fifth item of CC of messageData
-- Now we break them out and put them into variables
-- First we do the TO or Recipeients
set toFirst1 to First name of myWhoTo1
set toLast1 to Last name of myWhoTo1
set toaddress1 to Mail Account of myWhoTo1
set toFirst2 to First name of myWhoTo1
set toLast2 to Last name of myWhoTo1
set toaddress2 to Mail Account of myWhoTo1
set toFirst3 to First name of myWhoTo1
set toLast3 to Last name of myWhoTo1
set toaddress3 to Mail Account of myWhoTo1
set toFirst4 to First name of myWhoTo1
set toLast4 to Last name of myWhoTo1
set toaddress4 to Mail Account of myWhoTo1
set toFirst5 to First name of myWhoTo1
set toLast5 to Last name of myWhoTo1
set toaddress5 to Mail Account of myWhoTo1
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, ,
myFirstName, tofirst, tolast, tomail}
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
Bill Ferguson, IT Manager
Career Action Center
408-343-2746
_______________________________________________
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.