Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

Maya Flag error

Maya Flag error

jayantbhatt07
Advocate Advocate
7,075 Views
6 Replies
Message 1 of 7

Maya Flag error

jayantbhatt07
Advocate
Advocate

 Anyone can help me with this. The command  is giving me an error 

Error = ( // Error: line 15: Flags must come before objects: -ed )

textFieldButtonGrp  -buttonLabel "Browse" -tx $cfp -bc rsFileDialog rsTxtFld -ed true filepath;

0 Likes
Accepted solutions (2)
7,076 Views
6 Replies
Replies (6)
Message 2 of 7

rajasekaransurjen
Collaborator
Collaborator
Accepted solution

textFieldButtonGrp -buttonLabel "Browse" -tx $cfp -bc rsFileDialog -ed true filepath;

0 Likes
Message 3 of 7

jayantbhatt07
Advocate
Advocate

//Code by rajasekaransurjen


{ 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";
textFieldButtonGrp -buttonLabel "Browse" -tx $cfp -bc rsFileDialog rsTxtFld -ed true filepath;
button -w 60 -h 28 -label "Capture" -command "Capture";






// show the window we last created
showWindow;
}

proc rsFileDialog()

{
string $rsPath[] = `fileDialog2 -ds 1 -fm 3`;
textFieldButtonGrp -e -tx $rsPath[0] rsTxtFld ;
}


global proc Capture()
{

string $path = `textField -q -tx filepath`;
string $k = ($path + "/snapshot");
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 2000 -h 2000 -f $k;
}

clear $node;
}

0 Likes
Message 4 of 7

jayantbhatt07
Advocate
Advocate

When I added you line error was ( // Error: line 31: Object 'rsTxtFld' not found. )

0 Likes
Message 5 of 7

tkaap2
Autodesk
Autodesk
Accepted solution

Skimming this script, this line that was triggering your original problem:

textFieldButtonGrp -buttonLabel "Browse" -tx $cfp -bc rsFileDialog rsTxtFld -ed true filepath;

Should probably be: (rsTxtFld moved to the end)

textFieldButtonGrp -buttonLabel "Browse" -tx $cfp -bc rsFileDialog -ed true filepath rsTxtFld;

 

The error "Flags must come before objects" means that in the grammar of the command, "verb, adverbs, object", the final object you are operating on has to come last.  In this case, the command `textFieldButtonGrp` is creating the `rsTxtFld` object and assigning it that name.   Everything in the middle is controlled by flags (-stuff -that -follows -dashes) or flag values (-this value -that value -the other value).  The object needs to come last.

 

Later  in the script, that `rsTxtFld` object is being updated/edited, and if it is not named here, it will not be found.  (That creates the error in Message 4 in this thread).

 

Message 6 of 7

jayantbhatt07
Advocate
Advocate

Hi thank you so much for you help.

0 Likes
Message 7 of 7

saptadwip9
Community Visitor
Community Visitor

how to fix this

 

0 Likes