Renaming an item in DEVONthink to match the name of its parent group
When creating a new project folder (group) in DEVONthink, I often make use of Templates. Templates are just files in a folder somewhere that get copied into the DEVONthink database. For example, I have a project “starter” Tinderbox document named “Basic Project Template.tbx”. When inserting the template file into my DEVONthink project, it uses the same name as the original, which isn’t helpful. DEVONthink is very scriptable, so I wrote an AppleScript to rename the selected document the same as the enclosing group/folder.
Well, I didn’t exactly write it. It’s more like I conjured it.
I first tried copying an existing script that seemed like it would give me a head start and set to modifying that. I didn’t know how to refer to the enclosing group in AppleScript so I started to browse DEVONthink’s dictionary. It occurred to me that maybe I could just ask ChatGPT for help, so I typed:
“Write me an applescript to rename an item in DEVONthink to the name of its enclosing folder”
ChatGPT wrote the following:
It worked great on the first try. The only change I made was to remove the “selectedItemName” from the final name. What a world.