if (`window -exists batchGen`)deleteUI -wnd batchGen; string $imageName = `file -q -ns`; string $frameStart = `getAttr defaultRenderGlobals.startFrame`; string $frameEnd = `getAttr defaultRenderGlobals.endFrame`; window -t "Batch Render Script Generator" batchGen; columnLayout; rowColumnLayout -numberOfColumns 2 -columnWidth 1 100 -columnWidth 2 250 ; text "Render Command" ; // Command field allows user to pick maya version to render with // which is useful when more than one version is installed on a machine // textField -insertText ("C:\\Program Files\\Alias\\Maya7.0\\bin\\render") -width 250 renderCommand; text "Image Name" ; textField -insertText $imageName -width 250 imageName; text "Start Frame" ; textField -insertText $frameStart -width 250 startFrame; text "End Frame" ; textField -insertText $frameEnd -width 250 endFrame; text "Render Directory" ; textField -insertText (`workspace -fullName` + "/images") -width 250 renderOutDir; setParent ..; button -height 28 -label "Generate Batch File" -width 350 -c "startBatchGen; deleteUI batchGen;"; showWindow batchGen; global proc startBatchGen(){ string $projDir = ("\"" + `workspace -fullName` + "\"" ); string $renderCommand = ("\"" + `textField -q -tx renderCommand` + "\"" ) ; string $imageName = `textField -q -tx imageName`; string $frameStart = `textField -q -tx startFrame`; string $frameEnd = `textField -q -tx endFrame`; string $dateLong = `system date`; string $dateSmall = `match "[0-9]+[0-9]+/[0-9]+[0-9]+/[0-9]+[0-9]+[0-9]+[0-9]+" $dateLong`; string $date = substituteAllString($dateSmall, "/", "."); string $renderOutDir = ("\"" + `textField -q -tx renderOutDir` + "\\" + $date + "\\" + `file -q -ns` + "\"") ; string $fileName = ("\"" + `file -q -sn` + "\""); string $scriptLocation = `workspace -q -dir` + `file -q -ns` + "_render.bat"; $fileId = `fopen $scriptLocation "w"`; fprint $fileId ($renderCommand + " -s " + $frameStart + " -e " + $frameEnd + " -proj " + $projDir + " -im " + $imageName + " -rd " + $renderOutDir + " " + $fileName); fclose $fileId; }