Hi, thanks. When I hit the capture button something happens, even when the textfield is empty or blank. So to avoid it I tried to add condition but seems to be like doing something else.
proc ScreenCaptureWin()
{
global string $rsTxtPath, $rsTxtName;
string $sn = `file -q -sn`;
string $cfp = `dirname( $sn )`;
if (`window -exists ScreenCapture`) //closes window if already open
deleteUI ScreenCapture;
window -title "ScreenCapture" ScreenCapture; //creates window
rowColumnLayout -numberOfColumns 4 -columnAttach 1 "left" 0 -columnWidth 1 40 -columnWidth 50 500;
text -label "Path";
$rsTxtPath = `textField -w 200 -h 10 -tx $cfp -ed true `;
button -w 60 -h 28 -label "Capture" -command "Capture";
rowColumnLayout -numberOfColumns 4 -columnAttach 1 "left" 5 -columnWidth 1 40 -columnWidth 50 500;
text -label "Name";
$rsTxtName = `textField -w 200 -h 28 -ed true `;
// show the window we last created
showWindow;;
}
global proc Capture()
{
global string $rsTxtPath;
global string $rsTxtName;
//HERE IS THE CONDITION
if (textField($rsTxtPath) < 0)
{
confirmDialog -t " Check your object selection. " -b "OK" -bgc 0.8 0.5 0 -ma "center" -m " You have selected several objects. Select ONLY 1 mesh. ";
error "Select The Path";
}
string $path = `textField -q -tx $rsTxtPath`;
string $FileName = `textField -q -tx $rsTxtName`;
string $rsFileList[] = `getFileList -folder $path`;
int $rsFileCount = size($rsFileList);
string $k = ($path + ("/"+$FileName+".jpg"));
string $ff = ".png";
string $node[] = `ls -sl`;
setAttr "defaultRenderGlobals.imageFormat" 8;
playblast -st 1 -et 1 -v 0 -fmt "image" -qlt 100 -p 100 -w 1000 -h 1000 -fp 0 -cf $k;
clear $node;
}