JSBSF I am glad that worked out for you. So you didn't care about MAXSIZE, you just went after the databases with the largest amount of allocated space regardless of whether they were near their individual MAXSIZE or not? I could see where that is a reasonable approach for your use case.
We don't use SHRINK because of the massive overhead of rebuilding the indexes (TB-size databases, hundreds of tables) to fix the fragmentation it causes, and because we would likely need to allocate that space again too quickly, so we just make more space available.
Are you saying that sys.resource_stats.storage_in_megabytes is allocated storage? The documentation isn't clear to me.
I still need MAXSIZE because I am trying to look ahead to ensure I always have about 20% of free space.