Inkscape over command line (problem using verbs)

Post questions on how to use or achieve an effect in Inkscape.
alnilam
Posts: 2
Joined: Tue Sep 16, 2008 5:00 pm

Inkscape over command line (problem using verbs)

Postby alnilam » Tue Sep 16, 2008 5:13 pm

Hello,

I would like to use inkscape to change some things in a large amount of SVG graphics. So I wrote a little perl script that searches for SVG files in the given directory and calls inkscape over the command line for every SVG file. I use verbs to to do the following:
- select everything in the file (verb=EditSelectAll)
- ungroup it (verb=SelectionUnGroup)
- convert all strokes to paths (verb=StrokeToPath)
- save file (verb=FileSave)
- close file (verb=FileClose)

The line of my perl script looks like this:
system ("inkscape $filename --verb=EditSelectAll --verb=SelectionUnGroup --verb=StrokeToPath --verb=FileSave --verb=FileClose");

But this only changes the very small svg files. So I suspect, that the verbs don't "wait" for the previous verb to finish, i.e. the file is saved and closed before the ungrouping or "stroke-to-path" is finished.

Is this a bug? Should every verb wait until the previous one is finished? Or is there any other way to achieve what I am trying to do?

My system is Win XP, using inkscape 0.46

DannyKing
Posts: 122
Joined: Sat Jan 26, 2008 2:58 am
Location: UK
Contact:

Re: Inkscape over command line (problem using verbs)

Postby DannyKing » Tue Sep 16, 2008 5:38 pm

I'm not sure if the verbs wait to finish or not, but have you tried manually looking inside the troublesome svgs? Perhaps they have layers that are locked or something?
Image

alnilam
Posts: 2
Joined: Tue Sep 16, 2008 5:00 pm

Re: Inkscape over command line (problem using verbs)

Postby alnilam » Tue Sep 16, 2008 7:17 pm

Thanks for your quick reply! My SVG files are also generated by a perl script. They are quite simple and only contain several groups with some paths in each group. like this:

Code: Select all

<g id="paths1">
   <path d="M 100,50 L 400,50" id="line01" style="fill:none;stroke:#ccc;stroke-width:20;stroke-opacity:1;opacity:1;" />
   <path d="M 100,150 L 400,150" id="line02" style="fill:none;stroke:#ccc;stroke-width:20;stroke-opacity:1;opacity:1;" />
   <path d="M 100,250 L 400,250" id="line03" style="fill:none;stroke:#ccc;stroke-width:20;stroke-opacity:1;opacity:1;" />
   <path d="M 100,350 L 400,350" id="line04" style="fill:none;stroke:#ccc;stroke-width:20;stroke-opacity:1;opacity:1;" />
   <path d="M 100,450 L 400,450" id="line05" style="fill:none;stroke:#ccc;stroke-width:20;stroke-opacity:1;opacity:1;" />
</g>

There are no layers that could be locked.

I also tried changing my perl script to start inkscape with a gui and removed the verb that closes the file:

Code: Select all

    system ("inkscape -g $filename --verb=EditSelectAll --verb=SelectionUnGroup --verb=StrokeToPath --verb=FileSave");


When I manually close every file then they are saved correctly. Therefore I think it has something to do with the verb FileClose comming too early (before the saving is done)


Return to “Help with using Inkscape”