How to pass the name of currently open document to extension script

Asked by DavidTalmage

I wanted to post the following question on the forum but the forum link on the http://inkscape.org/ page does not display.

to the question is:

in a python script you can get the name of the temp file passed to python containing the
document.

str(self.document.getroot().get("{http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd}docname"))

how do I get the name of the currently open document. E.g. The name thats on the application title bar.

Seems a bit excessive to search through active task looking for inkscape.exe and find title.

Question information

Language:
English Edit question
Status:
Solved
For:
Inkscape Edit question
Assignee:
No assignee Edit question
Solved by:
su_v
Solved:
Last query:
Last reply:
Revision history for this message
Dean Gardiner (gardiner91) said :
#1

Loads for me,

You could try pinging the server to see if your connection to the server is working by executing 'ping www.inkscapeforum.com'.

Revision history for this message
su_v (suv-lp) said :
#2

> how do I get the name of the currently open document

You can't - if the file has been saved before, the file name is stored in the attribute 'sodipodi:docname' of the top-level <svg> element. But the script has no way to query the full path name to the currently opened document or get it passed as parameter.

> (…) the forum link on the http://inkscape.org/ page does not display.

The bug tracker is not a support forum - Inkscape uses Launchpad's 'Answers' section for this. Else you could always consider writing to one of the mailing lists if the the forum (which is not maintained by the Inkscape project at the moment) is unreachable.

Revision history for this message
Best su_v (suv-lp) said :
#3

OR proposes a solution written in delphi (i.e. not a general solution that would work in Inskcape extensions across platforms), see comment #3 in the linked bug report:
<https://bugs.launchpad.net/inkscape/+bug/661588/comments/3>

Revision history for this message
DavidTalmage (david-junk-mail) said :
#4

Thanks ~suv, that solved my question.