Notifications
Clear all

[Closed] Script to assist users in exchanging materials

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!

7 Replies

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.

1 Reply
(@rustyknight)
Joined: 11 months ago

Posts: 0

DosCOmmand has issues, if i recall, you’d be better of trying shellcommand, but that’s just my opinion

Shane

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.

What issues were you having with DosCommand?

1 Reply
(@rustyknight)
Joined: 11 months ago

Posts: 0

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.

Thanks for the info guys. I’ll start reading through the documentation to learn more about the commands you mentioned.