hey anybody know how to sourcing or importing MEL script on maya when startup ?

i'm already try sourcing script with local folder like "C:/scripts/script.mel" and its work
but its just one script.
in case when i have alot of scripts,is it not efficient for sourching every scripts...

than i just look at another tutorial.. working with maya.env with add

"MAYA_SCRIPT_PATH= //server/scriptLib/ "

than i trying it and run the script ie. " script(); " but it say error " no procedural found ".
even though the file already exists in the directory...

the question is :
1. how to load another script from server library when startup with address " //server/scriptLib/ " and just call ie. " runScipt(); " or another global procedure on MEL
2. if using source command is it possible ?
3. i'll using another script for hotkey ie. i just add " hotkeySelectALL(); " on the hotkey editor
so it just call a simple script on the hotkey editor and all .mel script just saved on server

the main question is run MEL script on the "//server/scriptLib/" when maya startup and just call the global proc on the MEL script

thanks..
sorry about my english and sorry if my question is to long

djx

11 November 2012, 05:31 AM

Sourcing a script and running a script is not the same thing. But it is confusing because some scripts need to be sourced to make them run, and others do not. It depends on how the script was written.

Setting MAYA_SCRIPT_PATH in Maya.env is a good start. Maya will "see" all the scripts in those folders.

There is a special script called userSetup.mel that maya will run when it starts up. You can put mel commands in userSetup.mel and they will run at startup. For example you could source other scripts. Or you could run other scripts. Or both.

If a script called myScript.mel contains a global procedure called myScript() then you do not need to source it, as long as it is in the MAYA_SCRIPT_PATH. When a script is written like this you can just run it using its name (without the .mel) because it matches the name of the global proc. So you can put "myScript;" (no quotes) in userSetup.mel and maya will run it at startup.

If another script called myOtherScript.mel does NOT have a global proc called myOtherScript() then you can NOT run it by simply typing its name. You need to source it first. Depending on how that script was written, sourcing it may also run it or it may not (this is why it is confusing). If you wrote the script yourself then you probably know what to expect. If you downloaded it, then you will either need instructions on how to run it, or you will need to inspect the code and work it out for yourself.

David

ginanjarlilLuNaTiC

11 November 2012, 06:53 AM

thanks djx...
but it still error.

i'm already add MAYA_SCRIPT_PATH = \\server\scriptLib\

than i've script and naming it with hotkeySelectAll.mel inside \\server\scriptLib\
and inside hotkeySelectAll.mel i'm writing this code

You can't have more than one assignment to your environment variables inside Maya.env. Only the first one works, the others don't get evaluated at all. So you'll have to stick everything into a single line.

ginanjarlilLuNaTiC

11 November 2012, 12:15 PM

You can't have more than one assignment to your environment variables inside Maya.env. Only the first one works, the others don't get evaluated at all. So you'll have to stick everything into a single line.

Follow Us On:

The CGSociety

The CGSociety is the most respected and accessible global organization for creative digital artists. The CGS supports artists at every level by offering a range of services to connect, inform, educate and promote digital artists worldwide. More about us on TheArtSociety.com