Rediscovering the reason we have automation in OneNote

I told the true story last October about a customer who was trying to use an internal modem outside of his computer. The lesson I mentioned is everyone who makes software should have to do tech support for a year before being allowed to do any other work in the computer or software realm. There is a second lesson there that I re-learned this week: don't overlook the obvious.

I've been investigating an automation script which was failing almost 100% of the time. For what it is worth, the script has to do with optimizing OneNote files. The real world use is this - if you delete a few pages from a section, or delete a large enough attachment, OneNote will NOT immediately delete the information from the file. We give you a small period of time to "undo" the operation and delay updating the file on the hard drive until your computer goes idle. You can imagine how this delay could save "thrashing" the hard drive as the file is shrunk and save a little battery life too. You can alter these settings (how big the change must be to cause the optimization and how long to wait until optimizing) by opening Tools | Options | Save:

clip_image001

Back to the automation script. In one method, the script was hitting an error when trying this. Starting too long ago to admit, I started adding more logging to help see where the problem may be in the script, double checking the value of the variables the script was using, diving into the MOTIF framework which actually runs our scripts in the lab, trying to track down if it was only failing on 32 or 64 bit Windows, etc… I was getting nowhere. Then Lin (author of the Journal Importer) came by, took one look and said, "It's probably a new bug in OneNote." Sigh. It was. I had assumed the script was to blame instead of thinking the product had changed. After that, I got a memory dump, callstack, system information, etc… and handed the bug over to developers to fix. Testing the fix should be fairly easy in some ways - the automation script should definitely pass.  After all, that's why we have automation in the first place.

And the lesson I will hopefully remember this time is to check the obvious solutions first.

Questions, comments, concerns and criticisms always welcome,

John