No, this can be done without scripting of some kind . There aren’t conditionals in a smart group and a RegEx isn’t going to return a value that would produce zeropadding or not when using the capture groups.
This is unlikely. But you understand Python and not AppleScript?!? That always boggles my mind since AS is such a simple language to learn.
There’s a lot that’s unfamiliar to me in the AppleScript paradigm, given that I started programming in 1976. I’ve worked a little with some really unusual languages like APL and Smalltalk and even a little with more obscure approaches like ProGraph, but AppleScript just seems really cumbersome and wordy, along with dealing with so many kinds of objects and all their attributes.
Maybe I need to look at more DEVONthink-oriented AppleScript?
As to Python: yes, you can use it to script DT, too (I guess). Just not from within DT itself, since it’s not part of Apple’s scripting infrastructure.
Might be of interest. I use Python a lot in my analysis work, but I’ve not looked further into this as linked below. Looks interesting and on my “todo” list someday: