Here’s a MEL script to bypass Maya’s Batch Render, and Sequence Render – sometimes the Batch/Sequence render causes issues in certain situations. This script renders from the render preview screen and automatically saves the images, based on your render settings. Check out a video tutorial as well.

To use the script:

Copy and Paste the below code into the script editor. You can also save it in the script editor as a .mel file to use later. Alternatively, you can save it as a .mel file and drag it into the script editor.

// a manual render script with a timer and cancel button.
// Joel Benjamin, Jan 2015
// V3 May 2020
    // progress bar update

global string $gMainProgressBar;
int $maxPBar;
$maxPBar = 10000;

proc ManRenderUI() {    
    global string $startFrameField;
    global string $endFrameField;
    global string $camSelect;
    global string $renderDirectory;
    global string $fileNameField;    
    global string $renderDirectory;
    //check to see if window exists, kill it if so
    int $doesExist = `window -exists "ManualRender"`;
    if ($doesExist)
        deleteUI "ManualRender";


    // collect a list of cameras in the scene
    string $cams[]=` listCameras`;
    int $camsSize=`size $cams`;
    
    //collects some render settings
    int $currentStartFrame= `getAttr defaultRenderGlobals.startFrame`;
    int $currentEndFrame= `getAttr defaultRenderGlobals.endFrame`;
    string $currentFilename = `getAttr defaultRenderGlobals.imageFilePrefix`;
    
    
    /* to see other render settings.... 
        print `getAttr defaultRenderGlobals.multiCamNamingMode`;
        string $globals[] = `listAttr defaultRenderGlobals`;
        $globals = `sort $globals`;
        print $globals;
    */  
    
    
    // check to see if the script has been run already. If so, keep the previous settings
   // string $renderDirectory;
    if ($renderDirectory == ""){ //if nothing here, set the render directory based on the project
        string $renderDirectory = `workspace -q -rd`;
        $renderDirectory += "images/";
        string $dirResults[];
        $dirResults[0] = $renderDirectory;
        $renderDirectory = $dirResults[0];
        print "in the if\n";
        print ("render directory = " + $renderDirectory + "\n");
    }
   // $renderDirectory = $dirResults[0];
    print ("render directory = " + $renderDirectory + "\n");
    
    
    //filename checker
    string $renderFilename;
    if ($renderFilename == ""){ //if nothing here, set the file name based on render settings
        $renderFilename = $currentFilename;
            if ($renderFilename == ""){ //if nothing here, set the file name based on render settings
        $renderFilename = "renderFileName";
        }
    }
    
    //start and end frames
    
    int $theStartFrame;
    print $theStartFrame;
    if ($theStartFrame==0){
        $theStartFrame= `getAttr defaultRenderGlobals.startFrame`;
       
    }
    
    int $theEndFrame;
    if ($theEndFrame==0){
        $theEndFrame= `getAttr defaultRenderGlobals.endFrame`;
    }
    
    print ("The start frame = " + $theStartFrame);
    window -rtf 1 -t "Manual Render" "ManualRender";
    columnLayout -rowSpacing 10 "ManualColumn";
    text "\n\nHappy to help you render! Don't forget you can press ESC to cancel once it's going...\n\n";
        frameLayout -l "Start and End Frame" "startEndFrame";
        string $startFrameField = `intFieldGrp  -l  "Start Frame:" -v1 $theStartFrame "startField"`;
        string $endFrameField = `intFieldGrp  -l  "End Frame:" -v1 $theEndFrame "endField"`;
        setParent ..;
        
    frameLayout -l "Choose your Camera to Render From" "cameraFrame";
    // making a camera selector
    string $camSelect = `optionMenu -label "Render camera" -cc "print #1"`;
    // add cameras
    for ($c=0; $c<($camsSize); $c++){
            menuItem -label $cams[$c];
    }
    setParent ..;
    

    global string $fileFrame;
    
    string $fileFrame = `frameLayout -w 950 -l ("Render to: " + $renderDirectory) "myFileLocation"`;
    //choose file location

    //string $directText = `text -l ($renderDirectory)`;
    //print ("DirectText = " + $directText);    
    setParent ..;
    button -w 250 -l "Change Render Directory:" 
        -c "string $dirResults[] = `fileDialog2 -dir $renderDirectory -dialogStyle 2 -fm 3`; $renderDirectory = $dirResults[0]; frameLayout -e -l (\"Render file location = \" + $renderDirectory) $fileFrame;";
    
    //text -e -l ("Current " + $renderDirectory) $directText;
    string $fileNameField = `textFieldGrp -l "Filename" -tx $renderFilename`;
    text -l "An option to cancel the render will pop up after a couple of seconds. \nPress it to force cancel the render";
    setParent ..;
    
    rowLayout -nc 2;
    // buttons

    button -l "Render away" -c "infoCollect(); deleteUI \"ManualRender\" ";
    button -l "Cancel" -c "deleteUI \"ManualRender\"";
    

    
    showWindow "ManualRender";
    
}


