Qualcomm's Eudora emailer app is nicely scriptable.
Eudora is one of the leading email software products for the Macintosh. It was also one of the first scriptable Macintosh apps, and its level of scripting support has continued to evolve through the years.
In Frontier, there are two supported approaches to scripting Eudora:
- A traditional Frontier approach where each task has its own specific verb.
- A method that uses the object model to specifiy Eudora elements and their properties.
Which scripting approach you take will depend on your own preferences, and the tasks you want to accomplish.
In general using the Frontier-style verbs is more straightforward approach, while the object model approach is more flexible.
Whatever approach you use, you should be familiar with the elements of Eudora. If you are a Eudora user these will be obvious.
- You can work with mailboxes and messages.
- You can get or set the various parts of messages.
- You can create or move messages.
Scripting with Frontier verbs
Each task you might perform has its own verb. Most of these verbs work with a messageObject. Generally the message you are working with is the current message or a newly created outgoing message. In most cases you don't reference the message object directly but aquire a reference to it with one of the following
local (myMsg)
myMsg = Eudora.getCurrentMessageObject ()
myMsg = Eudora.createMessage ()
You might also look at Eudora.examples.boxLoop for a way to loop over all messages in a mailbox.
You then pass myMsg to the series of Eudora.xxx verbs such as:
Eudora.getMessageSubject (myMsg)
Eudora.setMessageSubject (myMsg, "Test subject")
If all you want to do is quickly create a new outgoing message you can use this syntax:
newOutgoingMessage (recipient, returnaddress, subject, text)
Scripting with the Object Model
When you use the object model you use fewer verbs that work with the objects and properties supported by Eudora. The object model style of scripting is a style that is supported by many applications that share a set of basic objects and verbs in addition to their own unique features.
If you are completely unfamiliar with using the object model from Frontier you should first read "Frontier & The Object Model".
As with any application that supports the object model the first thing you should check out is its Object Hierarchy. You can find this at Eudora.objectHierarchy which is an outline showing the relationships of objects and their properties.
When you script Eudora with the object model, you should always include Eudora script code within a line:
with objectModel, Eudora, eventInfo
This gives the enclosed lines of code access to:
- Standard object terms like "Window", "all" etc
- The Eudora verbs
- Eudora terminology like mailbox, and message
For Eudora you generally want to create references to mailboxes or messages:
mailfolder [""].mailbox ["In"].message [3] == the third message in the inbox
mailfolder [""].mailbox ["In"].message [3].subject == the subject of that message
mailfolder [""].mailbox ["In"] == the inbox
message [""] == the current message
When you have a reference to an object you can then use verbs to act on that object. These include standard verbs like:
- get
- set
- count
- exists
- make
You can also use the objectModel strategy of working within a certain object level
with mailfolder [""].mailbox ["In"]
local (mySubject)
mySubject = get (message [3].subject)
Notes
The inclusion of mailfolder [""] in object references is not required with version 3 of Eudora, the Inbox can be refered to as mailbox ["In"] alone.
However if you plan to distribute your scripts to users of other versions you should still include it in your references.
The sender and date properties differ from what is returned from the equivalent Frontier verbs. The Frontier verbs return the From and date fields of the message, while Eudora defines those properties as what appears for that message in the index, or TOC, view for that mailbox.
Certain objects are only supported in Eudora Pro 3, these include windows, filters, nicknames and several properties of common objects.
In Eudora 3 the setting of the subject property seems to be broken, set the field or use the Frontier verb.
You can get or set a great number of Eudora settings. Some of these are thing that are accesible through the Settings window in Eudora while others are only available to scripts. Look at Eudora.objectHierarchy for a listing of settings. These were the settings available in version 2.X of Eudora - there might be slight differences for other versions, experimentation may be needed.
Special notification events
Eudora can send special notification events to Frontier when mail arrives or is sent. Special support for this is included in Frontier 4.1, thru the new mail suite.
Check out the "Mail Agent Protocol" page in UserLand's MIDAS website for details.
Pointers
"Frontier & The Object Model" -- a discussion on Frontier's support for the Apple Event object model.
Qualcomm's Eudora page - http://www.eudora.com/.
Mail2FM -- Eudora email flowing into a FileMaker database.
© Copyright 1996-98 UserLand Software. This page was last built on 5/9/98; 8:29:18 AM.
It was originally posted on 10/2/96; 11:12:37 AM.