PDA

View Full Version : more fileDialog woes!


Mattrne
10-29-2003, 11:25 AM
I'm trying to write a little script to pop up a file dialog box which will allow a user to pick a mel file from a folder and then have the script source this mel file. Unfortunately, me being me, it aint working properly!

This is what I have;

global proc string getMel()
{
string $file = `fileDialog -directoryMask "q:/g2_eyetronics/mel/*.mel"`;
return $file;
print $file;
source $file;
}
getMel;

Now it pops up the file dialog box and allows me to pick a mel file, which is fine. However, it doesn't appear to do the print command or anything else. If I manually run the print line it gives me the correct path and filename contained in the $file variable.

What do I need to do to get this working? Also, presumably if the print is printing the contents of $file then I could do the source bit on there and it would source the user specified script?

Any help would be cool!

Cheers,

Matt.

GDC
10-29-2003, 05:08 PM
The problem is your after you issue the return command maya leaves the proc and returns to where the proc was called.
Try it with out the return or move the return to the end of the proc.

--g


Originally posted by Mattrne
I'm trying to write a little script to pop up a file dialog box which will allow a user to pick a mel file from a folder and then have the script source this mel file. Unfortunately, me being me, it aint working properly!

This is what I have;

global proc string getMel()
{
string $file = `fileDialog -directoryMask "q:/g2_eyetronics/mel/*.mel"`;
return $file;
print $file;
source $file;
}
getMel;
Matt.

brubin
11-03-2003, 05:17 PM
typing:
source $file ;

doesn't cut it, you want to evaluate this line after you filled it with "meaning", hence:

eval "source $file;" ;

check the docs on eval.

HIH
s.

CGTalk Moderation
01-16-2006, 12:00 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.