Quantcast
Channel: DEVONtechnologies Community - Latest posts
Viewing all articles
Browse latest Browse all 16117

Importing Data into Custom Metadata Fields

$
0
0

For completeness sake (and because I posted stupid things before), a corrected version of the script

(() => {
  const app = Application("DEVONthink 3");
  const docWindow = app.viewerWindows()[0];
  const rowCount = docWindow.numberOfRows();
  const columnCount = docWindow.numberOfColumns();
  for (let i = 1; i <= rowCount; i++) {
    const name = docWindow.getCellAt({column: columnCount-1, row:i});
	const cite = docWindow.getCellAt({column: columnCount, row:i});
	const targetRec = app.search(`filename: "${name}"`);
	if (targetRec.length > 0) {
	  app.addCustomMetaData(cite, {for: 'cite', to: targetRec[0]});
	}
  }
})()

This version starts out from the first row of the CSV and uses the filename to search for the … well, filename.


Viewing all articles
Browse latest Browse all 16117

Trending Articles