On 12/11/04 4:22 AM, Scott Haneda deftly typed out:
> When I drop a file or a set of files on the droplet, I would like it to
> simply open a new email message to a specific person, it need not send it,
> as I will more than likely want to type something in. However, I do want it
> to have a cosmetic email address in the format of:
> First last <[EMAIL PROTECTED]>
Ha! I get to take a crack at it before one of the scripting experts replies! :-)
This should do what you want:
property theRecipient : "John Doe <[EMAIL PROTECTED]>"
on run
tell application "Finder"
set theItems to choose file with prompt "Select file to attach:" without invisibles
my createMessage(theItems)
end tell
end run
on open theItems
tell application "Finder"
my createMessage(theItems)
end tell
end open
on createMessage(theItems)
tell application "Microsoft Entourage"
activate
make new draft window with properties {attachment:theItems, to recipients:theRecipient}
end tell
end createMessage
It works, but includes some unnecessary commands. The Finder should not be called at all. 'choose file' is a scripting addition that does not need the Finder. 'on open' takes a list, so you should put the result of 'choose file' into list braces ( a coercion is helping you here). 'on open' most definitely does not need the Finder.
Properly speaking, when making attachments you're supposed to set each one's 'file' property. I notice that there's a coercion operating which lets you just use the 'alias' form of a file in a list without specifying it as the file property for attachment. I wonder if that's always been in place - it sure makes things simpler. Using that coercion again, here it is without the Finder:
property theRecipient : "John Doe <[EMAIL PROTECTED]>"
on run
set theItem to choose file with prompt "Select a file to attach:" without invisibles
my createMessage({theItem})
end run
on open theItems
my createMessage(theItems)
end open
on createMessage(theItems)
tell application "Microsoft Entourage"
activate
make new draft window with properties {attachment:theItems, to recipients:theRecipient}
end tell
end createMessage
--
Paul Berkowitz
MVP MacOffice
Entourage FAQ Page: <http://www.entourage.mvps.org/faq/index.html>
AppleScripts for Entourage: <http://macscripter.net/scriptbuilders/>
PLEASE always state which version of Microsoft Office you are using - **2004**, X or 2001. It's often impossible to answer your questions otherwise.
