LC #42 Pipers Alley

View Full Version : system MEL error??!!

09-19-2005, 11:37 AM
OK here is the problem:

I tried to create a simple mel shelf button that will save my existing maya7 scene to maya 6 via mayaFileConvert.exe prog.
This is the script I thought would work:

string $currentScene='getFileList';
system ("mayaFileConvert -v 6.0 "+$currentScene);

It looks simple enough,but I get an error msg:
cannot convert data type string to string[]
I really don't know what this means. :banghead:
Can anyone help me understand what am I doing wrong?


09-19-2005, 12:36 PM
I dont think 'getFileList' gives you the name of your scene.
It is used to list all files in your project or get the folder that it is into.
You should use instead `file -q -sceneName`

09-19-2005, 01:10 PM
quote from the docs:



[...] (http://localhost:4446/Maya6.0/en_US/Commands/getFileList.html)

Return value

string[] an array of file names

which means, your code should probably work with this little modification:

string $currentScene[] ;
$currentScene = 'getFileList' ;
system ("mayaFileConvert -v 6.0 "+$currentScene[0]);

09-19-2005, 03:03 PM
thanx guys,but now I have similar problem regarding the file -q -sceneName command :hmm:

the code goes like this:

string $currentScene[];
$currentScene=`file -q -sceneName`;
system ("mayaFileConvert -v 6.0 "+$currentScene[0]);

and the same error shows up again!!
cannot convert data type string to string[]

How come?!


09-19-2005, 03:23 PM
...cause this time you have it wrong the other way around: TAKE A LOOK AT THE ONLINE-MANUALS FIRST!



Return value

Dependent upon the action or query requested. Most actions return a string which is the name of the specified file.

if you choose to use "file" instead of "getFileList" you can fall back on your initial approach, "getFileList" on the other hand uses an array AT ALL TIMES as a returning value, so you have to query a specific element of that array to give to your system command, which needs a single string only.
just read more carefully, will ya'?


09-19-2005, 03:29 PM
yup I got it
thanx :bounce:

09-19-2005, 03:32 PM
string $currentScene = `file -q -sceneName` ; //does not return an array
system ("mayaFileConvert -v 6.0 " + $currentScene) ;

It does not sound trivial to make Maya 7 backwards compatible with Maya 6. After all...Alias didn't even do it ;)

CGTalk Moderation
09-19-2005, 03:32 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.