I only have one layout to print per drawing, so if you have more, then you will need to change the code. Right now it just prints whatever layout it opens up into. It is written in lisp, and uses a dcl. Let me know if it doesn't work, I think it should just fine though.
Right now it will close the last drawing, and leave it blank if you has sdi = 0, but if you don't then it will try to open up a drawing from my hd, so you will have to change the last portion of the code. I think this is the only thing you should have to change.
(if DidPlot
(if (equal oldSdi 0)
(command "_.vbastmt" (strcat "documents.item \(\"" (getvar "dwgname") "\"\).close(False)"))
(progn
(command "_.vbastmt" "AcadApplication.ActiveDocument.New \(\"c:/custom/drawings/3m-pics-start.dwg\"\)")
(command "_Yes")
)
)
)