100 Scripts — Script 34: Recovering Sticky Notes Using Python
Recently I had an issue where my sticky notes with some important data vanished. Now for anyone who is lazy Sticky Notes is very helpful to keep important information to refer later. Same is the case with me. But the when the data was lost, I had to find an alternate solution. Now I know that Sticky notes saved its data somewhere. It depends on the version of Sticky notes version and Windows OS version with which it is shipped.
Now thanks to the below link I learnt that there are many ways the Notes can be stored and the basic trick is that the notes have an ID and are stored in Rtf format.
It was difficult to find a reliable solution in the web and after hacking around the original code in the link I finally was able to recover my old notes:
The key part of the code are file_handlers.py and the rtf & getMarkdown() code referred to in the code. The modified code can be downloaded from the below path:
The code
The get_notes() function does the heavy lifting where it open the StickyNotes archive file which is in ole format. Then reads the notes from the ole database and saves that in an array which is later saved in notes.json and notes.txt. getMarkdown() function reads an RTF format string and convert to equivalent Markdown format. Please read the comments to get a better context.