Mimsy Were the Borogoves

Hacks: Articles about programming in Python, Perl, PHP, and whatever else I happen to feel like hacking at.

42 Astoundingly Useful Scripts and Automations for the Macintosh

Work faster and more reliably. Add actions to the services menu and the menu bar, and create drag-and-drop apps to make your Macintosh play music, roll dice, and talk. Create ASCII art from photos. There’s a script for all of that in 42 Astounding Scripts for the Macintosh.

Get element by id in Inkscape

Jerry Stratton, April 24, 2010

If you’re automating the change of an Inkscape image, you often will know the Id of the element(s) you want to change.

Normally in XML, you would get the root node and use getElementById on that node. Apparently that’s not how Python does things, so Inkscape adds a getElementById method to the inkex.Effect class.

[toggle code]

  • class DuplicateMultiple(inkex.Effect):
    • def effect(self):
      • #get the logo
      • logo = self.getElementById('hoboLogo')
      • #do stuff to the logo

You can use “set” to set the style, transform, or other attributes of the Inkscape object, or anything else you would normally do to a selected node in your Inkscape effect.

  1. <- SQLite duplicate strings
  2. Maven: SQLite front end ->