I was not at all sure I should muddy the waters even further but was sufficiently interested to have a working version of the script to suit my own purposes so spent some time on it.
Please note:
- This version suits my use. It may not suit the uses of others.
- I have removed all the credits at the start of the script—for which I apologise. I acknoweldge, however, all the help provided by others.
-- First set the path of the folder to which you wish to backup
property pbackup_path : "/Users/[your path]/Backups/"
tell application id "DNtp"
set this_date to do shell script "date +%Y-%m-%d-%H-%M-%S"
set all_databases to every database
repeat with this_database in all_databases
try
set this_name to name of this_database
-- We use the backup path property here
set this_archive to pbackup_path & this_name & " " & this_date & ".dtBase2.zip"
-- Set a general progress indicator
show progress indicator "Weekly backup of all open databases…" steps count of all_databases
with timeout of 3600 seconds
-- Show which database we're processing
step progress indicator this_name as string
if (verify database this_database) is not 0 then error "Database --" & this_name & " is damaged."
if not (optimize database this_database) then error "Optimisation --of database " & this_name & "failed."
if not (compress database this_database to this_archive) then --error "Backup of database " & this_name & "failed."
end if
end timeout
on error error_message number error_number
hide progress indicator
if the error_number is not -128 then log message "DEVONthink:" & error_message
end try
end repeat
hide progress indicator
-- Show an alert when it's all done
display alert "Backups of all open databases complete."
end tell
Stephen (who now blocks his ears and closes his eyes for fear of retribution)