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. Use Perl, Python, AppleScript, Swift, and Automator to automate the drudgery of computer use. Add actions to the services menu and the menu bar, and create drag-and-drop apps.

Use simple scripts and make your Macintosh play music, roll dice, and talk to you. Create ASCII art from your photos. There’s a script for all of that in my new book, 42 Astoundingly Useful Scripts and Automations 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 ->