Summarize Highlights as Markdown on toolbar?

# summarise highlights of selected records to sheet/markdown/rtf
# to summarise ALL selected records to ONE summary, comment out the lines "repeat with" and "end repeat", and replace "summarize highlights of records {thisItem}" with "summarize highlights of records theSelection"; as it stands, one summary will be created for each selected record.

tell application id "DNtp"
	try
		set theDest to missing value
		-- set theDest to get record at "/Group/Subgroup" in database "Database" # uncomment this line by removing "--" if summaries should be directed to a specific group, using "/group/subgroup" in database "database"
		set theSelection to the selection
		if theSelection is {} then error "Please select records to summarise."
		repeat with thisItem in theSelection
			-- set theDest to incoming group of current database # uncomment this line by removing "--" if the summaries should be directed to inbox of database containing the selected file
			# if theDest is not set, then summaries will be saved next to originals
			summarize highlights of records {thisItem} to sheet in theDest # or use "markdown" or "rich" instead of "sheet"
		end repeat
	on error error_message number error_number
		if the error_number is not -128 then display alert "DEVONthink" message error_message as warning
	end try
end tell

Copy and Paste that to Script Editor, and save to /Users/yourUserName/Library/Application Scripts/com.devon-technologies.think3/Toolbar; use a short, to-the-point name such as “Summarise”. Restart DT if it was open when you saved the file to the Toolbar-folder. Once done, right-click the toolbar and select “Customise Toolbar”; your script should be listed, and you can drag it to your toolbar.

6 Likes