I'm using a few scripts for one-time data checking and scrubbing. They load the Drupal bootstrap but not the UI:
require_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
How can I display any error messages that they generate?
$array = drupal_get_messages();
? Once you've got that, you can do anything you want with it, such as printing to standard output or something.