Very new to this, so please excuse if this is a stupid question.
Is it possible to work with verbs in the command line shell mode? Every time I try a command with a verb in shell mode, I get an error alerting me that the GUI is required. I tried using --with-gui, but it made no difference.
Here's what I'm seeing:
******************************
c:\Program Files\Inkscape>inkscape --shell
Inkscape 0.92.4 (5da689c313, 2019-01-14) interactive shell mode. Type 'quit' to quit.
>--file="C:/test/test.svg" --verb EditSelectAll
WARNING: ignoring verb EditSelectAll - GUI required for this verb.
I can't answer your question directly, since I don't use (or even understand) using the commandline. But there is a guide, which might have a clue for you (if you didn't already find it).
Unfortunately, the manual doesn't seem to address this. It says: "Each command in shell mode must be a complete valid Inkscape command line but without the Inkscape program name," but the example I mentioned above works outside of shell mode but not inside.
Had a problem with this myself, here are my notes, for Inkscape on Windows 10::
Couldn't get shell to work in MSYS2, so I had to use cmd.exe (Command Prompt)
There are two Inkscape executables: inkscape.exe cannot raise/show shell at all, however inkscape.com can
Below is a snippet; note I have a file saved in C:\tmp\test.svg:
C:\tmp>"C:\Program Files\Inkscape\bin\inkscape.com" --shell
** (org.inkscape.Inkscape:15896): WARNING **: 06:31:51.951: Fonts dir 'C:\Users\Me\AppData\Roaming\inkscape\fonts' does not exist and will be ignored.
Inkscape interactive shell mode. Type 'action-list' to list all actions. Type 'quit' to quit.
Input of the form:
action1:arg1; action2:arg2; verb1; verb2; ...
Only verbs that don't require a desktop may be used.
> actions-list
Unable to find: actions-list
verbs_action: Invalid verb: actions-list
> action-list
action-list : Print a list of actions and exit.
convert-dpi-method : Import DPI convert method.
export-area : Export area.
export-area-drawing : Export drawing area.
export-area-page : Export page area.
export-area-snap : Export snap area to integer values.
export-background : Export background color.
export-background-opacity: Export background opacity.
export-do : Do export.
export-dpi : Export DPI.
export-filename : Export file name.
export-height : Export height.
export-id : Export id(s).
export-id-only : Export id(s) only.
export-ignore-filters: Export ignore filters.
export-latex : Export LaTeX.
export-margin : Export margin.
export-overwrite : Export over-write file.
export-pdf-version : Export PDF version.
export-plain-svg : Export as plain SVG.
export-ps-level : Export PostScript level.
export-text-to-path : Export convert text to paths.
export-type : Export file type.
export-use-hints : Export using saved hints.
export-width : Export width.
file-close : Close active document.
file-new : Open new document using template.
file-open : Open file.
inkscape-version : Print Inkscape version and exit.
...
window-close : Close the active window.
window-open : Open a window for the active document. GUI only.
> inkscape-version
Inkscape 1.0.2-2 (e86c870879, 2021-01-15)
Pango version: 1.48.2
> file-open "test.svg"
Unable to find: file-open "test.svg"
verbs_action: Invalid verb: file-open "test.svg"
> file-open test.svg
Unable to find: file-open test.svg
verbs_action: Invalid verb: file-open test.svg
> file-open:test.svg
WARNING: unknown type: svg:foreignObject
WARNING: unknown type: svg:foreignObject
> query-all;
svg42,0,0,373,223
g32,0,0,373,223
path12,141.5,70,79.9,83
path14,215.796,143.646,15.7082,15.7082
rect16,0,0,143,143
g22,26.4124,63.6235,88.4614,12.584
switch20,26.4124,63.6235,88.4614,12.584
text18,26.4124,63.6235,88.4614,12.584
ellipse24,230,80,143,143
g30,250.747,143.624,99.792,12.584
switch28,250.747,143.624,99.792,12.584
text26,250.747,143.624,99.792,12.584
switch40,95.1177,210.902,182.92,9.67773
a38,95.1177,210.902,182.92,9.67773
text36,95.1177,210.902,182.92,9.67773
> verb-list
FileNew: Create new document from the default template (Ctrl+N)
FileOpen: Open an existing document (Ctrl+O)
FileRevert: Revert to the last saved version of document (changes will be lost)
FileSave: Save document (Ctrl+S)
FileSaveAs: Save document under a new name (Shift+Ctrl+S)
FileSaveACopy: Save a copy of the document under a new name (Shift+Ctrl+Alt+S)
FileSaveTemplate: Save a copy of the document as template
FilePrint: Print document (Ctrl+P)
...
org.ekips.filter.whirl: Whirl...
org.ekips.filter.whirl.noprefs: Whirl (No preferences)
org.inkscape.render.wireframe_sphere: Wireframe Sphere...
org.inkscape.render.wireframe_sphere.noprefs: Wireframe Sphere (No preferences)
> EditSelectAll
WARNING: ignoring verb EditSelectAll - GUI required for this verb.
** (org.inkscape.Inkscape:15896): CRITICAL **: 06:38:14.287: static void Inkscape::EditVerb::perform(SPAction*, void*): assertion 'ensure_desktop_valid(action)' failed
> quit
Now starting Inkscape shell with GUI - note that the GUI windows will be mostly unresponsive; FileSaveAs raises a GUI dialog, that you must use to choose output file name; and quit didn't really work for me: Inkscape froze, so I tried to close the GUI window via [X] window button, and got a dialog to force close the program because it was not responding.
C:\tmp>"C:\Program Files\Inkscape\bin\inkscape.com" --with-gui --shell
** (org.inkscape.Inkscape:15012): WARNING **: 06:38:38.042: Fonts dir 'C:\Users\Me\AppData\Roaming\inkscape\fonts' does not exist and will be ignored.
Inkscape interactive shell mode. Type 'action-list' to list all actions. Type 'quit' to quit.
Input of the form:
action1:arg1; action2:arg2; verb1; verb2; ...
> file-open:test.svg;
WARNING: unknown type: svg:foreignObject
WARNING: unknown type: svg:foreignObject
>
> EditSelectAll;
> org.ekips.filter.whirl.noprefs;
> FileSaveAs;
> quit
The shell mode is not designed to work with the gui at all.
It does not accept verb or actions which require the gui to operate. It also can't be used to interactively send commands to an open gui.
It's real use is to be able to send multiple 'non gui' commands to a single command line instance of Inkscape which can be rapidly executed without opening and closing Inkscape.
If you are using Windows 10 - on this page is an example of a powershell script to send a file list into Inkscape using shell mode.
Very new to this, so please excuse if this is a stupid question.
Is it possible to work with verbs in the command line shell mode? Every time I try a command with a verb in shell mode, I get an error alerting me that the GUI is required. I tried using --with-gui, but it made no difference.
Here's what I'm seeing:
******************************
c:\Program Files\Inkscape>inkscape --shell
Inkscape 0.92.4 (5da689c313, 2019-01-14) interactive shell mode. Type 'quit' to quit.
>--file="C:/test/test.svg" --verb EditSelectAll
WARNING: ignoring verb EditSelectAll - GUI required for this verb.
** (inkscape.exe:13588): CRITICAL **: 12:27:23.064: static void Inkscape::EditVerb::perform(SPAction*, void*): assertion 'ensure_desktop_valid(action)' failed
******************************
The same command works when not in shell mode.
Welcome to the forum!
I can't answer your question directly, since I don't use (or even understand) using the commandline. But there is a guide, which might have a clue for you (if you didn't already find it).
https://inkscape.org/en/doc/inkscape-man.html
Hopefully someone will be along shortly, who can answer directly 🙂
Unfortunately, the manual doesn't seem to address this. It says: "Each command in shell mode must be a complete valid Inkscape command line but without the Inkscape program name," but the example I mentioned above works outside of shell mode but not inside.
Had a problem with this myself, here are my notes, for Inkscape on Windows 10::
cmd.exe
(Command Prompt)inkscape.exe
cannot raise/show shell at all, howeverinkscape.com
canBelow is a snippet; note I have a file saved in
C:\tmp\test.svg
:Now starting Inkscape shell with GUI - note that the GUI windows will be mostly unresponsive;
FileSaveAs
raises a GUI dialog, that you must use to choose output file name; andquit
didn't really work for me: Inkscape froze, so I tried to close the GUI window via [X] window button, and got a dialog to force close the program because it was not responding.The shell mode is not designed to work with the gui at all.
It does not accept verb or actions which require the gui to operate. It also can't be used to interactively send commands to an open gui.
It's real use is to be able to send multiple 'non gui' commands to a single command line instance of Inkscape which can be rapidly executed without opening and closing Inkscape.
If you are using Windows 10 - on this page is an example of a powershell script to send a file list into Inkscape using shell mode.
https://inkscape.org/forums/beyond/passing-a-batch-file-to-inkscape-in-shell-mode/#c26221
Fantastic - many thanks for the response, @inklinea :
Great to have this explicitly stated, I was otherwise always looking for hints (in docs/posts) to the contrary :)
Also thanks for the link - great tip!