View Full Version : Importing an external mel file
Buexe 09-09-2003, 04:23 PM Yo, I would like to read and execute an external mel script file (no proc, just a bunch of commands). Currently I use the import command but what happens is that some global procedures just don`t get executed(???) I can use them manually but when they are in the external file, nothing happens. So my question is: is it generally speking ok to import mel files and all content will(or should at least) be evaluated, or should I rather build aprocedure that will read in the script line by line and use the eval command?
Or what da heck am I doing wrong?
TIA
buexe
PS: I can copy/paste the content into the script editor and it executes just fine : (
|
|
ACFred
09-09-2003, 08:47 PM
use the "source" function.
Buexe
09-09-2003, 10:01 PM
oh yeah, baby, you make me wanna say hmmmm....
Thanks ACFred!!!
buexe
Buexe
09-09-2003, 10:33 PM
Oh boy,this source command (the docs say it`s not one I know) has a strange syntax
eval( "source \"./sourceTest\"" );
I know how to use it if I know the static path but how does one put a variable in this (s)crypt? For now I read in the script line by line and eval it and it seems to be fine
so long
CaptainSam
09-14-2003, 09:12 PM
eval( "source \"./sourceTest" + $variable + "blahblahblah\"" );
you can also use evalEcho to see the resulting string printed in the scriptEditor
mark_wilkins
09-15-2003, 07:33 PM
If you define a global proc in an external MEL file and then source it, it won't execute, it will just define the global proc. To execute it at source time, you have to put a call to the procedure in the file. Here's an example:
global proc test() {
print "Hello World!\n";
}
test(); // without this line, the proc won't execute at source time.
CGTalk Moderation
01-16-2006, 02:00 AM
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.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.