DevonThink Pro (DTP) and coloured notes

I am transitioning about 1,000 notes from SoHo Notes to DTP. These notes are sorted out in about 10 different sections/files with a dedicated color for each note in the same section/file (I do not refer to ‘label’, but to the color of the note). On DTP, I found out how to do it on one note at a time, but is it possible to proceed and apply a colour in one single shot for a bunch of, say, 100 notes of the same section ?
Thank you beforehand.

The document background color isn’t scriptable yet, only the background color of text.



tell application id "DNtp"
	set theRecords to the selection
	if theRecords is not {} then
		try
			set theWindow to missing value
			repeat with theRecord in theRecords
				if theWindow is missing value then
					set theWindow to open window for record theRecord
				else
					set record of theWindow to theRecord
				end if
				
				tell text of think window 1
					set background to {65535, 32767, 65535}
				end tell
				
				save theWindow
			end repeat
			if theWindow is not missing value then close theWindow
		end try
	end if
end tell

Thank you, but I am not quite sure what to do with your reply… I am a somewhat salted user, but a user only, and I do not really know how to deal with the script (sorry for my incompetence !).

Probably an easier way than what I’ll give you, but I’m sure others will contribute to shorten.

  1. Open Utilities folder in your Applications folder on Mac; then double click to launch Script Editor program
  2. Copy the script that Christian provided; then paste that script into Script Editor
  3. Run script (top menu under Script) to make sure Script compiles properly; then name and save that file to desktop.
  4. Click on Script icon (top menu command); then click Open Script Folder
  5. Drag new script file from desktop into Script Folder; you can put in appropriate folder or not
  6. In DT, select files; then double click the new script in Script Folder. The script should run and change the background text colors of the selected files as indicated in Christian’s script.

Hope this helps.

Thank you, it is clear and I will do it over the week-end.

It works well.
Thank you again.

Good evening
How can I possibly modify the script so that the background color change apply to the full file (even in the portion where nothing is written) ?

Thanks b4hand

The document background color is not available as a element property to script. You can change it in the Font panel on a per document basis. You may also want to consider switching to Markdown as this is a trivial thing to do in such documents.

Well… Thank you anyway.

Good evening

In order to avoid a possible mess, before I do anything crazy; please advise whether the script you provided me some years ago for DT Pro works on DT_3 ? And also, is it possible to change the background color for a bunch of notes at once.
Thanks b4hand

The script should still work as expected.

This is also easily testable without making a mess by just selecting or creating a single document. There’s no requirement to select a bunch of files to run the script.

I’m actually looking for a script similar, to change the TEXT COLOR only.
Is there a script for this?

Would like to highlight a word or paragraph then execute a script with a specific color I have assigned to it and apply that color.

Now that we have mostly everything in black-background(which is a nice thing) When highlighting I find it messy or distracting when I highlight a word in PDF. However in a white background somehow it looks ok not so much with a black background.

-I have Inverted my PDFs, so most of my PDFs are black on white text.

Yes Jim I can use the colors window , but I don’t wanna do this every time.

Thank you.

Here is a teaching edition script…

property newColor : {65536, 32768, 0}

tell application id "DNtp"
	if (exists content record) then
		set recordType to (type of content record)
		if (recordType as string) begins with "RTF" then
			try
				set (color of selected text of think window 1) to newColor
			on error
				display alert "No text selected"
			end try
		else
			display alert "This is not a rich text file."
			return
		end if
	else
		display alert "No file is currently displayed in the view edit pane."
		return
	end if
end tell

Will try this out. Thank you

The old script is still compatible but in version 3 it’s much easier now:

tell application id "DNtp"
	set theRecords to the selection
	repeat with theRecord in theRecords
		if type of theRecord is rtf or type of theRecord is rtfd then
			tell text of theRecord to set background to {65535, 32767, 65535}
		end if
	end repeat
end tell

And this version could be used by smart rules:

on performSmartRule(theRecords)
	tell application id "DNtp"
		repeat with theRecord in theRecords
			if type of theRecord is rtf or type of theRecord is rtfd then
				tell text of theRecord to set background to {65535, 32767, 65535}
			end if
		end repeat
	end tell
end performSmartRule

Thank you for all replies. I have no time during week days to work on that, I keep it for the week-end.