I have a piece of applescript that creates a new mail message and then loads a template into that message.
So far so good.
I want to get the content ( body text ) after the template being loaded. How can I get the body content after loading the template? Reason is, I need to replace some text ("/date/") with a date.
The body could be HTML or just plain text.
I know how to get the content when an existing mail is selected, so it is questioned really only about this case.
BTW, a secondary question. Now I use button click to load the template, but is there a better way, for example load the template directly by name?
Thank you very much
edit addition
I'am a step further. It is solved for this problem.
First I did make a new email using
tell application mail
-- make email and visible
-- then for using the keystrokes and gui to get the template
tell application system events
tell process mail
-- tell window to get template - works fine
-- SEE NOTE 1
set _content to content of myMessage -- it doesn't work, message ID is there
set the _content to (get the value of the last scroll area) -- it doesn't work
-- IN HERE I CANT'T get the content of the message, should be with the ui?
-- if someone knows, please
end tell
end tell
-- now I have to Activate the mail app. I didn't know
activate --
set _content to content of myMessage -- works
set the clipboard to _content as string -- works almost
-- SEE NOTE2
Note 1 In here I can't get the content of the message, should be with the ui? if someone knows, please
Note 2 If I paste the clipboard, the text has a different font. How can I get the right type of font in my clipboard?
Still searching for a better way for getting the template.