Page 1 of 1

Batch modify rtf properties

Posted: 2017-12-22 00:24:01
by jmm
I realize it is possible to modify keywords or authors of single rtf files in Nissus Writer Pro. But I need to do it for a large number of files. Could anybody advise me how to do it in Terminal, with an Applescript or any other app?

Re: Batch modify rtf properties

Posted: 2017-12-26 14:09:40
by martin
It should be possible to accomplish your task directly in Nisus Writer using a macro. Here's an example macro that's quite straightforward. It will ask you to choose one or more files (in a standard file dialog) and then set the author and keywords to some fixed pre-determined values.

Code: Select all

$filePaths = Choose Files
ForEach $filePath in $filePaths
	$doc = Document.open($filePath)
	$doc.setProperty("author", "Dr Seuss")
	$doc.setProperty("keywords", "chartreuse, ova, piggy")
	Save
	$doc.close
End
More complex macros are possible of course, but hopefully this gets you started.

Re: Batch modify rtf properties

Posted: 2017-12-26 14:30:19
by jmm
It seems very time consuming to open and save each file if processing a large number of rtfs.
I wonder if this could be handled by Applescript for batch processing.
Or does Nisus provide actions for workflows regarding document properties, as Microsoft Word does for Automator?
Thank you.

Re: Batch modify rtf properties

Posted: 2017-12-29 20:27:08
by phspaelti
jmm wrote:It seems very time consuming to open and save each file if processing a large number of rtfs.
Have you tried Martin's macro? You can select lots of files and it will go through all of them and change them accordingly.
jmm wrote:I wonder if this could be handled by Applescript for batch processing.
You could save the central part of Martin's macro and then write an applescript, that uses that and applies it to relevant selections of files via an applescript.
But alternatively you could write a Nisus macro that goes through the file hierarchy and changes all relevant files in the path. NWP's ability to manipulate files is no more cumbersome than applescript's, so you don't gain much from using applescript.
Which solution you choose, really depends on your set-up, and what you are trying to achieve. Do you have a regular stream of files that need to be changed in this way?
jmm wrote:Or does Nisus provide actions for workflows regarding document properties, as Microsoft Word does for Automator?
Automator isn't really good for anything. Who uses that?