Saving Screenshot In Mel

Hi,

I need to take a screenshot of an object at the origin, save that screenshot as a .jpg or .bmp, so that I can use it on a symbolButton.

I've tried playblast with frame 1 but it doesn't seem to save the actual file. Is this the right/only way?

Thanks!

setAttr "defaultRenderGlobals.imageFormat" 8; //set jpeg
playblast -st 1 -et 1 -v 0 -fmt "image" -f "c:/temp/testing";

wil result in

testing.0001.jpg

If and ONLY if that file does not exsist so i suggest use sysFile to rename it after creation and make check before play blast to see if file exists else use different temp name.

QUOTE
Is this the right/only way?

no theres 3 other ways i know of too. While all of them are screen shots technically youd only actually call 2 of the alternate screen shots. Id prefer a hw render!