Title: Re: Create a message with accents by AppleScript
Take a look at the script segment below; it shows how a new message is constructed using the usual fields, along with the address.
There is a lot of code in it you do not need, but I think you will find enough here to help you complete your script:
on replyOne(theMessage, theSelectedText)
tell application "Microsoft Entourage"
set theText to my replyText(theSelectedText)
set theSubject to my getHeader(theSelectedText, "Subject:")
if theSubject does not start with "Re: " then set theSubject to "re: " & theSubject
set theAuthor to my getHeader(theSelectedText, "From:")
if the length of theAuthor is not 0 then
set theRecipient to theAuthor
else
set theRecipient to my makeRecipient(theMessage)
if theRecipient is "" then
set theAddress to the sender of theMessage
set theAddressString to the address of theAddress
set theName to the display name of theAddress
if theName is "" then
set theRecipient to theAddressString
else
set theRecipient to "\"" & theName & "\" <" & theAddressString & ">"
end if
end if
end if
set theDate to my getHeader(theSelectedText, "Date:")
set theAttribution to ""
if the length of theDate = 0 then
if the length of theAuthor ? 0 then
-- From: but no Date:
set theAttribution to (theAuthor & " wrote:" & return)
else
-- neither From: nor Date:
set theAttribition to ""
end if
else
if the length of theAuthor = 0 then
-- Date: but no From:
set theAttribution to ("On " & theDate & ", " & " someone wrote:" & return)
else
-- Date: and From:
set theAttribution to ("On " & theDate & ", " & theAuthor & " wrote:" & return)
end if
end if
set theText to theAttribution & return & theText
-- set the replied to of theMessage to true
try
set theAccount to the account of theMessage
if default signature type of theAccount is not none then
make new draft window with properties ¬
{subject:theSubject, content:theText, to recipients:theRecipient, account:theAccount, other signature choice:default signature choice of theAccount}
else
make new draft window with properties ¬
{subject:theSubject, content:theText, to recipients:theRecipient, account:theAccount}
end if
on error
if default signature type of theAccount is not none then
make new draft window with properties ¬
{subject:theSubject, content:theText, to recipients:theRecipient, other signature choice:default signature choice of theAccount}
else
make new draft window with properties ¬
{subject:theSubject, content:theText, to recipients:theRecipient}
end if
end try
end tell
end replyOne
On or near 8/11/01 1:22 PM, Antoine Pérus at [EMAIL PROTECTED] observed:
> Thank you very much for responding, Allen. Your example gives a right
> accented message indeed. But now I have to rewrite the script because using
> “content” rather “source” builds no longer the header. And my first trial
> was unsuccessful : I don’t know AS and I have to found in an example how to
> manage structures as date or address.
>
> Antoine.
>
- Create a message with accents by AppleScript Antoine P�rus
- Re: Create a message with accents by AppleScript Dan Crevier
- Re: Create a message with accents by AppleScript Antoine P�rus
- Re: Create a message with accents by AppleScript Allen Watson
- Allen Watson
