On 3/16/05 7:56 AM, "Russell" <[EMAIL PROTECTED]> wrote:
> I have a script that automatically creates a subject for a message based on
> the attachment's file name
>
> I'm trying to add it to a a droplet that will also create a new message with
> certain recipients. My problem is now the code (that creates the subject)
> doesn't seem to work. I'm wondering if Entourage needs a delay before I ask
> it to grab the attachment's file name.
>
> Here's the code: (the attachment/subject part of the script is at the end)
>
> Thanks in advance.
>
> on open ThisItem
> tell application "Microsoft Entourage"
> open ThisItem
> activate
> with timeout of 600 seconds
> set theAccount to default mail account
> --set theSource to source of theMsg
> set newMsg to make new outgoing message at drafts folder with
> properties {account:theAccount} --, source:theSource
> set {window 1's to recipients, window 1's CC recipients} to
> {"[EMAIL PROTECTED]" & "," & "[EMAIL PROTECTED]" & "," &
> "[EMAIL PROTECTED]", "[EMAIL PROTECTED]" & "," & "[EMAIL
> PROTECTED]"}
> end timeout
> end tell
> tell window 1
> try
> set attName to name of attachment
> set subject to my (attName)
> end try
> end tell
> end open
One problem is that you are attempting to set the subject of window 1.
Normally, windows do not have subjects - see the dictionary. IF window is a
message window (window of a saved message) or a draft window (where you're
making a new unsaved message) then you can change the subject of the
displayed message or of the draft window. So if this is a draft window, it
should be possible.
But earlier in the script, you are making a new outgoing message at the
drafts folder, NOT a new draft WINDOW. Nor do you open this new message into
its own window. So where exactly is 'window 1' coming from? Is this some
other open message or draft window?
If you are intending to work manually (later) on the draft window of the
message you're making in drafts folder, maybe you should just make a new
draft window instead? Often it's better to do everything on an outgoing
message without opening it up into a window at all. Then the syntax is
different. Could you please explain what you're actually trying to do? In
particular, is window 1 supposed to be the outgoing message you just made,
or some other window?
Finally, attachment are (generally) _elements_, not properties, of messages
an draft windows. So you'd need to get the name of, say. attachment 1, not
'attachment'.
--
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.
--
To unsubscribe:
<mailto:[EMAIL PROTECTED]>
archives:
<http://www.mail-archive.com/entourage-talk%40lists.letterrip.com/>
old-archive:
<http://www.mail-archive.com/entourage-talk%40lists.boingo.com/>