|FS • VoodooPad: Lua Plugin Snippets|
Lua Plugin Snippets
Besides these examples, you'll want to read http://flyingmeat.com/fs/contrib/voodoopad/VPPlugin.h for information on what is available. It's just an Objective-C header file, but it's what we've got to go on for now :)
List all the page names in the current document to the current page.
Creating a new page named "Lua Rocks"
Printing out the contents of the index page
Lookup the page data for the current page, and change it's contents.
(Note: this is not undoable)
Tell the text view to select all, and then insert the text "Hi".
Display a dialog box.
This example displays a dialog box with a default button that says "Go Away"
Highlight the selected text yellow.
(this will work best as a plugin, since the Run as Lua Script option deselects the currently selected text before running the script)
Change the font for the current page to Monaco 10
Change the font for the current selection.
List all the pages in the document with a meta value named "todo".
(Metas are a feature only available in VoodooPad Pro)
Look for the word "@todo" in all the pages, and list page name with the line.
Reveal document in Finder (uses AppleScript + Lua)
Make a new page with the selected text, without opening it.
Commit changes to subversion
Subversion is a version control system. If you already have your document in a subversion repository this script will add new files, remove deleted files, and commit the changes. To learn more about subversion, visit http://subversion.org/