Inkscape.org
Tips, Tricks, and Tutorials Command Line / Dbus select namespaced attributes
  1. #1
    inklinea inklinea @inklinea⛰️
    *

    The inkscape command line ( and dbus ) has select-by-selector

    In which some ( but not all ) css selectors can be used to select objects https://www.w3schools.com/cssref/css_selectors.php

    To select all paths for example:

    inkscape --actions="select-by-selector:path;select-list" drawing.svg

    Will print a list of all paths at the command prompt ( or select paths on canvas with dbus )

    However - how do you select a namespaced attribute - that is attributes with a colon in the middle

    inkscape --actions="select-by-selector:path[inkscape:connection-end];select-list" drawing.svg

    does not work.

    It turns out you can use backslash, unicode character value and a space

    inkscape --actions="select-by-selector:path[inkscape\3A connection-end];select-list" drawing.svg

    will work :)

    or without a space, but padded with zeros to make it 6 characters:

    inkscape --actions="select-by-selector:path[inkscape\00003Aconnection-end];select-list" drawing.svg

    Tested on Inkscape 1.2

     

     

Inkscape Inkscape.org Inkscape Forum Tips, Tricks, and Tutorials Command Line / Dbus select namespaced attributes