I am not sure if anyone had made this before, but it appears to me that this one works as well as any.
The script first creates a .bat file and runs it, and quits blender.
The batch file then renders the file, changes the outputted file’s extension (neccessary on my computer) and then shuts down the computer,
This is very useful for long renders, and it should work only on both windows 98, ME, 2000 and XP.
I have not tested it on XP, so if someone could tell me if it works would be great.
Make sure no other programs are running when you leave the computer for the night.
It works with the standard blender installation directory.
extension = '.jpg' ###### edit this line for output format##########
##### night long render thingy v .0001 by SamAdam ######
import Blender, os, sys
name = Blender.Get('filename')
no = 0
for a in name:
no = no + 1
if a == "\\" :
noslash = no
if a == "." :
noblend = no - 1
filenamebat = "%sautorunblender.bat" % name[:noslash]
fb = open(filenamebat, 'w')
st = 'cd "C:\\Program Files\\Blender Foundation\\Blender"
'
st += 'Blender -b "%s" -f 1
' % name
st += 'cd %srender
' % name[:noslash]
st += 'rename 0001 0001%s
' % extension
st += 'SHUTDOWN -s -t 01
'
st += 'C:\WINDOWS\RUNDLL32 SHELL32.DLL,SHExitWindowsEx 9'
fb.write(st)
fb.close()
os.startfile(filenamebat)
sys.exit()