Create new xml file

Hi,
I’m working a lot with xml files.
would like to extend the context menu so that I can create not only a text file, but also an empty xml file.
Is that possible?

Afaik: no. Wouldn’t a dedicated XML editor new better suited for your task?

of course do I use a xml editor for real editing.
But I would need to create an emty xml in a simple way.
Now I have a folder with empty xml files, and I copy the file in the devonthink folder.
That works, but I have always to open the template folder.

Maybe it is possible to implement a script in the contextmenu, which copies a template file in the viewed folder?

Sure. It’s “group”, btw, in DT, not “folder”. The differentiation is important because groups are not represented in the file system as folders. And also because we don’t know if in

“folder” refers to a file system folder or a DT group. Assuming the first case, I’d do something like this (in JavaScript)

(() => {
  const myXMLTemplate = '/Users/ME/documents/XMLtemplates/theTemplate.xml';
  const app = Application('DEVONthink 3');
  const newXMLFile = app.import(myXMLTemplate, {to: app.currentGroup()});
})()

This is not tested. It should import a file from the file system (as specified in the second line) as a new document into the currently open group.

There is no need for something as complicated as a script.
Data > New From Template > Open Templates Folder.
Drop an empty .xml file in there.

4 Likes

Thank you, that is exactly what I’m looking for :slight_smile:

1 Like