# -*- coding: utf-8 -*- ''' :Title Insert Page Template :Author Flying Meat :Website http://flyingmeat.com/ :Planguage Python :Requires VoodooPad 4+ :Description The '<# #>' text are placeholders, and you can use the keyboard shortcut cmd-/ to automatically select those. EOD ''' VPScriptMenuTitle = "Insert Page Template" import AppKit def main(windowController, *args, **kwargs): document = windowController.document() textView = windowController.textView() template = ''' Last updated: ----- Background: <# #> ----- Objective <# #> ----- Current status: <# #> ----- Timeline: <# #> ----- Results: <# #> ----- Linked Documents:''' # wrapping our change in shouldChangeTextInRange_replacementString_ + didChangeText # allows for free undo support if textView.shouldChangeTextInRange_replacementString_(textView.selectedRange(), None): textView.textStorage().mutableString().appendString_(template) textView.didChangeText()