(Sorry for the HTML...but wanted to keep the script as intact as possible)Scripting Entourage is very different from scripting Mail. (Actually scripting Mail is very, very different from anything else on the planet. Apple completely ignored their own Mail suite, which Entourage follows. It looks as if some Next programmers tried to learn AppleScript in a few days with limited success.)
Apple just released some Applescripts to allow emailing a picture direct from iPhoto (make new message, attach picture, etc.) Unfortunately, the Applescript is written for Mail. I use both Entourage X and Entourage 2001 (for PGP stuff). Is there an intrepid AppleScripter out there who could rewrite the script for either or both?
The only part of the script that specifically calls the Mail client is the very end. Here it is. (it does reference some variables earlier.) If you want the full script, you can download it from http://www.apple.com/applescript/iphoto/
Thanks for any help.
>From the look of it, Mail can insert graphics inline in a message wherever you ask it to. That may be partly because you can script formatted text (RTF) in it, or maybe for some other reason. Although Entourage X can do this in HTML in the User interface, I don't think it can be scripted as part of the message content. I will try later. It's an excellent feature request. i think it will be the same as in Entourage 2001, where the photo can be sent as an attachment, and will show up in the email too, but at the end. Is that good enough? If so this should do it:
tell application "Microsoft Entourage"
activate
set theContent to "Here are some images for you." & return
set the new_message to make new draft window with properties {subject:email_subject, content:theContent, to recipients:default_recipient & " <" & default_address & ">"}
repeat with this_imagefile in the new_files
set this_imagefile to the contents of this_imagefile
make new attachment at new_message with properties {file:this_imagefile}
end repeat
end tell
on error error_message number error_number
if the error_number is not -128 then
tell application "Finder"
activate
beep
display dialog error_message buttons {"Cancel"} default button 1
end tell
end if
end try
end process_list
What this does is open new message window on the screen, for you to write more stuff in the message , then send it. If you want it to be sent automatically, then adjust the message content to waht you want, and use this instead:
tell application "Microsoft Entourage"
set theContent to "Here are some images for you." & return -- or whatever
set the new_message to make new outgoing message with properties {subject:email_subject, content:theContent, recipient:{address:{address:default_address, display name:default_recipient}, recipient type:to recipient}}
repeat with this_imagefile in the new_files
set this_imagefile to the contents of this_imagefile
make new attachment at new_message with properties {file:this_imagefile}
end repeat
send the new_message
end tell
on error error_message number error_number
if the error_number is not -128 then
tell application "Finder"
activate
beep
display dialog error_message buttons {"Cancel"} default button 1
end tell
end if
end try
end process_list
--
Paul Berkowitz
