Copy link to clipboard
Copied
Hello world!
I am working on a project and had an idea I was wondering if it would be possible to accomplish with indesign / javascript. I currently have a script that creates files and adds a time-stamp, a name of who created the file, and some other variables in a footer section of the document. I got to thinking, that since all of those variables are already recorded if there was a way to have a script export these strings to a XML file to create a library of all documents that were created, when, by whom, etc. Is there a way to record specific object contents into an XML database? I am scripting for a business and it would a massive tool for us were we able to see all of this data in a single clean database that is done by a computer as opposed to the short hand, hand written, often incomplete notes we have now. I am open to any and all ideas suggestions, etc!
Hi there,
I don’t quite understand why you decided to keep this info in the footer section of the document; you must have a good reason for this: maybe you need to print it, or you already have loads of such documents and have to deal with what you have. But if I were you, I’d keep it in metadata because of the following reasons:
Copy link to clipboard
Copied
Here is a function of mine that writes the data from a variable to an xml file. You would probably have to play with the formatting some because mine is a simple one line xml file that I am writing but that shouldn't be hard to do.
function breakWrite(){
breakPointXml.open('r');
breakPointXmlRead=breakPointXml.read();
breakPointXml.close;
var breakPointXmlObj = new XML(breakPoint);
breakPointXmlObj2 = new File();
breakPointXmlObj2.open('w');
breakPointXmlObj2.write(breakPointXmlObj);
breakPointXmlObj2.copy(breakPointXml);
}
Copy link to clipboard
Copied
Thank you so much for your input! I admit this is my first time working with writing XML interactions in javascript, would you mind giving me some notes on how your script works and what the different lines of code are doing?
Copy link to clipboard
Copied
Hi there,
I don’t quite understand why you decided to keep this info in the footer section of the document; you must have a good reason for this: maybe you need to print it, or you already have loads of such documents and have to deal with what you have. But if I were you, I’d keep it in metadata because of the following reasons:
Anyway, if you applied properly a paragraph style (and/or character style), it will be easy to duplicate it to metadata.
Then I would use a really awesome utility created by Phil Harvey called ExifTool to create a CSV-file containing the metadata from all the documents in a certain folder.
For example, to get all XMP info from the files in the "D:\Test" folder I’d type this line:
exiftool -csv -r -xmp:all "D:\Test">"D:\Test\meta out.csv"
ExifTool creates a CSV-file like so:
which can be imported, say, to Excel (or Access, or a database)
Now in Excel, you can see all the info I entered in InDesign:
If necessary, you can export it from Excel as XML-file.
This is one of the few approaches that came to my mind.
Hope this helps.
Regards,
Kas
Copy link to clipboard
Copied
WOW Thank you so much this is what I was looking for! Actually both of those reasons for keeping the footer are correct, I work at a print shop and we not only print all of our files, but have loads of them and keep a physical filing system still (I know -.-). I will do some experimenting and investigation with this but i do believe this is exactly what I had in mind! Much obliged.