I have been scanning the web, books and annoying my firends but I can't fix it. I have posted questions in many discussions and all are ignored. I am thinking someone must know or at least have a lead to more info so I am being bad and reposting it here.
Loads of companies change their names often (especially the gov). A tool to go over a bunch of docs and a>record last modified date, change company name, reset last modified date, would be very handy. Our docs have four different company names in 4 years! As soon as I can actually change that one field (and the script is almost there) I'll finish it and make it available.
I'm not a very good programmer so the fix is probably simple, please help if you can. I don't want to try doing it in VB (yuck).
Original code adapted from (which does not quite work). you need the addon dsofile installed (avail from that link or at least explained). Is it likely I am not using functions that update expects? The right section highlighted ###### that does not work fails if I put in a fail condition and returns no error as is but does not work.
Any leads anything? I really am getting desperate and vb is my last choice please save me from VB!!
use strict;
use Win32::OLE;
use File::Spec;
my $PropertyReader = Win32::OLE->new('DSOleFile.PropertyReader', 'Quit');
my $directory = "c:\\temp\\cst";
opendir(DNAME, $directory) || die "Unable to open the requested directory: $directory\n";
while( my $filename = readdir( DNAME ) ) {
next if ($filename eq '.' or $filename eq '..');
my $fullfilename = File::Spec->catdir($directory,$filename);
my $title = "title";
my $properties = $PropertyReader->GetDocumentProperties($fullfilename)
|| die("Unable read file properties for '$fullfilename' ", Win32::OLE->LastError());
if ( !$properties->{title} || length($properties->{title}) >= 0)
{
print "File '$filename' --- Title not set setting to '$filename'\n";
$properties->SetProperty('Title', $filename); #######not working#########
print "Title =" . $properties->{title} ."'\n";
print "\n\n";
} else {
print "File '$filename' --- Title property is set to '" . $properties->{title} ."'\n";
}
}
closedir(DNAME);
Loads of companies change their names often (especially the gov). A tool to go over a bunch of docs and a>record last modified date, change company name, reset last modified date, would be very handy. Our docs have four different company names in 4 years! As soon as I can actually change that one field (and the script is almost there) I'll finish it and make it available.
I'm not a very good programmer so the fix is probably simple, please help if you can. I don't want to try doing it in VB (yuck).
Original code adapted from (which does not quite work). you need the addon dsofile installed (avail from that link or at least explained). Is it likely I am not using functions that update expects? The right section highlighted ###### that does not work fails if I put in a fail condition and returns no error as is but does not work.
Any leads anything? I really am getting desperate and vb is my last choice please save me from VB!!
use strict;
use Win32::OLE;
use File::Spec;
my $PropertyReader = Win32::OLE->new('DSOleFile.PropertyReader', 'Quit');
my $directory = "c:\\temp\\cst";
opendir(DNAME, $directory) || die "Unable to open the requested directory: $directory\n";
while( my $filename = readdir( DNAME ) ) {
next if ($filename eq '.' or $filename eq '..');
my $fullfilename = File::Spec->catdir($directory,$filename);
my $title = "title";
my $properties = $PropertyReader->GetDocumentProperties($fullfilename)
|| die("Unable read file properties for '$fullfilename' ", Win32::OLE->LastError());
if ( !$properties->{title} || length($properties->{title}) >= 0)
{
print "File '$filename' --- Title not set setting to '$filename'\n";
$properties->SetProperty('Title', $filename); #######not working#########
print "Title =" . $properties->{title} ."'\n";
print "\n\n";
} else {
print "File '$filename' --- Title property is set to '" . $properties->{title} ."'\n";
}
}
closedir(DNAME);