HAL databases are stored in a Fox Pro format. Why would anyone want to read those databases? Maybe to script the creation of tasks, macros & events? This post will get you halfway there - reading the databases. First off, you'll need Perl. Get
ActivePerl if you don't have Perl already. After installing it, open a command prompt and start the package manager by running
ppm. At the ppm prompt, type
search DBD-XBase, then type
install. After it finishes, type
exit and now you're ready to write some code.
This is a very simple script that takes 1 argument (the .DBF filename) and dumps out the contents of the file, field by field.
# dumpdb.pl
use XBase;
$\ = "\n";
$, = ' ';
my $table = new XBase $ARGV[0] or die XBase->errstr;
@fields= $table->field_names;
for (0 .. $table->last_record) {
foreach $field (@fields) {
my ($deleted,$val) = $table->get_record($_, $field);
print "$field = $val" unless $deleted;
}
print "";
}
$table->close;
usage: perl dumpdb.pl FILENAME.DBF
No comments:
Post a Comment