[pmmail-list] Changing titles of standard folders - Perl script
Lueko Willms
pmmail-list@blueprintsoftwareworks.com
Sun, 22 Jul 2001 15:53:14 +0200 (MES)
Hello all,
practical problems produce practical solutions.
Since I have to give a German language name to the standard folders
in several installations with several accounts each, for some of them,
I wrote a PERL program to do the job.
I would like to share the program with the PMMail community as a
first step to internationalize PMMail.
If you want other names as the ones I have selected (with one or
two exclamation marks ! at the beginning, to force them to the top
of the aplfabetical sorted folder list), you just have to edit the
values in the hash %ersetzen at the beginning of the program.
The program must be run with the PMMail directory as the current directory
so that it finds all the accounts and their folders.
Use it at your own risk! It is my very first own PERL program (not
true, it is the second one)!
I tested the program both on OS/2 with Perl 5.002 and on Windows NT
with Active State's Perl 5.6. The initial version, which worked fine
on OS/2 did not work on Windows, and I had a lot of work and study
to get a version which works on both.
Just note that the "umlauts" are specific to the operating system:
CP437 on OS/2 and ISO-8859-1 on Windows, and need to be edited for
the OS you are using. I guess there are more elegant solutions in Perl,
but I don't find them so easily, being a beginner in PERL.
------- cut here ---------- nameacc.pl
#perl -w
### Programm NAMEACC.PL
%ersetzen = ('inbox', '!!Eingangskorb', 'outbox', '!!Postausgang', 'sent', '!!Verschickte Post', 'drafts', '!Entwürfe', 'trash', '!Papierkorb');
$\ = ""; ### set print line terminator to empty string
while (defined($mailAcc = <*.ACT>))
{
## print "Account $mailAcc\n";
while (($fach, $fachname) = each(%ersetzen))
{
$inidatei = $mailAcc . '/' . $fach . '.FLD/folder.ini' ;
print " $inidatei\n" ;
open (FACHINI, "+<$inidatei") || die "Kann Datei $inidatei nicht ffnen: $!\n";
$zeile = <FACHINI>;
chomp($zeile);
## print " Urspr³nglich: $zeile\n";
@felder = split(/\xDE/, $zeile);
shift(@felder);
## print " Restliste: @felder\n";
$neuform = join("\xDE",$fachname,@felder,"");
print " Neu gejoined: $neuform\n";
truncate (FACHINI, 0) || die "Kann Datei $inidatei nicht leeren: $!\n";
seek (FACHINI, 0, 0);
print FACHINI "$neuform";
close (FACHINI) || die "Kann Datei $fachname nicht schlie en: $!\n";
}
$query = <STDIN>
}
--------- cut off -------------------
Yours,
Lüko Willms
Frankfurt/Main
/ Lueko.Willms@T-Online.de
- pmmail-list - The PMMail Dicussion List ---------------------------
To UNSUBSCRIBE, send a message to mdaemon@bmtmicro.com with the first
line of the message body being...
UNSUBSCRIBE pmmail-list@blueprintsoftwareworks.com