I need some help to make this script work properly

the script as fallows

(
--I want this script to run automatically each time I save a bitmap file from rendered frame window or from render setup dialog
--I also want this script to write  only one file when sequence of images are  rendered
OutputText = (createFile "C://temp/output.txt")
-- I want to  save the output.txt to render output folder	
-- I want to give output.txt same name with Render Output file name 
 
 
Rend = classof renderers.current
format  "Renderer= % \n" Rend to:OutputText
if rendSaveFile== true then 
(
Renderoutput = rendOutputFilename
format  "RenderOutput= % \n" Renderoutput to:OutputText
)
if maxFileName !="" then
(
mpath = maxFilePath 
mname = MaxFileName
	format "maxfilepath= %% \n\n" mpath mname to:OutputText
)	
	close OutputText
 
)

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
savascetin's picture

Thanks again

Thanks again Barigazy but I couldn't find a method for accessing virtual frame buffer's save button.I think I will cancel doing it.
I also need help for accessing list of loaded plugins.

barigazy's picture

You do not understand my

You do not understand my answer for you #2 question
You need to chack first previous created *.txt file if exist or not
(use "if doesFileExist filename do...").
Then you need to grab only the file name and change it prefix
Let say you file have name "output0001.txt", next what you need to do is to change it to "output0002.txt".That i post that link about incremental save to see some string methods and not to use whole code.Try with this and post your result later/
Tip: better add prefixes in form "_0001"
example>>

fileStr = "output_0001"
splitArr = filterstring fileStr "_"
splitArr[2] = formattedPrint ((splitArr[2] as integer)+1) format:"4.4d"
newname = splitArr[1]+"_"+splitArr[2]

barigazy

savascetin's picture

Hi Barigazy

The problem with quick render is not with incremental output text file name. The scripts saves the oputput text, with the name of the image, given in the "render setup" dialog. When I press F9 and take a quick render I want to save a .txt file with the same name of the image saved from "rendered frame window"'s save image button.(I am sorry for the confusing description :). I have attached an image of the button). The method I cannot find is about that button.
Thank you for your concern.

AttachmentSize
rendered_frame_window.jpg 89.21 KB
barigazy's picture

I did not have the time to

I did not have the time to test this but I hope I have given you the right direction.Save this in maxroot>scripts>startup folder.
Try this and tell me it is works for you

callbacks.removescripts id:#test
fn renderJob =
(
	renderPath = if (rof = rendOutputFilename) == "" then @"C:\temp\output.txt" else (getFilenamePath rof+"\\"+getFilenameFile rof+".txt")
	OutputText = (createFile renderPath)
 
	Rend = classof renderers.current
	format  "Renderer= % \n" Rend to:OutputText
	if rendSaveFile== true then 
	(
		Renderoutput = rendOutputFilename
		format  "RenderOutput= % \n" Renderoutput to:OutputText
	)
	if maxFileName !="" then
	(
		mpath = maxFilePath 
		mname = MaxFileName
		format "maxfilepath= %% \n\n" mpath mname to:OutputText
	)	
	close OutputText
)
callbacks.addScript #postRender "renderJob()" id:#test

barigazy

savascetin's picture

Thank you for your quick reply

Thank You For Your quick reply.It works perfectly. I have couple of questions

1.How can I add rendered camera name to the output file.
2. Is there a way to write a different output text for images rendered by pressing f9 (with the same name given to image file)
edit=
3. I havent tried on net render but how will this script react to network render
(should i have to add this script to all machines in the network)

barigazy's picture

:)

#1. to get a name of rendered Camera
 
rendCam = if (viewport.IsPerspView() and viewport.GetCamera() != undefined) do (viewport.GetCamera()).name

#2. write a different output text
Look at this threat http://www.scriptspot.com/forums/3ds-max/general-scripting/save-max-file...
Anubis writte a nice method for incremental save.
First check if file exist then grab the name and add different prefix. Or something like that.

#3. Probably

barigazy

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.