Automatic taking of screenshots?

Is there a function or script I can use to automatically take a screenshot after a level loads?