Batch change rtf date and properties (author...)

I would like to batch change dates and properties (author, title…) of rtf files with a pop up dialog to input the changes.

I am using the Change Date applescript included in DT, and an action included by Microsoft Word in Automator -in Nisus Writer there is the following macro that can also change rtf properties:

$filePaths = Choose Files
ForEach $filePath in $filePaths
   $doc = Document.open($filePath)
   $doc.setProperty("author", "James Albrus")
   $doc.setProperty("keywords", "house, dormitory")
   Save
   $doc.close
End

As it happens, I cannot get it to work in Automator, nor can I write an Applescript. Any help, in case you find it of interest for other users of DT?

Nisus uses its own macro language, which will not work with DEVONthink. I believe a DEVONthink record’s custom meta data (including kMDAuthor, aka “Author”) is read only and can be modified in the Properties panel only for those record types that support that meta data element – RTF, PDF.

You could, of course, use KeyboardMaestro or similar to open the documents in Nisus and execute a Nisus macro to make the change. Or edit the property in DEVONthink on a document-by-document basis. Or create a JXA or Python script to handle the change.

FWIW there is probably a JavaScript for Automation (as well as shell xattr) route to reading and setting metadata for a given file path.

(() => {

    ObjC.import('sys/xattr');
    
    // return $.getxattr
    
    return $.setxattr

})();

For arguments of these and related functions, see, for example:
http://nshipster.com/extended-file-attributes/

I have read the good resource you pointed at, thank you. Unfortunately, my programming skills are not enough to adapt it to DEVONthink.

I would like to explain the use case scenario for this request, just in case the developers would like to consider the feature for implementation.

I would like to keep Name, Author and Date as the only visible columns in the file list view. This information would permit to quickly diferentiate between rtf notes that contain my own writings and those by the several authors I store quotations from.

This view is possible in DT, as it is to change item dates in bulk with one of the Applescripts included in DT. Yet this view cannot be put to good use in practice because it would be too time consuming to keep changing one by one author names for lots of files.

Document properties like author can’t be modified via AppleScript (yet). However, a future release will support custom metadata.