PDA

View Full Version : Need the final syntax to complete command


Mikademius
02-07-2008, 02:41 PM
Hi gang. Haven't been scripting for over a month now (Been surfin' the waves East Coast Oz!) and one single MEL line is killing me today. I just need help puttin' the line in a button command. Simple task, but my head is grease right now...

The task I want to do is a normal OBJ Export. The code for this is:

file -op "groups=0;ptgroups=0;materials=0smoothing" -typ "OBJexport" -pr -es ($ah_wbExportConcatenatePath + (`textField -q -tx ah_wbExportObjNewNameTF`));


where


($ah_wbExportConcatenatePath + (`textField -q -tx ah_wbExportObjNewNameTF`)


is just to get the filename based on a path and given textstring in a textField. This is not important.

To get the code running I thought I should use the "eval" command and this is working in the scriptEditor. "Yey, now all I have to do is set this in the -c of the button"...


eval("file -op \"groups=0;ptgroups=0;materials=0smoothing\" -typ \"OBJexport\" -pr -es ($ah_wbExportConcatenatePath + (`textField -q -tx ah_wbExportObjNewNameTF`))")


Could someone help me with the last part here.


button -l "export" -c ? buttonName;


""'s, ()'s or what? I've tried several syntaxes and I'm going blind so I reach out to the international super MEL community :)

NPuetz
02-07-2008, 05:04 PM
could put the command in its own procedure then call that procedure from the button using ("")....
proc exportOBJ()
{
command....
}


...... button -l "export" -c ("exportOBJ();") nameOfButton;

Mikademius
02-08-2008, 08:59 AM
Thanks, but I want to do it without using a proc :)

GennadiyKorol
02-08-2008, 09:28 AM
Why just not accumulate the command?


string $base = "file -op \"groups=0;ptgroups=0;materials=0smoothing\" -typ \"OBJexport\" -pr -es ";
string $path = $ah_wbExportConcatenatePath + (`textField -q -tx ah_wbExportObjNewNameTF`);
string $cmd = $base + "\"" + $path + "\";";

...

button -l "export" -c $cmd buttonName;


Now I demand dividends for your book! :wise:

P.S. MSN is calling for you, I can sense it.

GennadiyKorol
02-08-2008, 10:29 AM
Oh, that's of course in case the (`textField -q -tx ah_wbExportObjNewNameTF`) is static.

If you want to query the textField on button press you should either go with a proc as suggested above (probably the cleanest way ;) ),
or an eval as you wanted to by making sure the string you get is a valid one :)

Or this, in my opinion better way:

string $base = "file -op \"groups=0;ptgroups=0;materials=0smoothing\" -typ \"OBJexport\" -pr -es $path;";
string $cmd = "{ string $path = $ah_wbExportConcatenatePath + (`textField -q -tx ah_wbExportObjNewNameTF`); ";
$cmd += $base + " }";

Mikademius
02-13-2008, 02:34 PM
I still wonder why the eval line that works alone can't be added to the button command without introducing new strings or even a proc, but I guess I have to go for the proc attemts since I do not have time to figure it out...

Thanks for the help. :)

CGTalk Moderation
02-13-2008, 02:34 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.