apple.mail notes (hopefully simple question)

so, i’d like to take the subject of a note (in mail) and insert it at the beginnng of the note’s contents. this is what i have so far. but no matter what i try i can’t seem to figure out the missing line that’ll save myContent into the contents of thisMessage. Tried set, set to the, etc… Please please help. Super newbie at Applescript. Thanks a million…

		set theMessages to selection
		repeat with thisMessage in theMessages
			set myTitle to the subject of thisMessage
			set myContent to the content of thisMessage as text
                            set myContent to myTitle & return & myContent

end repeat


Does this not work:

set content of thisMessage to myContent

John M

That’s what I imagined, but no. Gives a cannot set error. I think mail notes are a breed of their own and I think one who’s specifically written a script for notes within mail will know the elusive secret. Thanks for the suggestion though.

My mistake, The content of Mail messages are read only (indicated by r/o in Mail’s dictionary). How about creating a new note and deleting the old one?

Ah… didn’t realize they’re read only. Not sure on the syntax yet how to create a new one and delete the other but I’ll look into it. Thanks, that’s already very helpful.

so i try…

set newMessage to make new message with properties {subject:newTitle, content:newContent, mailbox:“Notes”}

and get a ‘can’t make or move that element into that container’ error! wow, someone please help :slight_smile:


The mail in Snow Leopard is obviously different?

Because what you wish is exactly what I get in a note in Mail in Snow Leopard.
When I open a note, the subject is on the first line.

I didn’t believe that you could script the notes, but I turned out to work pretty well in Snow Leopard I only read, a message, didnt write to any property.

Best Regards



I think, this is not possible.
All properties of incoming mails (messages) are read only.
You can not create a simple message with the make command.
Only outgoing message responds to make, but these messages are supposed to be sent.

Wow. Thanks for everyone’s input. Apple is killing me.


It is possible to make a new message, although it’s a bit of a hack. but I get used to that with Mail.

This is an example. You may want to do some checking of the account the email is saved to, so you get the correct 'Drafts" folder (which are dependants of accounts, as opposed to the "Notes folder which is ‘top level’.). It also does not make a note, but a message.

tell application "Mail"
	-- Make your message.
	set mymail to (make new outgoing message at the beginning of outgoing messages with properties {subject:"Save Notes test message", content:"Your Note is here.... at last!"})
	-- Save it to your "Drafts" folder.
	save mymail
	-- Bring Mail to the front.
	-- Wait a bit, otherwise you get the wrong message.
	delay 0.1
	-- Move the message from the "Drafts" folder to your "Notes" folder. As I say you may need to do some checking for the right account.
	move (message 1 of (mailbox "Drafts" of account 1)) to (mailbox "Notes")
	-- Show Notes mailbox, as this doesn't seem to be possible using Mail's dictionary.
	tell application "System Events" to keystroke "7" using command down
end tell

Given the number of workarounds and the fact this doesn’t actually make a note I’d say Mail’s Applescript support for Notes is pretty minimal, if non existant.

Best wishes

John M