Summarise (summarize) highlights with smart rule

Forgive me if this is a stupid question…

Can I trigger the summarise highlights tool from the menu as consequence of a smart rule? I want to direct a smart rule to a particular folder and undertake this as an automation, but I can’t figure out how to trigger it as an action in smart rules.

Thanks very much

There are no stupid questions unless someone is being willfully ignorant or trolling :slight_smile:

There isn’t a Summarize smart rule action, so the only option would be an Execute Script action.

Also, you haven’t defined what the trigger would be.

Thanks for the response, @BLUEFROG.

So here’s the issue I’m dealing with.

I have a DT Group within a database containing a number of PDFs. Some are highlighted, some aren’t.

Those that are highlighted, I would like to extract the highlights into a markdown document which would, in effect, act as a summary document.

I was thinking I could highlight a pdf and then tag it with a specific tag (i.e. extract). A smart rule could then extract from all pdfs with that tag. I’d probably have to include in the smart rule to remove the tag, otherwise it would loop ad infinitum.

Then a second rule (or the same, I’d have to test) places the newly created document into the destination folder where I’d like to keep it.

How do I execute script action? I looked for a script for this but couldn’t find one.

Thanks again.

The smart rule and the script could look like this:

on performSmartRule(theRecords)
	tell application id "DNtp"
		summarize highlights of records theRecords to markdown in (root of inbox)
	end tell
end performSmartRule

Wouldn’t the other way around be more comfortable? I. e. add an additional condition like Tag is not Summarised and add the tag Summarised at the end of the Smart Rule. Then you would not have to add the tag manually.

Plus, if you add some highlights later it would be easier to delete a tag than to write it again to get the PDF summarised by the Smart Rule a second time. (Question to those who know: Wouldn’t a script that highlights and removes the Summarised tag at the same time be possible?)

When you are working a lot with tags to create connections between items you might find this one—wether Extract or Summarized—that serves only a technical purpose distracting. Maybe then you should create a more unobstrusive boolean custom meta data called Summarized or something like that.

Christian, would it cause you a lot of work to expand the DEVONthink script dictionary with a function to summarise to a variable and not just a file? So the highlights could at first get processed (for example getting chopped into many files) and the intermediate step of first getting a standard file that collects all highlights would not be necessary?

If for backwards compatibility summarize has to be retained unchanged, maybe something like variable [array] = highlights of record?

In the meantime, you could mimick that in just three lines of code:

const record = app.summarizeHighlights(recordsList, {to: markdown});
const summary = record.plainText();
/* do something with the summary */
app.delete(record);

You’re The Man, man! (The addressed Christian is The Man too, of course. So you’re The Men! If that does not sound un-woke.)

2 Likes

Thanks to everyone for the replies. I have managed to arrange this, with thanks to @cgrunenberg script.

I’m grateful to you all.

1 Like