Last updated: Sat, Mar 15, 2003 6:03:37 pm

Contents

Valid XHTML 1.0!

Scripting Eudora


Eudora has been Apple Event aware (scriptable) since about 1995 and was one of the first scriptable applications. In 1997 the first Scripts menu was written, and the arrival of the toolbar in Eudora 3.1 made Eudora the application that provides the very best interface to Apple Events. Unfortunately Eudora doesn't come out of the box configured most conveniently for running scripts, so let's first of all configure Eudora so as to take all the pain out of running scripts.

Where to put your scripts (Under Construction)

For the Scripts menu to appear in the menu bar in Eudora and to use scripts in Eudora you need to have or to create a folder named “Scripts” in a valid location.  In order of precedence, valid locations are as follows:

1. Disk/User/Documents/Eudora Folder/Eudora Items/Scripts
2. Disk/Library/Application Support/Eudora/Scripts
3. Disk/User/Library/Application Support/Eudora/Scripts
4. Disk/Applications/Eudora Application Folder/Eudora.app/Contents/MacOS/Eudora Stuff/Scripts

Eudora will look for scripts in the above locations in order and, having found a Scripts folder, will look no further, so the best place to create the folder is in one of the first two locations.  If you use location 1, the scripts will be available only to you, and if you use location 2, the scripts will be accessible to any user, provided he has not created his own personal Scripts folder in Eudora Items.

Where things are kept

Eudora looks for scripts in the folder "Eudora Stuff", which is accessible enough in the old OS, but well hidden and hard to work with in OS 10. In a moment I will suggest how to remedy this, but first let's look at the default set-up.

The picture on the left below shows the location of the Scripts folder within the package hierarchy of Eudora.app (which you can examine by right-clicking or control-clicking on Eudora's icon in the Applications directory (‘/Applications/Eudora Application Folder/Eudora.app’). Each time you launch Eudora, the Scripts folder is scanned for existing and added compiled scripts and these will appear in the Scripts menu as shown in the right hand picture below.  Now Eudora’s Scripts menu is not of the most modern; it is neither hierarchical nor self-updating. You will not find this an inconvenience at all if you follow the instructions below, since the Scripts menu will be used as a fall-back resource rather than the main means of running scripts.

Before we move on to deal with the toolbar, let's move our scripts to a more appropriate location, namely the directory ~/Library/Scripts/Applications/, that is a folder named “Applications” (which you will probably have to create) in the Library in your user directory. Drag the whole Scripts folder out of “Eudora Stuff” into “~/Library/Scripts/Applications/” and rename it "Eudora". Next make an alias to "Eudora Scripts", drag it into "Eudora Stuff" and rename it "Scripts". Now Eudora won't know the difference, and it will be far easier to save and organize your Eudora scripts.

A simple script to start with

Now we'll write a simple script in Script Editor and save it for Eudora. Launch Script Editor and paste the script below into the new window. Click the run button and see what it does. Now save this script as "What's my name?" in the Eudora Scripts folder you created just now. When you have done this, quit Eudora and relaunch. If you now look in your Scripts menu, you will see the newly created script and be able to run it from within Eudora. You will notice that this time you get a pretty icon that didn't appear when you ran the script in Script Editor. What you will not notice with this very simple script is the difference in speed, but in fact the script ran about four times faster when called from Eudora.


tell application "Eudora"
  set varName to get setting 77
  tell me to display dialog "
Your name is " & varName with icon 1001 buttons "Oh" default button 1
end tell

Configuring the toolbar

We next need to change the toolbar from a useless picture gallery into a practical tool for running regular tasks, including scripts. How you do this is up to you, but I think you'll probably settle in the end for something very much like the configuration shown below. This presents a column of narrow buttons displaying the name of the action and a small icon to show the type of action. To the right of the first 15 buttons is shown the corresponding function key that can (if you so choose) be used to trigger the action. You will see that the top of my toolbar has buttons for a variety of actions, but since we are concerned here only with scripts, I will talk here only of the script buttons.

To configure the toolbar fully using the Settings panel, you need to have "Esoteric Settings n.n" in the Plugins folder. Click in the link to open the folder and see if it's there. If not, click here to see if it's in "Extra Plugins". If all fails, download it here, put it in /Applications/ Eudora.app/ Contents/ MacOS/ Plugins and relaunch Eudora. Then open your settings panel and look for the dornerish item "Toolbar on Steroids (sic)". One thing you cant do in the panel is choose whether to have the window floating or not. To do that you can run this script:

tell application "Eudora"
  set s to "n"
  set p to "The toolbar is not currently floating"
  set s to setting 292
  if s is "y" then
    set p to "The toolbar is currently floating"
  end if
  tell me to set dd to display dialog return & ¬
    p & "." buttons {"Cancel", "Float", "Don't float"}
  if button returned of dd is "Float" then
    set setting 292 to "y"
  else
    set setting 292 to "n"
  end if
  set setting 129 to "n"
  set setting 129 to "y"
end tell