Batch update document icons

I want to set a custom (!) icon for Markdown files so that they clearly stand out from other file types in DEVONthink Pro. Is there a quick way to accomplish this? Ideally in batch mode so I can update around 500 icons in one go.

I can’t find where DT keeps data for the icons, but I suspect it would be in the database meta files (DEVONthink-1.dtMeta)

I know it’s possible to change the icon by doing the following:
-> select document
-> click on the “Info” icon in the DEVONthink toolbar
-> click on the icon on the top left of the info panel that pops up
-> paste a new graphic/icon file

This would take a long time if I want to update 500 files.

I know it is possible to change the icons by associating another default application for that particular file type. But that is not a good solution in my case (I use several Markdown editors, but none of their icons are very clear in DT, and I also don’t want to change the default editor only to change the icons).

This is a simple approach to it. You will need to select the file to be used as the thumbnail.

-- Change Record Thumbnail
-- Created by Jim Neumann / BLUEFROG on Tue Aug 08 2018.
-- Copyright (c) 2018 BLUEFROG / DEVONtechnologies, LLC. All rights reserved.

set thumb to choose file of type {"jpg", "png", "tiff"}

tell application id "DNtp"
	repeat with thisRecord in (selection as list)
		set thumbnail of thisRecord to (POSIX path of thumb)
	end repeat
end tell

Legend! Such an elegant solution – I love it. This can be used for other file types too, so that’s great.

Thank you for providing that bit of code. Much appreciated.

You’re welcome. Have fun with it. :smiley:

Yes, I will. And already have: with a Smart Group for all Markdown files, the icons were changed in no time at all. And new Markdown files will automatically have the custom icon (since I set up a Markdown template with the changed icon/thumb).

One more question (and I’m nit picking here), would it be possible to change the default icon/thumb for new bookmarks/webloc files? No biggie if that’s not possible, but it would be nice…

No, that’s not possible. Cheers!

I already thought that would be the case, but that’s no problem. Thanks again.

Wow Jim, this is super useful!

@uimike: Glad you like it! :smiley:

This can also be sued for groups, so useful. thnaks man

Indeed, it can. (That’s actually why the script mentions Record instead of file. A Record can be a file or a group. :smiley: )
You’re welcome.