Re: Help with Entourage & attachments
Re: Help with Entourage & attachments
- Subject: Re: Help with Entourage & attachments
- From: Paul Berkowitz <email@hidden>
- Date: Fri, 23 May 2003 12:08:53 -0700
On 5/22/03 1:21 AM, "julifos" <email@hidden> wrote:
>
> On 5/21/03 1:08 PM, "julifos" <email@hidden> wrote:
>
>
>
>> I would like append an attachment to an existing message. Here is the code:
>
>>
>
>> ########################################
>
>> make new attachment at message id 1000 with properties {file:alias
>
>> "path:to:file", encoding:no encoding}
>
>> ########################################
>
>>
>
>> Successful!
>
>>
>
>> But, then, this will crash Entourage:
>
>>
>
>> ########################################
>
>> properties of attachment 1 of message id 1000
>
>> --> crash!
>
>> ########################################
>
>>
>
>> Any idea on how should I...?
>
>
>
>
I try it in all kind of messages (including draft ones ;-).
>
>
This works:
>
tell attachment 1 of message id 1000
>
name --> "file"
>
file creator --> +class HOLA;
>
file type --> +class HELO;
>
file --> alias "path:to:file"
>
encoding --> stop (?)
>
properties --> crash!!!!
>
end tell
But you forgot one property: try 'content'. That's what's causing the
crashing. 'content' crashes Entourage all on its own. Because the content is
not yet encoded, the script can't get the encoded content in the properties
record. And this is true even if you specify {encoding:AppleDouble}: it
doesn't actually get encoded until the message is sent, so the crash still
occurs. This is not a problem when making a new message by script and
including {attachment:} as one of the properties: it gets encoded right
then. Also, if you re-save a draft message in the UI 'as draft', the message
gets encoded then too, so all is well if you subsequently try to get content
or properties by script. But you can't "resave" a message as draft by script
(although you could if you opened it up as a draft window, added the
attachment to the window, and saved the window). The dictionary says:
content string [r/o] -- the encoded content (if it has been encoded)
There's the problem: 'content' is not defined for a non-encoded attachment
It shouldn't crash, however. It should just error or maybe default to "".
I'll report it as a bug.
--
Paul Berkowitz
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.