# -*- coding: utf-8 -*- ''' :Title Make Page from Selection Without Opening :Author Flying Meat :Website http://flyingmeat.com/ :Planguage Python :Requires VoodooPad 3.5+ :Description Select some text, and have VoodooPad make a new page from the text, but without opening the page. EOD ''' VPScriptSuperMenuTitle = None VPScriptMenuTitle = "Make Page from Selection Without Opening" def main(windowController, *args, **kwargs): document = windowController.document() textView = windowController.textView() pageName = textView.textStorage().string().substringWithRange_(textView.selectedRange()) if len(pageName) == 0: print("Sorry, blank words are not allowed") else: document.createNewPageWithName_(pageName)