Creating/editing notes in Mail.app

7 views
Skip to first unread message

Thomas

unread,
Oct 5, 2009, 6:00:41 PM10/5/09
to Blacktree: Quicksilver
Does anyone know how/if it's possible to create/edit notes in
Mail.app? Either Javascript, QS, or some combo of both. I take a lot
of notes at work, and would love to be able to have them all on my
computer, rather than on pads of paper. Thanks!

Chris Cairns

unread,
Oct 5, 2009, 11:04:23 PM10/5/09
to blacktree-...@googlegroups.com
In applescript it is not possible to create a new note without GUI
scripting. And forget about editing them. Better use text files, since
Quicksilver allows to append text, prepend text, change a particular
line in text file etc


tell application "Mail"
activate
tell application "System Events"
tell process "Mail"
keystroke "n" using command down & control down
end tell
end tell
end tell

Thomas

unread,
Oct 6, 2009, 2:03:13 AM10/6/09
to Blacktree: Quicksilver
In applescript it is not possible to create a new note without GUI
> scripting. And forget about editing them. Better use text files, since
> Quicksilver allows to append text, prepend text, change a particular
> line in text file etc
>
> tell application "Mail"
>     activate
>     tell application "System Events"
>         tell process "Mail"
>             keystroke "n" using command down & control down
>         end tell
>     end tell
> end tell

Using this script saved as an app and a trigger is close enough.
Thanks!

Chris Cairns

unread,
Oct 6, 2009, 2:18:26 AM10/6/09
to blacktree-...@googlegroups.com
don't create an app. That way you have to quit it.
Just save this script as it is and assign it a shortcut by creatin a
trigger like "Sript">>"Run" or run it from Quicksilver's first pane.

awr

unread,
Nov 24, 2009, 2:36:50 AM11/24/09
to Blacktree: Quicksilver
i'm 95% done with my 'convert any mail message to note' script.

i'm not aware of any way to create a note directly 'behind the scenes'
and the hacks described here are not really acceptable for a 'rule'
that would affect incoming mail.

it's actually not the most difficult thing in the world. the 'trick'
was realizing you have to use a file on the hard drive.

if you create a file with the right headers.. it *IS* a 'note'.
creating said file in a 'tmp' directory than opening in mail ('tell
application "finder"). once open, tell application "Mail" to 'move to
folder' (any folder you desire).

my version is going to be a bit more complicated than a 'generate from
scratch' one because i have to parse through 'any random email' and
strip off 'all the wrong' headers leaving just the right ones.

for a simple 'from the clipboard' concept ,that will be MUCH easier.

1) concatenate 'just the right' header info && clipboard -> note.eml
2) open note.eml into mail
3) move note.eml into 'notes' folder
4) delete note.eml from tmp

i have it working for 'text only' emails but want to include html, a
lot more complicated since the a.s. library for mail doesn't seem to
includ 'html content' and 'content' only includes the 'text only'
version so i have to 'make my own' parsing through the raw source.

anyhow it'll likely be working by tonight. once i have the 'tough' one
working (convert any email to note) it will be ludicrously simple to
make a 'convert any selected text anywhere' into a note

oh and by the way; yes of course fully-editable notes just like if you
made a new one yourself; with an interesting caveat:

my way allows ANY subject and ANY 'sender', so i set the sender to
'note 2 self' so they really stand out; the subject will be whatever i
make it not just 'the first line of the note'.

however; if you edit the note, mail.app will re-write the subj/sender
so beware of that.

-awr

awr

unread,
Nov 25, 2009, 4:38:31 AM11/25/09
to Blacktree: Quicksilver
update: 98% done.

the AS will take any email (incoming/outgoing/draft or even another
note), and convert it to a note, stripping off all unneeded headers,
keeping only the useful ones.

it creates a new 'from' header: 'Note 2 Self' so it stands out and the
subject is carried over rather than generated from the first line of
the body.

if the subject is blank or just a reply to a blank (or multiples, i.e.
re: re: re:), then it will set the subject to up to the first 5 words
of the body! (going to convert that block of code to a standalone that
will automatically fix any incoming messages with no subject!)

i've gotten as far as having the note created and open staring me in
the face; Mail is not sending the new message id back to AS for me to
figure out how to file it, that's the last 2% then i'm done.

it got a lot more complicated than i thought it would be so i probably
won't release it as 'code' but will likely release it compiled as an
app.
Reply all
Reply to author
Forward
0 new messages