View Full Version : Throw an error on missing Start up Script

04 April 2008, 09:09 PM
I have a startup script that performs some operations using the prerender callbacks. My problem is that through backburner if that startup script is missing on a particular machine it will still render the frames, however, inaccurately. Is there a way to check for the script and cancel the job if it doesn't exist. Much like a missing plugin would do.


04 April 2008, 09:19 PM
From Maxscript Help:

getFileSize <filename_string>

Returns the size of the specified file in bytes. Returns 0 if the file could not be found.

04 April 2008, 09:23 PM
Another approach, also from the maxScript help:

doesFileExist <filename_string>
Returns true if the file exists, false otherwise.

04 April 2008, 11:58 PM
Ok so where would I put this. Remember this is for render machines on backburner. How would I get the machine to execute this command. I'm guessing it would have to be saved with the file as a persistent global callback (if possible) or something, that runs when the file is opened on the render machine. Then it would have to tell backburner that the frame couldn't render and to take the machine off the job.

Hope this makes sense.


04 April 2008, 12:04 AM
I would recommend against the filesize method. I used it extensively in a script and it failed on occasion to identify that a file didn't exist.

04 April 2008, 02:37 PM
hi rod,

are you using mental ray? you can use the scripts section of the renderer to specify a script containing your operations to be performed before (or after if you like) the render starts.

If you put this script on a network location that all machines can see then it will be immaterial whether it is a startup script, or on the machine in question - backburner will look for the prerender script in the network location, perform the tweaks and render.

no need to specify the prerender callback, or looking if a file exists. just put the script commands in the file.

04 April 2008, 03:31 PM
You could put the #preRender Callback into the scene file prior to submital using the persistent function..

Callbacks.AddScript #preRender ("< your Script >") id:MyScript Persistent:true
Callbacks.AddScript #preRender ("filein \"\"") id:MyScript Persistent:true

Where is in a shared location...

The persistent true allows you to have unique scripts per submital...

CGTalk Moderation
04 April 2008, 03:31 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.