ShortenRenameGroupsFolders
From 40tude Dialog Wiki
Shorten and rename groupnames and folders in grouplist
The following event script is based on the Hide NGName script.
Now you have various options to customize your newsgroup pane.
It's still possible to shorten the newsgroup names. This can be done in two different ways:
Either all parts but the last are minimized to the first letter (news.software.readers -> n.s.readers) or the last two strings will be kept intact (news.software.readers -> n.software.readers). If you don't like shortened newsgroup names, you can disable this option.
Also the ability to remove newsserver-names has survived. This is useful only if your layout settings for the newsgroup pane contain a column with '%newsgroup% (%server%)', Dialog's original layout style.
Really new is the option to rename groups or folders. Take a look at the function 'RenameGroups', I think it is pretty much self-explanatory.
Tested successfully on 2.0.10.1
Please read the Painting script warning page before trying out this script.
program OnNewsgroupListPaint;
const
// toggle between 'true' and 'false' to change one of the following settings
// Do you want to shorten the newsgroup names?
// (news.software.readers -> n.s.readers)
ShortenGroups=true;
// If ShortenGroups is 'true', do you want to keep the last two strings?
// (news.software.readers -> n.software.readers)
KeepTwoStrings=false;
// Do you want to remove the name of the newsserver?
RemoveServer=true;
function RenameGroups(paintstring:widestring):widestring;
begin
case paintstring of
// list of groups and folders that will be renamed
'alt.sysadmin.recovery' : result:='asr';
'Inbox (anchedo)' : result:='Incoming mail';
'de.admin.news.announce' : result:='dana';
'de.admin.news.groups' : result:='dang';
'de.alt.gruppenkasper' : result:='dag°';
'de.alt.netdigest' : result:='dan';
'de.alt.sysadmin.recovery': result:='dasr';
end;
end;
function ShortenRenameGroupsFolders(PaintString:widestring):widestring;
var i:integer;
s:string;
lpaintstring:widestring;
ls:string;
begin
// remove the name of the newsserver, if it still exists
// (just compatibility with very old versions of Dialog)
if RemoveServer=true then
begin
i:=pos(' (',paintstring);
if (i>0) and (copy(paintstring,1,6)<>'Inbox ') then
begin
s:=paintstring;
delete(s,i,200);
paintstring:=s;
end;
end;
// minimize newsgroup names
// (news.software.readers -> n.s.readers)
if ShortenGroups=true then
begin
i:=pos('.',paintstring);
s:='';
end;
// check if groups should be renamed
if RenameGroups(paintstring)<>'' then
begin
paintstring:=RenameGroups(paintstring);
i:=0;
end;
// shorten group names for not renamed groups
if ShortenGroups=true then
begin
while (i>0) do
begin
if KeepTwoStrings then
begin
lpaintstring:=paintstring;
ls:=s;
end;
s:=s+copy(paintstring,1,1)+'.';
paintstring:=copy(paintstring,i+1,1000);
i:=pos('.',paintstring);
end;
if (KeepTwoStrings=true) and (lpaintstring<>'') then
begin
s:=ls;
paintstring:=lpaintstring;
end;
paintstring:=s+paintstring;
end;
result:=paintstring;
end;
function OnNewsgroupListPaint(PaintString:widestring;ColumnIndex:integer):widestring;
begin
paintstring:=ShortenRenameGroupsFolders(paintstring);
result:=paintstring;
end;
begin
end.
Script by anchedo (Andreas Loch)