PDA

View Full Version : mac vs pc mel scripts (noob)


trashtalk
11-01-2011, 05:11 AM
Hi all

Is there some great difference between mel scripts for pc vs mac? Should there be some area in the script that I should look at for a mac mel script? They seem to be just text files.

There's a script from a guy that works but he added some feature, saved out another script, but now it gives an error reading file message.

I put the script in this path (/Users/<your user name>/Library/Preferences/Alias/maya/scripts/2011-x64)
Then just double clicked the mel script.

It gives me an" error reading file" message. I also tried typing the command at the end of the script. "//Run Procedure
rogMenu();"

He said it was tested on versions 2010 thru 2012.
The file begins with cs as in "csXxxxxx.mel"

(he hasn't responded as of yet, so I was just asking the best generic question I could, sorry)

thx

NaughtyNathan
11-01-2011, 12:31 PM
you don't "launch" (by double-clicking) MEL scripts on PC and I'm pretty sure you won't need to on Mac either.

Once a script file is in a valid script folder (which yours appears to be) you simply need to source it ("read it into Maya"), then execute the function you want (or execute it directly).

to source a file you simply type:
source "csXxxx.mel";into Maya script editor or MEL command line (where "csXxxx.mel" is the correct name of the script file). You don't need to add a path as Maya will look in all it's script folders (although you can give a full valid path if you want to)
This may or may not do anything immediately, depending on how the script has been written, but either way, the script and all its functions and data is now ready to use.
If there is a known function inside this script file that you want to run, you can now just type it in to execute that function e.g.:
rogMenu;However, every time you restart Maya you will have to go through this entire sourcing process again.

If, on the other hand, the script file had been NAMED: "rogMenu.mel" you would NOT need to source it every time you ran Maya. You would simply type:
rogMenu;whenever you wanted to execute the rogMenu function and Maya would find and source the script file automatically (because it has the same name) then execute the requested function.

finally, Maya caches the names of all scripts in script folders on startup, so if you do copy, move or otherwise edit or change script files/locations while Maya is running you will either have to restart Maya or use the rehash command to make Maya scan for such changes.

:nathaN

tharrell
11-01-2011, 12:39 PM
I'd also suggest putting the script in this path instead of in your library:

/Users/Shared/Autodesk/maya/2011/scripts

I don't think that scripts have been auto-sourced from "Alias" paths for several versions now, and Apple is discouraging users from working inside of their library folders now (/Users/{you}/Library is hidden by default in 10.7+, for better or worse).

--T

trashtalk
11-01-2011, 06:40 PM
Thanks guys.

Update:

I changed the directory again and put them all into my (/Users/Shared/Autodesk/maya/2011/scripts) path. (as a Mac user suggested)

Do I need the other 2 scripts or just the new one "csROG_xxxxx.mel"? Do scripts typically rely on more than one script for functions?

After sourcing "csROG_xxxxx.mel" I get

//Error: Cannot find path for "xxxx/programWindow.mel" for source statement.

rehash; didn't seem to correct this.


The ROG_public.mel file is the only one that brings up the menu palette now. Can it still be pulling functions from the other newest mel script "csROG_xxxxx.mel"?


I also notice that when the public script palette is running, it won't let me hide Maya at all.
If that helps any.


thx

NaughtyNathan
11-01-2011, 10:48 PM
I'm not sure what to suggest from here. You didn't originally mention you had multiple script files, but based on this, and the new stuff you mention it appears that this "suite" of scripts or whatever they are need to be installed or setup in a particular manner (i.e. one script is trying to source another from a sub-folder, or set a sub path which is not present). Unfortunately, there's no real way of us guessing what that is without looking at the script code itself. You'll have to get complete installation/setup instructions from the original author, and if that still doesn't work then the scripts may need a bit of a tweak or rewrite...? It may be down to a difference betwen PC and Mac pathing of some sort, but I'm guessing if the author designed them on a PC he's not going to be able to fix it for a Mac anyway...

:nathaN

trashtalk
11-01-2011, 11:59 PM
I believe its working now.

Now I have progWindow and ROG_public in the "/Users/Shared/Autodesk/maya/2
011/scripts/pete/" folder. Then I have the csROG_xxxxx in the outside "/Users/Shared/Autodesk/maya/2011/scripts/" folder.

"source csROG_xxxxx.mel;" now brings up the palette window, but not other 2. I'm guessing this is how it's supposed to work.


Still doesn't let me hide Maya though.

CGTalk Moderation
11-01-2011, 11:59 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.