Inkscape.org
Beyond the Basics split line for multiple action commands
  1. #1
    christian.k christian.k @christian.k

    I'm writing a Windows batch file to perform multiple actions on one single input file. As I have quite a lot of action commands and reading the code is already difficult, I was looking for a way to split the long command line in my bat-file into multiple lines, but couldn't find a solution to this. Therefore my question: Is there a way to write e.g.

    inkscape --batch-process --actions="select-by-element:rect;select-by-element:ellipse;SelectionSymDiff;export-filename:out1.png;export-do;select-clear;select-by-element:path;select-by-element:text;SelectionDiff;export-filename:out2.png;export-do;" action_test.svg

    like

    inkscape --batch-process --actions="select-by-element:rect;
                                        select-by-element:ellipse;
                                        SelectionSymDiff;
                                        export-filename:out1.png;
                                        export-do;select-clear;
                                        select-by-element:path;
                                        select-by-element:text;
                                        SelectionDiff;
                                        export-filename:out2.png;
                                        export-do;" action_test.svg

    I tried a caret (^) at the end of each line, but Inkscape didn't accept that. I would be grateful for any help!

  2. #2
    inklinea inklinea @inklinea⛰️

    inkscape ^

    --query-all ^

    drawing.svg

    Space before the caret ? 

  3. #3
    christian.k christian.k @christian.k

    Thank you very much for your reply! Actually I tried a space before the caret but I only get

    Unable to find: ^
    verbs_action: Invalid verb: ^

     

  4. #4
    inklinea inklinea @inklinea⛰️

    Looks like the batch file needs " to be escaped

    https://www.robvanderwoude.com/escapechars.php

    IF %1.==. GOTO Endblock

    :Block1
    inkscape --batch-process --actions=""^
    select-by-element:text;^
    EditInvertInAllLayers;^
    object-set-property:stroke,red;^
    object-set-property:fill-opacity,0.3;^
    export-do;""^
     %1
    :Endblock

    Then

    my_batch_file.bat drawing.svg

    Works for me on Windows 10

     

     

     

     

  5. #5
    christian.k christian.k @christian.k

    Thank you very much for your help! Your script is working perfectly fine on my computer! When I try the same with my script I get lots of errors. However, when I remove all carets and put all verbs on one line it works!? Obviously, with my script the problem must be somewhere else and I have to think that over again. I hope I will be able to figure that out.

  6. #6
    christian.k christian.k @christian.k

    I think I found the problem in my batch file. I had spaces between the individual verb-commands on my single line version and also in the export-file name. After removing these spaces the script worked with the split lines! Thank you again for the very helpful hints!

Inkscape Inkscape.org Inkscape Forum Beyond the Basics split line for multiple action commands