ScriptSpot

Forum topic · General Scripting

Changing JPG output name of my rendered files.

By Katsude · 2009-10-27

Description

Hi everyone,
I know nothing about in maxscripting and I come here to get a little of help for a doing a little script that can save my life.
Can someone put in a correct maxscript language this?
The aim of this little scripting is changing the name of my outputfilename while i render a specific and animated frame corresponding to each situation.

var i,j,k;
For i = 0 to 12 /* nb of material animated
For j = 0 to 4 /* nb of cam animated
For k = 0 to 16 /* nb of objects animated
{
renderFrame (k+(k*i)+((k*i)*j));
rendOutputFilename ( file_"i"_"j"_"k".jpg);
SaveFile (file_"i"_"j"_"k".jpg);
}

Thanks a lot for the help.
Katsude.

Comments (1)

Anubis · 2009-10-28

Hi Katsude,
I'll try to help you. First - indexed variable in FOR loops not needed to be declared, and in MXS you can of course start loops from 0 but not mandatory. if I understand correct, you need triple FOR loops like:

for i = 1 to 11 do
(
	for j = 1 to 3 do
	(
		for k = 1 to 15 do
		(
			-- render procedure code here ...
		)
	)
)

Its a good to read more about render() function in MaxScript Reference. render() has many arguments. For example next code will render frame 3 and save the JPG file to "temp" folder:

render frame:3 outputfile:("C:\\temp\\" + "test.jpg")

outputfile must be a string and the path must be valid (ie in this case "temp" folder must exist). So shortly, you need to convert to string your file name.

(
	-- render procedure code:
	fname = (i as string) + "_" + (j as string) + "_" + (k as string) + ".jpg"
	render frame:(k+(k*i)+((k*i)*j)) outputfile:("C:\\temp" + "/" + fname) 
)

I hope this help.