PDA

View Full Version : Script to assist users in exchanging materials


JeffPatton
12-16-2007, 09:00 PM
I'm wanting to create a script that will assist users in sharing materials. I think overall the script will act similar to the resource collector utility.

In a nutshell, I want to give users the option of taking a material from the MEDIT, package it into a .mat file. Users would also have the option of including any associated texture bitmaps. Then the .mat file & texture maps would be added to a .zip archive and that .zip file would be placed in a folder along with a render of the material for easy posting purposes.

I have no existing experience with scripting in Max, so I'm not sure how difficult this will actually be. I'm posting here looking for advice on what commands in the max script reference material I need to explore in order for this to become a reality. Or if anyone knows of an existing script that does this, or an "easy" way to do it, please let me know!

Thanks in advance for any help!

ypuech
12-16-2007, 10:00 PM
To create a material library file you can look at "MaterialLibrary Values" in the MAXScript Reference.
It's also possible to create a zip archive using maz/unmaz commands (see "Maz() / UnMaz()
" in the Reference). Or you can call your favourite zip software by the command line using DOSCommand ("Executing External Commands and Programs").

I think it's a simple (and useful) script to develop even if you are a beginner because it doesn't deal with complex data.

RustyKnight
12-16-2007, 10:38 PM
To create a material library file you can look at "MaterialLibrary Values" in the MAXScript Reference.
It's also possible to create a zip archive using maz/unmaz commands (see "Maz() / UnMaz()
" in the Reference). Or you can call your favourite zip software by the command line using DOSCommand ("Executing External Commands and Programs").

I think it's a simple (and useful) script to develop even if you are a beginner because it doesn't deal with complex data.DosCOmmand has issues, if i recall, you'd be better of trying shellcommand, but that's just my opinion

Shane

MoonDoggie
12-17-2007, 12:32 AM
I've also had problems with DOSCommand, as shane suggested, shellLaunch works better, also this kind of thing shouldn't be too hard to do at all.

scorpion007
12-17-2007, 02:45 AM
What issues were you having with DosCommand?

RustyKnight
12-17-2007, 02:48 AM
What issues were you having with DosCommand?Check here for particulars

http://forums.cgsociety.org/showthread.php?f=98&t=548850&highlight=doscommand

scorpion007
12-17-2007, 05:01 AM
Had a look at that thread, can't reproduce your problems. Works for me.

Despite the fact that you shouldn't hardcode absolute paths into your dos commands, I did so to make the test more valid.

Here was my test, that executed successfully.

doscommand "\"D:\\Program Files\\7-Zip\\7z.exe\" a D:\\TEMP\\arc.7z D:\\TEMP\\file.txt && pause"

This zips the file D:\TEMP\file.txt into the archive D:\TEMP\arc.7z using 7zip. All works.

One thing you have to understand is, the CMD interpreter treats a space as the end of a token (or command line argument) and the beginning of a new one. So if you use a path containing a space, like "Program Files", you need to enclose the entire path in quotes.
I.e. "C:\Program Files\Blah\Prog.exe". (But the executable should be in your %PATH% anyway so you don't use absolute paths.)

I really shouldn't be going off topic in this thread so I'll leave it at that. Sorry Jeff.

JeffPatton
12-17-2007, 02:13 PM
Thanks for the info guys. I'll start reading through the documentation to learn more about the commands you mentioned. :thumbsup:

CGTalk Moderation
12-17-2007, 02:13 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.