Flying Meat

VoodooPad Bookmarklets


VoodooPad 4.2.3 has support for running JavaScript and JSTalk bookmarklets.  A bookmarklet is a specially formatted URL, which begins with either javascript: or jstalk: and then is followed by a script written in JavaScript (or JSTalk).  Here's an example bookmarklet:


javascript:print("Hello World!");


Copy that text script, open up a page in VoodooPad, select some text, and add your bookmarklet using the  Format ▸ Add Link…   menu item.  The text you've selected should then become a link, and when you click on it, you will see a little window come up that looks similar to this:


Pasted Graphic 1.tiff



Of course, your bookmarklets can be a lot more complicated than this.  Since the bookmarklets are written using a variant of JavaScript called JSTalk, you can use it to open up a couple of applications:


javascript:

SBApplication.application("QuickTime Player").activate();

SBApplication.application("Safari").activate();


(Don't forget to copy the first line, which starts with "javascript:", so VoodooPad knows what to do with the URL).


Here's an example, that will print out all the names of the pages in your VoodooPad document:


javascript:

document = windowController.document();


var pageKeys = document.keys();


for (i = 0; i < pageKeys.count(); i++) {

    var key  = pageKeys[i];

    var page = document.pageForKey_(key);

    print(page.displayName());

}


As a shortcut to making bookmarklets, you can also paste your script into a VoodooPad page, select it, and then choose the  JSTalk ▸ Copy as JSTalk Bookmarklet  menu item.  Then just paste and your link will be created automatically.


Pro Tip: You can turn use bookmarklets in the  Edit ▸ Make Custom URL Link…  sheet.  Just make sure to use the  JSTalk ▸ Copy as JSTalk Bookmarklet  menu item first, so that the characters are escaped correctly.





» Back to the start page or Download this site as a VoodooPad document