Re: BBEdit to Entourage
Re: BBEdit to Entourage
- Subject: Re: BBEdit to Entourage
- From: Paul Berkowitz <email@hidden>
- Date: Fri, 26 Sep 2003 13:40:55 -0700
On 9/26/03 1:08 PM, "phildobbin" <email@hidden> wrote:
>
I'm trying to modify a script that sends the text in a BBEdit document to a
>
Entourage X message which was originally created for BBEdit -> Mailsmith
>
(unfortunately I can't remember who authored the script so apologies to
>
whoever wrote it :)
>
>
Unfortunately Entourage sends an error saying it can't make a message window
>
and being the planet's worst scripter I can't figure out the problem. Any
>
help appreciated (this on 10.2.6).
You just need top be a good reader of the Dictionary. In Entourage, a
'message' is a saved (encoded) email message, whether incoming (received) or
outgoing (sent or draft). A 'message window' is the window that appears by
opening one of these saved messages.
What you're looking for here is 'draft window': that's a window of an
editable, usually unsaved new message. (It's OK, it won't error if it
happens to be an opened, saved draft message which you can add to.) And if
you want to make a new draft window, you have to tell it to do that. If you
mean to use an existing draft window already open in the front, it's good to
put that into a try/error block in case you run the script where none
exists. (In fact, maybe create one if there is none?)
There is no term 'enclosure' anywhere in the Entourage Dictionary - you must
have been imagining that one. There is 'attachment' which can be an element,
or a property *, of either a saved message, or, like here, a draft window.
You also don't need 'at the end of' [anything] in Entourage, although it
probably wouldn't hurt.
The 'file' property requires an 'alias' form. If that's how BBEdit refers to
its own 'file' property of window, that will be fine. Otherwise add 'as
alias' in the BBEdit part of the script. (I don't have BBEdit to check.)
(*You can set 'attachment' as a _property_ of a new draft window or outgoing
message at the time of creation, rather than have to add it on later as an
element to an existing draft window or outgoing message. See below.)
You can't set the index of anything. The index is read-only. You can set
your own variable to keep track of things. Or maybe you mean to bring the
window to the very front? That's 'select' in the Standard Suite. ('open'
also works.)
tell application "Microsoft Entourage"
try
set current_message to first draft window
make new attachment at current_message with properties
{file:the_file}
select current_message
on error -- ? or beep, or whatever
set current_message to make new draft window with properties
{attachment:{file:the_file}} -- will make in the front
end try
activate
end tell
>
>
============================================================
>
>
set ret_text to button returned of (display dialog "Attach to new or current
>
message?" buttons {"New", "Current", "Cancel"} default button "New")
>
>
if ret_text is "New" then
>
tell application "BBEdit"
>
set the_file to file of window 1
>
end tell
>
tell application "Microsoft Entourage"
>
make new message window
>
make new enclosure at end of window 1 with properties
>
{file:the_file}
>
activate
>
end tell
>
end if
>
>
if ret_text is "Current" then
>
tell application "BBEdit"
>
set the_file to file of window 1
>
end tell
>
tell application "Microsoft Entourage"
>
set current_message to first message window
>
>
make new enclosures at end of current_message with properties
>
{file:the_file}
>
>
set index of current_message to 1
>
activate
>
end tell
>
end if
--
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.