Outlook Quick Notes with HTA, Javascript and Autohotkey: Ginko

Originally published: 02/2006 by J Wynia


I'm in the middle of a serious flow of things needing to be managed. Lots of little tasks, ideas and bits are floating past. My need for organizing files, emails, tasks, calendars, etc. tends to come and go.

And, it's clearly the beginning of a period where I need to ramp up my processes to handle the increased load. Hence the current rash of Outlook-related posts and tools. I tend to deal with extra work by doing it once myself and then writing tools to do the work for me dozens of times after that. As such, if you like this kind of thing, you'll probably be happy with what I write up the next few weeks. If not, well, I guess it's your turn to be the "some of the people" I can't please all of the time.

So, what's this one do?

It helps me take notes quickly without dropping what I'm currently doing. I hit Win+N (Win is the Windows key) and I get a popup like the screenshot to the right. I type in my quick note and hit save. The note is then stored in a designated folder inside Outlook.

Overall, this helps me remember things and capture the tangents that I go on while working on other tasks. Prime example is the fact that midway through that last sentence, I remembered that I had planned to order new sunglasses. 20 seconds later, that thought was captured in Outlook and I was back to writing here.

The notes are stored as "posts" in Outlook, which are essentially emails to yourself without the network (send and receive). Once in that folder, they can easiliy be dragged into tasks or calendar items from there.

I call it Ginko as it's how I remember stuff (Ginko Biloba as memory herb). You can download the whole works, but the interesting bits are below as well.

It's implemented as an HTA file for the window/form itself. Since HTA files are just HTML, the appearance is all HTML/CSS, that's all pretty straightforward. The HTA is either just invoked directly (would require navigating to it every time) or a quick Autohotkey script could make this thing available at a keystroke.

The Autohotkey script has only 1 line:

#n::Run, ginko.hta

The "#n" stands for the Window key with "N", the rest pretty self explanatory.

Then, in ginko.hta, the interesting bit (creating the post in Outlook) is done with this Javascript function. It's pretty well commented, so it should make sense.



function createnote(){
//Instantiate Outlook
$outlook = new ActiveXObject("Outlook.Application");
//Get the namespace
$namespace = $outlook.GetNamespace("MAPI");
//Set the output folder - MODIFY THIS FOR YOUR SETUP
$folder = $namespace.Folders("Personal Folders").Folders("Ginko");

//Post items are defined as 6
$postitem = 6;
//Create the item
$post = $outlook.CreateItem($postitem);
//Set the destination folder for the item
$post = $folder.Items.Add($postitem);
//Set the subject
$post.Subject = document.forms.noteform.subject.value;
//Set the actual body of the post. Because we're using HTML, we carry that over
$post.HTMLBody = document.getElementById('note').innerHTML;
//Save the item
$post.Post();
//Mark it as "new". Has to happen after it's saved or there's "nothing" to mark unread.
$post.UnRead = true;

//close the note window
window.close();
}

Comments

Robert C. on 11/23/2006
This is really cool, thanks. I don't do much programming (except for numerical and statistical analysis), but I finally got fed up from not finding a good email organizer (after trying both OMEA and NEO). So I'm learning AutoHotKey in order to customize Outlook better. In particular I'm trying to make HotKeys to assign categories and even switch to different filtered views (let me know if you know anywhere else I should be looking for help in doing this...).
Rishabh Jivan on 12/5/2006
Do you know a good web site where I can get a specification of the Outlook.Application object's API? i'm trying to write a javascript code for creating an email message from my jsp page, populating the email with html content and then opening it as a new outlook message sot hat the user can edit the email before sending it off. any tips on doign this would be appreciated. thanks.
J Wynia on 12/13/2006
You can get the whole object model from the MSDN.
Pat on 1/2/2007
works great, except the body of the note doesn't get sent to email. i put an alert just before the Post(), to see if it's there, but when the note gets posted, it's blank in Outlook!
skooter1121 on 1/25/2007
Great app. Love it that it doesn't need OL running. 1. Works with OL 2007? 2. Can't seem to get it to post to "Notes." Goes to "Inbox" if I set it to "Notes." I'd preder it to go to "Notes" as a note because ActiveSync will only Sync (to my PDA) from the 'Notes" folder. ThanX
John Kwan on 4/11/2007
Can ginko loader monitor multiple hot keys? If I want to use Win N to do not and Win T to do something else?
blog comments powered by Disqus
Or, browse the archives.
© 2003- 2013 J Wynia. Very Few Rights Reserved. This article is licensed under the terms of the Creative Commons Attribution License. Quoted content or content included from others is not subject to that license and defaults to normal copyright.