I ws hoping that someone could help me to solve this problem. I will try to
be brief.
I use Entourage, and have used a script (below) to archive my emails into a
Filemaker database. This has worked VERY well for me for years now.
My problem is that I wish to move to the OS X version of Entourage, but the
script will not work correctly.
The latest Entourage requires OS X.
But the script is dependant upon “Tanaka’s OSAX”, which is NOT available for
OS X.
The script will run under OS 9 just fine as long as I use Entourage 2001, but Entourage (latest version) will not work.
So, it appears that I have several choices:
-
Get something to replace Tanaka’s OSAX (and whatever THAT would be, I
have no clue). Maybe someone can look at the script below to see. I would
have to have the new OSAX and also modify the script somehow. -
Somehow get the script to run under “Classic” so that it woil see the
OSAX … but how to do that? I have no clue. Plus, again, Entorage is OS X
only so I dont know if that would work.
Any ideas? Can anyone help?
Having to use the old Entourage is the ONLY reason I normally need to have
Classic running these days.
Here is a copy of the script by the way … (below).
Any help would be appreciated. Thanks.
PS - The script also makes calls to a “Progress Bar” app, which runs under
classic, I dont know if that too would be a problem.
(*
Set pDatabaseFile to the full path of a copy of the FMPro database to have have that
database automatically opened before exporting the messages.
If it is set to “”, then the script will export the messages to the archive currently open
in FileMaker.
You can save multiple copies of the script with different databases defined if you want to use
multiple databases with scripts for each database.
*)
property pDatabaseFile : “”
(*
Set pExpandFolderName to true if you want it to expand folder names to include the path, such
as “Folder->SubFolder”
*)
property pExpandFolders : false
– Status icons
property pStatusRead : " " – space
property pStatusUntouched : “*” – asterisk
on run
set everythingOkay to true
-- make sure filemaker is running and the database is open
try
tell application "FileMaker Pro"
if the name of field 1 of layout 0 is not "Subject" then
display dialog "You must open the email database before running this script" buttons {"Okay"}
set everythingOkay to false
end if
end tell
on error
display dialog "You must open the email database before running this script" buttons {"Okay"}
set everythingOkay to false
end try
-- Check for Tanaka's OSAX
-- try
-- this will fail if Tanaka's OSAX isn't installed
-- «event XUVJdtlt»
-- on error
-- set theReply to display dialog "Tanaka's OSAX needs to be installed."
-- set everythingOkay to false
-- end try
-- Check for GTQ - Date String For OSAX and Time String For
try
-- this will fail if Date String For isn't installed
«event gtqpdtst» (current date)
«event gtqptmst» (current date)
on error
set theReply to display dialog "The date string for and time string for OSAX need to be installed."
set everythingOkay to false
end try
if everythingOkay then
-- Open the database, if necessary
if length of pDatabaseFile is greater than 0 then
try
tell application "FileMaker Pro"
open file pDatabaseFile
end tell
on error
display dialog "Could not open the database specified in the script"
end try
end if
-- Export the messages
tell application "Microsoft Entourage"
set windowClass to the class of the front window
-- see if a message window is front most
if windowClass is message window then
my TransferMessage(displayed message of the front window)
else
-- act on selection
set msgList to selection of the front window
set messageCount to count of msgList
set messageNum to 1
tell application "Progress Bar"
activate
make new window with properties {Name:"Progress"}
set caption of the first progress bar of the front window to "Messages Imported:"
set minimum value of the first progress bar of the front window to 0
set maximum value of the first progress bar of the front window to messageCount
set current value of the first progress bar of the front window to 0
set subcaption of the first progress bar of the front window to 0
end tell
repeat with theMsg in msgList
my TransferMessage(theMsg)
-- 3.1 ignore errors here
try
tell application "Progress Bar"
set current value of the first progress bar of the front window to messageNum
set subcaption of the first progress bar of the front window to messageNum
end tell
end try
set messageNum to messageNum + 1
end repeat
tell application "Progress Bar" to quit
end if
end tell
end if
end run
– converts date to {mm/dd/yyyy, h:mm:ss}
on ConvertDate(dateRec)
set {theYear, theMonth, theDay, theHour, theMinute, theSecond, dayOfWeek} to «event XUVJdtdl» dateRec
–set theTime to (theHour as string) & “:” & my Pad(theMinute) & “:” & my Pad(theSecond)
– 3.1 handle international time formats
set theTime to «event gtqptmst» dateRec
set theDate to «event gtqpdtst» dateRec given «class frmT»:«constant frmTshFM»
return {theDate, theTime}
end ConvertDate
on TransferMessage(theMsg)
set oldDelimiters to AppleScript’s text item delimiters
try
tell application "Microsoft Entourage"
set messageFolder to storage of theMsg
if (pExpandFolders) then
set messageFolder to my ExpandName(messageFolder)
else
set messageFolder to the name of messageFolder
end if
set messageSubject to subject of theMsg
set messageBody to content of theMsg
set messagePriority to priority of theMsg
if messagePriority is lowest then
set messagePriority to "low"
else if messagePriority is normal then
set messagePriority to "normal"
else
set messagePriority to "high"
end if
set sentDateInfo to time sent of theMsg
set {sentDate, sentTime} to my ConvertDate(sentDateInfo)
-- OE doesn't have received date
set receivedDate to ""
set receivedTime to ""
-- enclosures
set enclosureList to ""
-- this part was disabled but I enabled it
try
set attachmentCount to count attachments of theMsg
repeat with i from 1 to attachmentCount
set enclosureList to enclosureList & (get the name of attachment i of theMsg) & return
end repeat
end try
-- this part was disabled but I enabled it
try
set messageAccount to (name of account of theMsg) as string
on error
set messageAccount to ""
end try
if class of theMsg is incoming message then
set senderAddress to sender of theMsg
set messageSender to (display name of senderAddress)
if messageSender is not "" then
set messageSender to messageSender & ", "
end if
set messageSender to messageSender & address of senderAddress
set readStatus to the read status of theMsg
if readStatus is «constant Erdsunst» then
set messageStatus to pStatusUntouched
else
set messageStatus to pStatusRead -- don't worry about "opened" or "in trash" states
end if
else
set messageSender to "me"
set messageStatus to ""
end if
-- recipients
set toRecipients to ""
set ccRecipients to ""
set recipientList to (recipients of theMsg) as list
repeat with theRecipient in recipientList
set theAddress to address of theRecipient
if recipient type of theRecipient is to recipient then
set displayName to display name of theAddress
if displayName is not "" then
set toRecipients to toRecipients & displayName & ", "
end if
set toRecipients to toRecipients & address of theAddress & return
else
set displayName to display name of theAddress
if displayName is not "" then
set ccRecipients to ccRecipients & displayName & ", "
end if
set ccRecipients to ccRecipients & address of theAddress & return
end if
end repeat
end tell
on error errString
display dialog "Couldn't get information about the message because " & errString
end try
tell application "FileMaker Pro"
with timeout of 5000 seconds
-- thanks to André Radke <radke@uni-bonn.de>
-- a compatible way of doing this fast!
try
create new record at the end of layout 0 of database 1 with data ¬
{messageSubject, messageSender, toRecipients, ccRecipients, enclosureList, ¬
messageBody, messageFolder, sentDate, sentTime, receivedDate, receivedTime, ¬
"", "", messagePriority, messageAccount, messageStatus}
(*
set newRec to create new record
set cell "Folder" of newRec to messageFolder
set cell "Subject" of newRec to messageSubject
set cell "Sent date" of newRec to sentDate
set cell "Sent time" of newRec to sentTime
set cell "Received date" of newRec to receivedDate
set cell "Received time" of newRec to receivedTime
set cell "From" of newRec to messageSender
set cell "To" of newRec to toRecipients
set cell "CC" of newRec to ccRecipients
set cell "Enclosure" of newRec to enclosureList
set cell "Message" of newRec to messageBody
set cell "Priority" of newRec to messagePriority
set cell "Account" of newRec to messageAccount
set cell "Status" of newRec to messageStatus
*)
on error errString
display dialog "Could not set data in FMPro because " & errString
end try
end timeout
end tell
set AppleScript's text item delimiters to oldDelimiters
end TransferMessage
on ExpandName(theFolder)
if class of parent of theFolder is application then
return (name of theFolder)
else
return (my ExpandName(get parent of theFolder)) & “->” & (name of theFolder)
end if
end ExpandName