proc infoCollect() {
    global string $startFrameField;
    global string $endFrameField;
    global string $camSelect;
    global string $renderDirectory;
    global string $fileNameField;
    global int $endFrame;
    
    int $startFrame = `intFieldGrp -q -v1 $startFrameField`;
    int $endFrame = `intFieldGrp -q -v1 $endFrameField`;
    
    string $camToRender = `optionMenu -q -v $camSelect`;
    string $fileName = `textFieldGrp -q -tx $fileNameField`;
    
    print ("Selected render directory = " + $renderDirectory);
    
    //do it
    renderGo($startFrame, $endFrame, $camToRender, $renderDirectory, $fileName);
}


proc renderGo(int $startFrame, int $endFrame, string $camToRender, string $renderDirectory, string $fileName){
    global string $gMainProgressBar;
    global int $x;
    global int $startFrame;
    global int $endFrame;
    global float $userPause;
    global int $buttonPressed;
    
    int $buttonPressed = 0;

    $userPause = 1.0;
    timer -s -n "WindowKiller";
    float $checkTime = `timer -lap -n "WindowKiller"`;
    $x=$startFrame;

    /* Here is the progressbar start */
    progressBar -e -bp -ii 1 -max $endFrame  -status "Rendering your ..uh.. renders... ..." $gMainProgressBar;

    //start the rendering
    for ($x=$startFrame; $x<=$endFrame+1; $x++){
    
        // update progress bar
        if(`progressBar -q -ic $gMainProgressBar`){
            break;
            warning "Breaking Progress Bar.";
        }
        progressBar -e -s 1 $gMainProgressBar; // increases the progress bar
        
        
    currentTime $x;
        print ("Rendering frame " + $x + "\n");
        refresh -f;

        //check the timer and cancel if user wishes
        float $checkTime = `timer -lap -n "WindowKiller"`;
        
        if ($checkTime > $userPause){
            timer -e -n "WindowKiller";
            timer -s -n "WindowKiller";
            int $doesExist = `window -exists "Checker"`;
            if (($doesExist)){
                //deleteUI "Checker";
                warning "Hit the cancel button to stop the render.";
            }else if ($buttonPressed==0){
                //showCancel;      //// this used to show the cancel button but it's not working anyway
            }
        }
           string $frameNumber="";
   
   //double-checking it wasn't canceled 
   if ($x<=$endFrame){
       // configure frame padding, up to 9999 frames at least
        if($x<10){
            $frameNumber = ("000" + $x);
        }else if ($x<100){
            $frameNumber = ("00" + $x);
        }else if ($x<1000){
            $frameNumber = ("0" + $x);
        } else {
            $frameNumber = $x;
        }
      
        
        // do the actual render
        print ("Rendering to " + $renderDirectory + "\n");
        renderWindowRenderCamera render renderView $camToRender;
    
        //saving the file
        $filename = ($renderDirectory + "/" + $fileName + "." + $frameNumber);
    //    $filename = ("U:/BetweenDoors/Maya/PartA/images/masterLayer/shot170/shot170." + $frameNumber + ".tif");
        renderWindowEditor -edit -writeImage $filename renderView;
            
            
        }
    }
    progressBar -e -ep $gMainProgressBar;
    //end the timer
    timer -e -n "WindowKiller";
    
    //kill cancel window if it's there
    int $doesExist = `window -exists "Checker"`;
    if (($doesExist)){
        deleteUI "Checker";
        refresh -f;
}
}

ManRenderUI();