Render And Save (mel Maya 7)

Just working with MEL for the first time.

I'm making a script that does a couple of things to an object, then renders out a thumbnail.
Everything is working, but I can't figure out how to...

1) Determine the directory path of the currently opened file (Because that is where I want to save the thumbnail).

2) I apparently can't use the RENDER command to save the file to a specific directory (strange?). So do I have to pull the file from the TMP directory and move it?

I'm doing this in Maya 7
Any help is appreciated....sorry for such a Novice question.

Thanks!

QUOTE(Duckspeaker @ 08/22/08, 08:10 PM) [snapback]290229[/snapback]
1) Determine the directory path of the currently opened file (Because that is where I want to save the thumbnail).

$pathWithoutFile=substitute "[^/]*$" ((string)file("-q","-sn","-un")) "";

QUOTE(Duckspeaker @ 08/22/08, 08:10 PM) [snapback]290229[/snapback]
2) I apparently can't use the RENDER command to save the file to a specific directory (strange?).

Yes you can, just specify a full path for the name, if your doing this with maya internal command just manipulate the render globals node.

Theres a nifty alternative to thsi and thats to launch thsi form the operatingsystem. This frees you up to do work while maya renders tough it takes a tad longer, its alse much easier to issue to bunch of existiing files form command line (even on remote users computers). Also obviously its also inherently easier to put the files to right place en masse no matter where on harddrive your files are.

Its maybe best when you post you dont indicate ability of failure or suggest a course of action that happers yoru possible learning

QUOTE(Joojaa @ 08/22/08, 01:26 PM) [snapback]290234[/snapback]
$pathWithoutFile=substitute "[^/]*$" ((string)file("-q","-sn","-un")) "";

That works great...Thank You
I had seen "file", but wasn't sure how to manipulate it to get anything worthwhile out.
I had to look up "substitute"---not being familiar with it.

The help file in Maya really doesn't do enough to get someone (me at least) up and running.

QUOTE(Joojaa @ 08/22/08, 01:26 PM) [snapback]290234[/snapback]
Yes you can, just specify a full path for the name, if your doing this with maya internal command just manipulate the render globals node.

I can't seem to get "render" to take a file name...I always get a syntax error right after the colon of my path (Example: render -x 320 -y 240 persp C:/test.tga;)

I'm looking into the renderGlobalsNode now.

QUOTE
render -x 320 -y 240 persp C:/test.tga;)

Your mixing up the commandline render and the internal command render. They look awfully close but are in essence 2 separate thing. Th internal render ONLY obeys the render settings.