From Why Americans Should Never Be Allowed To Travel
A woman called to make reservations, "I want to go from Chicago to Hippopotamus, New York" The agent was at a loss for words. Finally, the agent: "Are you sure that's the name of the town?" "Yes, what flights do you have?" replied the customer. After some searching, the agent came back with, "I'm sorry, ma'am, I've looked up every airport code in the country and can't find a Hippopotamus anywhere." The customer retorted, "Oh don't be silly. Everyone knows where it is. Check your map!" The agent scoured a map of the state of New York and finally offered, "You don't mean Buffalo, do you?" "That's it! I knew it was a big animal!"
I've been saying for a few years now someone need to tackle the problem of wireless power.
Well it looks like some physists are finally taking a step in that direction.
I hope something actually comes of this. I don't particularly care if it is their solution; I just want a solution.
Most recently I've worked on an HTML importer for OneNote. Originally, I had plans to build a Firefox extension that would allow right clicking on a web page and selecting a "Send to OneNote" option. After doing some initial research I decided that was going to be more effort than I could spare right now. Instead I compromised and built a tool that would work with both Firefox and IE, but the downside is that it is a two step process.
The code I've written will be easily adaptable to a Firefox extension if I ever get around to that part of the project. I believe the key will be to take the save complete pages code from chrome://browser/content/contentAreaUtils.js in the core of Firefox and adapt it to the needs of the extension.
Note: In order to use this application you will need to copy JPHOneNoteUtilities.dll into C:\Windows\assembly, or ensure the file is in the same directory as OneNoteHTMLImporter.
Let's look at how OneNoteHTMLImporter.cs works.
OneNote has limited support for HTML pages, but it seems to understand some formatting directives from styles sheets. (Does anyone know what the HTML specifications are for OneNote?) My objective was to get all of the content from a web page onto the local computer. This will keep you from being tied to external web sites in order to render the page correctly. It will also give you a local copy of the information in case the page ever goes away. In order to do this, you need to use the "Save Pages As; Web Page, complete" option in your browser. On the top browser menu, Click 'File', and select the "Save Pages As" option.

This will bring up a dialog box, which prompts you for where to save the web page. Once you've selected the location for the files, you need to make sure the "Save as type:" is set to "Web Page, complete". Then just click the save button.

Now you can double the OneNote HTML Importer application. It will present you with a dialog to pick the file you just saved from the browser. Note: You can include a directory path in the shortcut and this will be the default place it looks for files.

