Scripting question - name of input file available

Asked by Steve Ylvisaker on 2010-06-07

We are wanting to write a script that will automatically "checkin" the file,currently open Inkscape, to our content management system. We tried but gave up doing this with version 0.46 because the file name was not available to the scripting language. Has this changed with 0.47. In other words, if I open the file steve-001.svg in inkscape can my script know the name steve-001.svg for its processing? If so - hints on how to do so would be appreciated.

Steve

Question information

Language:
English Edit question
Status:
Answered
For:
Inkscape Edit question
Assignee:
No assignee Edit question
Last query:
2010-06-07
Last reply:
2010-06-24
Launchpad Janitor (janitor) said : #1

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

jazzynico (jazzynico) said : #2

Hi Steve,

The file name is stored in the sodipodi:docname attribute of the <svg> element. That's something you could easily access from your python script. You can use inkex (import inkex.py first!) and:

doc= self.document.getroot()
docname=doc.get(inkex.addNS('docname','sodipodi'))

AFAIK, it already worked in 0.46.

Regards.

Can you help with this problem?

Provide an answer of your own, or ask Steve Ylvisaker for more information if necessary.

To post a message you must log in.