You can use my desktop_write module. As you will see, the actual code to do it is pretty simple. This just packages it for you and provides the option of different output file types.
desktop_write
Reputation Points: 210
Solved Threads: 228
Nearly a Posting Virtuoso
Offline 1,389 posts
since Sep 2008