In the dialog box you will see the filename that you save, and also a directory. You want to select the .htm or .html file that you saved. You can ignore the directory, this contains all of the additional files (images, style sheets, etc.) that were found in the web page; they will automatically be handled by the HTML importer.
Click the image to the left to see a larger version of an imported web page. You can view the actual page here.
When the HTML Importer runs it will create a directory in OneNote's Default Notebook Location called HTML File Storage. If you aren't sure where this is in OneNote you can go to Tools -> Options -> Save. In this location a unique sub-directory (the name comes from a call to System.Guid.NewGuid()) is created for those files. The files are then moved from their saved location to this one. The main html file is parsed and modified so all of the links point to the files in their new location. It also parses the HTML page for the <title> tag, and uses that as the title for the page. The HTML page is then inserted and embedded into a OneNote page.
The one down side to maintaining the files outside of OneNote is that they are not tied to the OneNote page that is created. So if you delete the page from OneNote the directory with the extra files will stick around.
OneNote takes all of the external information it can use and embeds that into the page. The only reason to maintain an external copy of the information is so that you can render the page in a web browser.
Maybe the thing to do would be to add a checkbox to open dialog box that would allow you to pick whether or not you wanted the page to be accessible outside of OneNote.
This software is distributed on an "AS IS" basis, without warranties or conditions of any kind, either express or implied.
Today I'm going to talk about the general purpose file importer I've built, and how it is used to allow for email importing.
Note: In order to use this application you will need to copy JPHOneNoteUtilities.dll into C:\Windows\assembly, or ensure the file is in the same directory as OneNoteImporter.
Let's look at how OneNoteImporter.cs works. This program looks in the directory specified on the command line for sub-directories. The sub-directories should contain files that are to be included in a OneNote page. A OneNote page will be created for each directory found. The files in this directory can be of any type, but the importer treats certain files differently.
All of the files are embedded into the page along the top. If they exceed a certain width, then they will wrap and form as many rows as is necessary to accommodate all of the files in the directory. The exception to this is image files, which are placed and embedded onto a different part of the page.
Image files (.jpg, .jpeg, .gif, and .png) are embedded and inserted into the page down the right hand side. Height and width tags are used to constrain the images into an area of 240 x 180 or some proportional size there-of. The x-position for the image was chosen based on what is optimal for my UMPC.
Text (.txt) and HTML (.htm & .html) files are also embedded and inserted into the page, but down the left hand side. If images are present then the width of the text container is constrained to prevent overlap. However, if no images are present the width is unconstrained and allowed to use the available page space.
The reason these files are inserted is to allow for searching of the information contained with-in.
Hopefully, it is clear that this is a general purpose tool -- if you have a directory full of files you'd like to import into OneNote this tool will do it for you.
At this point, you are probably wondering how I am importing email messages from my mail client. The answer is this, I have another program that extracts all of the data from the email I am interested in, and places it in a location the importer will notice. The code that does the extraction and uploading is written in Perl. I threw it together quickly, but so far it seems to work well.
I've implemented this by associating an email address with the program. This way whenever an email shows up in my inbox that I'd like imported into OneNote all I have to do is bounce it to that email address, and then run the importer to pull it in.
By implementing it this way, I can send emails to that address from anywhere, and I'm not just limited to importing things from my primary inbox. For instance, if I take a picture of something interesting with my cell phone all I have to do is email the picture to my OneNote importer email address, and voila it is ready for inclusion in OneNote.
Currently this is a two-step process, but it wouldn't take much additional work to have the importer run as a service. Then it could always watch the import directory, and pull things into OneNote as they showed up.
I haven't been interested in taking it to that level because I want to know when I pull something into OneNote. I have security restrictions on what the Perl code will parse and upload, but if someone were to bypass that, I'd like to know about it.
Check back tomorrow and I will talk about the HTML importer that can be used for importing complete web pages into OneNote.
This software is distributed on an "AS IS" basis, without warranties or conditions of any kind, either express or implied.
First off, let me say that this is the first .NET / C# coding I've attempted to do. So if you see where I've done something poorly or have any constructive feedback relating to the code, I'm all ears.
Secondly, I thought it would be helpful to enumerate a few resources that I've found useful.
Okay so let's dive in. First off when creating your project, make sure you add a reference to the OneNote API. The Unknown OneNote Guys has a nice post on how to do this.
The first thing I did was design a class library with objects and methods for working with the OneNote API. This compiles into a DLL file, and it is referenced by my OneNote programs. I figured this would be the easiest way to ensure code re-use across the various applications I planned to develop.
In order to use the routines in the JPHOneNoteUtilities.dll, you need to add a reference to the dll in your project. Then add the line 'using com.jamiehill;' under the other 'using' statements.
You can download the source code for JPHOneNoteUtilities.cs here. It consists of one Class JPHOneNoteUtilies and two Structs: OneNoteXMLObject and XY.
The OneNoteXMLObject struct provides storage and retrieval for the interesting XML attributes of a OneNote XML object (this can be a Notebook, Section, Page, etc.). Whenever I retrieve something from the OneNote XML schema, I usually put it into this struct for later reference.
The XY struct is used to store dimensional or point position information about objects that I am placing into a OneNote page.
The JPHOneNoteUtilities class has a handful of methods primarily geared towards interacting with the OneNote API.
There are a few more routines, I have commented out in the code, that make up a recursive decent parser for the OneNote XML structure. I had originally intended on developing an XML browser to get my feet wet (this was inspired by the Unknown OneNote Guy). However, I never got around to building a data structure to hold the information. The idea was to build something that would easily map onto a System.Windows.Forms.TreeNode; maybe one of these days I'll get around to actually implementing this.
The other thing that I thought would be useful for this post is some examples of the XML markup that goes into creating a OneNote page.
The first example contains various elements that might be found in a page.
The second example contains an embedded image.
The third example contains ink.
Check back tomorrow and I will talk about a general purpose importer, which among other things allows me to easily import email messages from PINE.
This software is distributed on an "AS IS" basis, without warranties or conditions of any kind, either express or implied.
I've been using Microsoft's OneNote 2003 for a little over a year. Nate told me about it when it first came out. At the time, I was using a paper notebook system developed by David, which was working well for me. When Nate showed me OneNote I thought, "That's interesting, but it doesn't seem particularly useful," and I promptly forgot about it. Well, during the summer of 2005 I started envisioning a new way to deal with all of the information that comes at me on a daily basis. It needed to have a few key features
I didn't really think there was anything out there like what I was thinking about. Certainly there were apps that delivered part of the package, but nothing that had all of the features I was looking for. David and I spent some time talking about it, and he felt like what I was describing was at its heart an operating system. Early on I had trouble making the connection; it felt more like a file management system to me. Eventually, I've come around to David's point of view.
I really had two problems at this point. Developing this software was going to be a massive undertaking, and I couldn't find a tablet device in the form factor that I thought would make a good replacement for my paper notebook.
My tablet problem was solved back in May with Samsung's launch of the Q1. The Q1 is one of several UMPCs (ultra-mobile PCs) that are now on the market. They have a 7 inch screen; run Windows XP tablet edition; and have full Ink support. At the moment these devices are still costly, and they have a few short coming. Battery life is poor, around 3 hours. They use resistive touch screens; while nice for using your fingers; it can wreak havoc on hand writing if you rest your hand on the screen. Finally, they are a bit under powered; most are using a Pentium Celeron 900Mhz CPU.
As for taking on the development project, I eventually decided that I didn't have the time to devote to it. I started evaluating programs, and I finally settled on OneNote. It had some of what I was looking for, but also had some significant short-comings. The primary things I disliked were searching was very weak, support for tables (tabular data) was almost non-existent, you couldn't link to other pages, embedded files weren't truly embedded, etc.
Microsoft has been working on OneNote 2007, which was touted to have a whole host of new features. I tried Beta 2 back in May, but disliked some things and discontinued using it the same day. Recently, Microsoft has released Technical Refresh of beta 2, and I thought it was time to give it another look. This time I have stuck with it, and haven't looked back. There is now true table support. Searching is amazing (based on the latest Windows Desktop Search). They OCR images and any text in the image is searchable, ink is searchable, audio is searchable. There is a print to OneNote printer driver. You can have multiple notebooks, at first I didn't think this would be useful, but it is pretty nice. You can link to other pages in the notebook. Embedded files are really embedded, though you have to go through and re-embed all of your old files. Finally they've introduced a collaboration feature that is really slick. I no longer have to use off-line files to share OneNote files among all of my computers; it now handles that automatically. Multiple people can edit the same page on or off line, and all of the changes will be sync'd in, usually seamlessly.
The only real downside I've noticed is that the program is slow. I'm hoping when it comes out of beta that the speed issues will have been addressed. If not, it is certainly a problem I can live with.
Finally, the reason for my post, the new OneNote also has a pretty useful API. This allows for custom apps to be developed against OneNote. It is based on .NET which I have not done any programming against.
I've found it difficult to get some information into to OneNote. For instance, I use a text-based email program called PINE, and it is not trivial to get information out of it and into OneNote. Also, getting data from web browsers is not always easy. The print to OneNote feature is nice, but you lose all of the hypertext links. Copy and pasting web pages works well for snippets, but it does not handle whole pages well.
About a month ago I downloaded C# Visual Studio Express, and I started writing some apps to fill in the gaps. Over the next few days I plan to share the code, in the hope that it might be useful for other people too.