Entourage Contextual Plug-in?

T

The Terminator

Is there a freeware/shareware contextual plug-in for Entourage so, for
example, if I wanted to mail something directly from the Finder, I would
just right-click (or cmd-click), and ³Mail...² would be there? I know
Entourage supports Services, but the ³Mail...² option in Services always
brings up Apple Mail.
 
M

Mickey Stevens

Is there a freeware/shareware contextual plug-in for Entourage so, for
example, if I wanted to mail something directly from the Finder, I would just
right-click (or cmd-click), and ³Mail...² would be there?
There are two ways to do what you want:

(Easy, doesn't use contextual menu) Drag the file you want to e-mail
directly onto the Entourage icon. A new mail message will open with the
file attached.

(More difficult to configure, uses contextual menu) Copy this script into
Script Editor (/Applications/AppleScript/Script Editor/):

on run
    tell application "Finder"
        activate
        set fs to {}
        try
            set fs to the selection
        end try
        if kind of (fs as alias) is "folder" then
            display dialog "Do you really want to attach a folder?" buttons
{"Yes", "No"} default button 2
            if button returned of result is "No" then
                set f to choose file with prompt "Select file to be
attached."
                set fs to {}
                copy f to end of fs
            end if
        end if
    end tell
    if fs is {} then
        set f to choose file with prompt "Select file to be attached."
        copy f to end of fs
    end if
    my attachToMessage(fs)
end run

on open (fs)
    if fs is {} then
        set f to choose file with prompt "Select file to be attached."
        copy f to end of fs
    end if
    my attachToMessage(fs)
end open

on attachToMessage(fs)
    tell application "Microsoft Entourage"
        activate
        try
            set c to class of the front window
        on error
            set c to ""
        end try
        if class of the front window is not draft window then
            make new draft window
        end if
        try
            save the front window
            set theMsg to displayed feature of window 1 -- if open in its
own window or the preview pane
            
        on error
            set currMsgs to (current messages) -- if selected in Message
Pane without preview pane
            if (count of currMsgs) = 1 then
                set theMsg to item 1 of currMsgs
            else
                beep
                display dialog "! You can only attach files to open draft
messages." buttons "OK" default button "OK" with icon 0
                return
            end if
        end try
        repeat with anItem in fs
            tell application "Finder" to set f to anItem as text
            try
                make new attachment at theMsg with properties {file:f}
                close the front window -- Do not save it; overwrites one
with attachment!
                open theMsg
            on error theErr
                display dialog theErr
                return
            end try
        end repeat
    end tell
end attachToMessage

Now, save the file as a compiled script onto the Desktop as "E-mail File".
Download and install BigCat (free) <http://www.ranchero.com/bigcat/>. Then,
drag the script you saved into /Users/<Your User>/Library/Application
Support/Big Cat Scripts/Files/. Now you can select a file, Control-click
it, and go to Scripts > E-mail File to e-mail the file using Entourage.
I know Entourage supports Services, but the ³Mail...² option in Services
always brings up Apple Mail.

I know. There's no way to change that, unfortunately.
 
T

The Terminator

Very cool! :)

Thanks Mickey. If only I were proficient enough in AppleScript to get
Entourage to do other neat tricks like that...
 
Top