Provide scriptable method of saving files

Bug #361237 reported by Aurium
50
This bug affects 11 people
Affects Status Importance Assigned to Milestone
Inkscape
Confirmed
Wishlist
Unassigned

Bug Description

The FileSaveAs verb now is opening the "Save As" dialog. It is not really useful for scripting with inkscape.

I propose to use the ":" as a separator for verbs that accept (or may accept) parameters, as the FileSaveAs.
We may use a command line like that:

inkscape -z --select=boll --select=rect --verb=SelectionDiff --verb=FileSaveAs:new.svg original.svg

The current FileSaveAs may be called as DialogFileSaveAs.
And, when we don't set the file name parameter, the FileSaveAs may call the DialogFileSaveAs.

It will be useful for some others verbs and will allow new ones like "SetTransform". ;-)

Tags: cli saving
su_v (suv-lp)
tags: added: cli
Changed in inkscape:
importance: Undecided → Wishlist
Revision history for this message
Krzysztof Kosinski (tweenk) wrote :

The problem is not FileSaveAs, but calling verbs from the command line. This is just awful.

Verbs are not designed to take parameters, by the way.

The proper solution is providing appropriate methods in the D-Bus scripting API that was written during this year's GSoC.

summary: - verb FileSaveAs must accept a file name parameter in the command line
+ Provide scriptable method of saving files
Revision history for this message
Krzysztof Kosinski (tweenk) wrote :

BTW I do not blame users for using this, but our developers for exposing this hack as a legitimate feature.

Revision history for this message
su_v (suv-lp) wrote :

related to bug #168616 “running FileSave verb from command line doesn't work”?

jazzynico (jazzynico)
Changed in inkscape:
status: New → Confirmed
tags: added: saving
Revision history for this message
quent57 (quent57) wrote :

This command line tool is a bit verbose but is usefull for scripting operations on svg.

Maybe operation on svg with inkscape should be an inkscape extension, but CLI is faster for an single and small operation.

Revision history for this message
Édouard Lopez (edouard-lopez) wrote :

I support the idea of having parameters to verbs, particularly on verb such FileSaveAs/FileSaveCopyAs (expected behavior is to provide a filename here).

BTW, the man page is also confusing as it state:

    inkscape [options] [filename ...]

and provide an option to specify input file (ok, I didn't read the last part)

    -f FILENAME, --file=FILENAME
                   Open specified document(s). Option string may be omitted, i.e. you can list the filenames without -f

So I run (WRONGLY):

    inkscape -z -f ./䖠-x45A0.svg --select=hanzi --select=pinyin --verb=SelectionUnion --verb=FileSaveCopyAs --verb=FileClose test-union-cli.svg

And got following error:

    ** (inkscape:27462): CRITICAL *: Inkscape::XML::Document sp_repr_read_file(const gchar*, const gchar*): assertion `Inkscape::IO::file_test( filename, G_FILE_TEST_EXISTS )' failed
    ** (inkscape:27462): CRITICAL *: Inkscape::XML::Document sp_repr_read_file(const gchar*, const gchar*): assertion `Inkscape::IO::file_test( filename, G_FILE_TEST_EXISTS )' failed
    ** (inkscape:27462): WARNING **: Specified document test-union-cli.svg cannot be opened (does not exist or not a valid SVG file)

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.