Batch Rendering In View Using Mel Need Some Help

Hi
I have written a script for batch rendering in view just like 3dsmax and its also works well.
The Problem is if I want to Break the operation after some frames I can't able to stop the process
as it is using the For Loop. So is there any way to handle this problem. I have an idea of using a
Trigger to stop the process. But is there anything similar to kbhit() (or) getch() functions from C (or) C++
in Maya. I will appreciate if anybody suggest any good solution for this problem.This is my Script.

int $L;
int $E=getAttr defaultRenderGlobals.endFrame;
string $F;
int $S=getAttr defaultRenderGlobals.startFrame;
string $A=getAttr defaultRenderGlobals.imageFilePrefix;
string $EX=getAttr "defaultRenderGlobals.outFormatExt";
RenderViewWindow;
for($L=$S;$L<=$E;$L++)
{
currentTime $L;
$F="D:/_MayaProjects/images/"+$A+$L+$EX;
renderWindowRender redoPreviousRender renderView;
renderWindowSaveImageCallback "renderView" $F "Targa";
playButtonStepForward;
};

make a progressbar and ask every loop if you want to cancel.

BUt you do understand that this is actually way slower then batch rendering and wastes a lot of memory And is much more errorprone

PS. this script is already developed, several times so if your not doing this because of the learning experience download it its jut a waste of time to redo the stuff over and over again (especially when the others have been tested retested and made bulletproof already)

renderPlease

PPS. don't shout its rude (I did normalize you)

Hi
Thanks for your reply. Render Please is a very good example for my Question.
I got the Answer.

With Regards
S. Sathish Kumar