you could:
create a macro that replaces your document with a modified version that includes your header/footer parts (as you do create it yourself in your script), and then just use the "Typeset & View".
add the line "open temptex.pdf"
add your lines of text into the "Typeset & View" command, probably somewhere in: # Compile. Bail out on errors. or in function run_tex()
Daniel
Sorry, don't have the time and energy to do the coding/testing for you ;)