open a new Mail document

Hi and good day,

Similarly if I just want to open a new Mail document, I cannot just write:


tell application "Mail"
	make new document
	activate -- go to the foreground
end tell

And if I knew where in the Mail library to find it?

/
with best regards,
Omar KN
Stockholm, Sweden

(Bättre väder idag ca. 14°C soligt, det blommar i träden!)

Hi,

what do you mean with “document”, a new message


tell application "Mail"
	make new outgoing message with properties {visible:true, subject:"Hi there"}
end tell

or a message viewer like the main window of Mail.app

tell application "Mail"
	make new message viewer
end tell

Hi and good day Stafan,

The first one! Thank you, but I save the 2nd too, just in case.

Any idea how to expand the AScript so that the curser will be in the body field of Mail.

(For pasting in some {upcoming} text with KMaestro).

/
with best regards,
Omar KN
Stockholm, Sweden

the easiest way is to know the text before creating the message and set the property content of the message

Thank you, but un this case the text will vary from time to time.

Probably better to do this with KMaestro.

/
with best regards,
Omar KN
Stockholm, Sweden

you can tell Keyboard Maestro to run the script to create the message and pass the text by a variable