Inkscape.org
Beyond the Basics Command line startup problems
  1. #1
    Ellen Wasbø Ellen Wasbø @EllenWasbo

    I have a case where I'd like to test the command line option in Inkscape, but I fail from the start block.

    I am on Windows 11 using Inkscape 1.3 downloaded as .7z to have parallell version installed. This is what I have tried:

    in cmd.exe

    cd <...path to v1.3...>\bin

    inkscape --help (nothing happen, neither with --? nor with --verb-list or --shell)

    inkscape (start the gui version)

    in PowerShell:

    seems to tell me to use .\inkscape.exe instead of inkscape and this start the GUI, but adding tokens give ParserError

     

    What am I doing wrong?

  2. #2
    inklinea inklinea @inklinea⛰️

    Can you try using inkscapecom (assuming you have added inkscape you to your path during installation  )

    I don't use windows that often - but it seems this change was made 1.2-->1.3

    typing inkscape runs silently 

  3. #3
    Ellen Wasbø Ellen Wasbø @EllenWasbo

    Thanks - that seems to be the trick to get me startet. 👍

    At least inkscapecom --help gave the expected result of information and I realize that --verb-list is outdated.

  4. #4
    inklinea inklinea @inklinea⛰️

    If you need a sample command line to do something, just post :)

    It's actions only now ( and there are a couple of extra options for pdf etc )

     

  5. #5
    Ellen Wasbø Ellen Wasbø @EllenWasbo

    A sample command would be luxurious.

    This is my case: I have a multi-page document with printable numbered labels where each label should have a specific text on it. I have cloned this text so I only need to change it in one text object. With a single page I could use the export and just edit that text, edit the filename accordingly and press Export. When I found out that I would need more labels per file = more than one page, export options did not work well with multi-page (at least I could not find how to not end up with one combined page). So then I was back to the more cumbersome "Save copy as" pdf. This is more mouse clicks including the need to select file type as pdf each time + more clicks.

    So from command line I would like to input the cloned text for each new file and save copy as pdf with filename equal to the input text + some standard string.

    I guess that would be someting like:

    inkscapecom (open original file) (change text in text object with id="text1" to "XXX") (save copy as pdf with filename "XXX_labels.pdf")

    Ideally I would like to input a list of XXX values and loop through these. Is that possible too?

    Any pointing me in the right direction would be appreciated. 

  6. #6
    inklinea inklinea @inklinea⛰️
    *

    Is it something which absolutely has to be done via the command line ( I presume that you want to use powershell ). ? 

    The reason being, this is an easy task for a python extension. Input svg file selection widget, input csv file widget or user list in the extension window. Output folder selection widget. 

    All to a temp folder, then Inkscape command call svg-->pdf with custom name. 

    ----------------

    For the command line solution.

    Inkscape has `object-set-attribute` to set an attribute and `object-set-property` to set a style property.

    However, text is not an attribute or a property. It is a text node. So cannot be changed in this way.

    It would require some powershell code to edit the xml node ( which is totally doable without 3rd party tools )

    ----------------------

    Another option might be to just make the first label a variable using the https://inkscape.org/~Moini/%E2%98%85nextgenerator-replace-export

    --------

    Let me know what you think - see if I can come up with  something 

     

  7. #7
    Ellen Wasbø Ellen Wasbø @EllenWasbo

    The NextGenerator sounds like the perfect option for this case. Thanks for pointing me to it.

     I was not motivated to create an extension just for this short-term need and hopet it would be a chance to test out command line functionalities. I guess I will leave that for another task and go for the NextGenerator extension.

Inkscape Inkscape.org Inkscape Forum Beyond the Basics Command line startup problems