Modifying this script to save screenshot to file?

 From:  Michael Gibson
7655.4 In reply to 7655.1 
Hi Chipp, also check out here for a version that will pop up a dialog box to ask you for the file name for the image file, if you want that:
http://moi3d.com/forum/index.php?webtag=MOI&msg=7542.2

These won't save as a transparent PNG though, the viewport background will be in there.

But if you export to AI or PDF format, the shaded image in those will have a transparent background. For PDF format the image is embedded in the PDF file, for AI format the image will be a separate .png file alongside the .ai file, the png file will have a "_bkgnd" appended to the file name like: filename_bkgnd.png

- Michael