Add templates to window via script

Welcome to the forum. Please see Wiki - how to post code on this forum. Then you can edit your post (pencil icon) to fix it. It may help someone else in future.