Gateway Timer Scripts troubleshooting

Please see Wiki - how to post code on this forum. Can you edit your original post to fix the code blocks? You've lost all the indentation and any lines starting with # have been converted to headings by the Markdown converter. (You should have noticed this in the post preview.) Thanks.