Title: Re: Automatic Attachments to email messages
On 11/2/06 23:58, "John Chavez" <[EMAIL PROTECTED]> wrote:

> Hi folks,
>
> I was wondering if there was a script available to
> have attachments automatically applied to
> a stationary signature.
>
> I use signatures with boiler plate copy, different
> for clients. I would like to have a signature
> automatically attached commonly used files
> to various signatures. It would say me about
> two hours per year. Actually, I really don't
> now how many minutes or hours it would save me
> but it sure would be nice.
>
> Looking forward to all your advice,
>
> John Chavez
> Los Angeles, CA
>
>

The script below will do this - save the script as a complied script in the Entourage Script Menu Items folder. Set the first line to contain the names of the signatures you want to attach files for.

Then, set up a schedule (tools menu, 'schedules' and click on the new button) to run this script every minute.

The script will first check whether there is a draft message open. If there isn't the script terminates immediately.

If there is, the script then checks the name of the sig of the draft window, if it doesn't match one in your list then the script terminates.

It will then attach the file of your choice (asking which file, if this is the first time it has encountered this sig) IF there is not already an attachment to the message window. I could re-write the script so it would check the names of the existing attachments first, but this would slow things down a little - if you are only ever likely to attach the one file to one of these messages, or if you are willing to handle the exceptions manually, this will do for you.

Let me know if this does what you want :)

-- Attach File by Sig v1.0 (12th Feb 2006)
-- (c) Barry Wainwright <mailto:[EMAIL PROTECTED]>
-- This script is provided free for personal use, and may be redistributed provided
--  no charge is made and this copyright notice is included when redistributed.

property sigList : {"Sig name 1", "sig name 2", "etc"}
property attachmentList : {}

-- set up
if (count attachmentList) ≠ (count sigList) then
    set sigList to {}
    repeat (count sigList) times
        copy missing value to end of attachmentList
    end repeat
end if


tell application "Microsoft Entourage"
    if class of window 1 is not draft window then return -- no draft window open
    set currentSigName to name of other signature choice of window 1
    if currentSigName is in sigList then
        -- found a matching signature, find out which one
        set theAttachment to ""
        repeat with x from 1 to (count sigList)
            if item x of sigList = currentSigName then
                set theAttachment to item x of attachmentList
                exit repeat
            end if
        end repeat
        if theAttachment is missing value then
            -- no attachment assigned to this sig yet
            set theAttachment to choose file with prompt "Please select a file to attach to all messages with the signature " & currentSigName & ":" without invisibles
            set item x of attachmentList to theAttachment
        end if
        if (count attachments of window 1) = 0 then make new attachment at end of window 1 with properties {file:theAttachment}
    end if
end tell




--
Barry Wainwright
Microsoft MVP (see http://mvp.support.microsoft.com for details)
Check out the Entourage User's WebLog for hints, tips and troubleshooting
<http://homepage.mac.com/barryw/weblog/weblog.html>

Reply via email to