Backup Your Database
The past few days I've had emails from no fewer than 3 people who've lost their hard disks and with them their XTension databases! The database folder contains everything about your setup and should be backed up to a separate drive or even better to a remote system or at least via time machine.
XTension automatically backs up it's own database whenever you run a new version and keeps a rolling backup of the last 10 days zipped up in it's application folder. You'll see those numbered 001 through 010 alongside the application. Unfortunately all those are saved to the same disk. They will protect you from database corruption due to a system crash or a power fail while writing to the file or something, but not from a disk crash that renders the entire thing unreadable.
After making changes to the database you should manually select “Archive Database…” from the database menu and save off a copy to a different disk. You can also automate this process and save off a copy every night as proof against disaster.
The archive database command is also an applescript verb, so you can automate and schedule the archiving of a database copy via a script. The script is very simple. XTension will make sure the name is unique and if not it will append a number to the end of the file name that you pass, so it's not even necessary to build a unique filename before running it. This in a global script all that is really necessary is that you have an external or remote drive mounted, create a folder in it to hold the backups and do something like:
archive database at "name of external disk:a folder to keep them in:xtension database"
and then create a scheduled event to run this script every night. Managing files in AppleScript is a challenge sometimes so here is some extra help with path information. If you use regular apple paths with the “:” then you should be able to save to an external or remote drive by just using that name first. Assume for this example that I have an external drive named “BigBackup” connected to the mac, to copy the database to it I'd do this:
archive database at "BigBackup:My Backup Folder:XTension Database"
if you have a mode complicated setup with remote mounts that are not treated as regular drives, or if you wish to use a “posix” style path you need to coerce the path to point to the right place. Something like this:
archive database at ("/my root folder/something/mount point/the folder/xtension database" as posix file)
the “as posix file” tells applescript this is a different kind of path and not just a long file name. While figuring this out I had some humorous moments where the file was created but wasn't where I expected it until I found a file with that path as it's name in the same folder as XTension.
If you have a very large database or a very slow computer or connection to the remote disk this can take a few minutes to complete. So make sure you run it at a time that wont create any other problems.