Formula/script to delete and archive databases (custom template)

I have created a custom template (based on activity trends Db) that will allow us to manage Dbs better. I have a custom view that provides aging information with a field for retention status. We want to be able to select a group of Dbs (docs in custom view) and click an action button to change the retention status field to archive or delete. Select docs… click button… be presented with dialig box with delete or archive radio buttons… then change occurs. The other option is a script to copy archived docs (field=archive) to /archive and/or a script to delete all Dbs with field=delete. Any ideas or example scripts? The delete option will probably be button-driven (manual) with a couple confirmation screens. Thanks team…