The Shape of Everything
A website mostly about Mac stuff, written by August "Gus" Mueller
» Acorn
» Retrobatch
» Mastodon
» Instagram
» Github
» Maybe Pizza?
» Archives
» Feed
» Micro feed
January 21, 2006
(This post is from my old, old, super old site. My views have changed over the years, hopefully my writing has improved, and there is now more than a handful of folks reading my site. Enjoy.)

Saturday, January 21st, 2006

Jonathan Wight of Toxic Software (super leet programmer extrodonaire++) took up a little project that I wanted to do and wrote a "meta plugin" for VoodooPad that works just like my Lua plugin does. Only for Python, using PyObjC. How cool is that?

Download plugin + source:

It requires VoodooPad 2.5.3, and when installed (double with the click) it installs some examples in: ~/Library/Application Support/VoodooPad/Script PlugIns/ which you can take and copy and use with the full power of PyObjC goodness.

Here's a quick example that just selects the current line:

VPScriptSuperMenuTitle = "Select" VPScriptMenuTitle = "Current Line (python)"

def main(windowController, args, *kwargs):     windowController.textView().selectLine_(None)

It's pretty easy and shows up in the menus as "Plugin->Select->Current Line (python)"

And here's an example that creates a new page with the current date and inserts the link at the current cursor position.

textView = windowController.textView() document = windowController.document() pageName = time.strftime('%Y.%m.%d') document.createNewVPDataWithKey_(pageName) textView.insertText_(pageName)

Thanks Jonathan!

-- posted 5:03 pm