#1 2006-05-17 09:45

LawOfNonContradiction
Member
From: USA
Registered: 2006-04-28
Posts: 45

Renamer: Case filter: ranges like delete

I would like the case filter to have some options like the delete filter

cased6vb.png

- from position 3 until end  (to preserve the case of the first two characters)
- all charaters after the first space (delimiter)


etc

cool

Offline

#2 2006-05-17 13:32

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,440

Re: Renamer: Case filter: ranges like delete

It is better for the standard rules to be generalized - for better understanding and ease of use. All that you are asking for - can be done using the PascalScript rule. Here are the sample scripts how it can be achieved:

1) LowerCase from position 3 to the end:

var
  Begining, Ending: string;
begin
  Begining := Copy(FileName, 1, 2);
  Ending := Copy(FileName, 3, Length(FileName));
  FileName := Begining + LowerCase(Ending);
end.

2) LowerCase after the first space:

var
  Begining, Portion: string;
  Position: Integer;
begin
  Position := Pos(' ', FileName);
  if (Position > 0) then
    begin
    Begining := Copy(FileName, 1, Position-1);
    Portion := Copy(FileName, Position, Length(FileName));
    FileName := Begining + LowerCase(Portion);
    end;
end.

3) LowerCase from position 3 to first bracket and extension:

var
  BaseName, Extension: string;
  Begining, Portion, Ending: string;
  Pos1, Pos2: Integer;
begin
  BaseName := ExtractBaseName(FileName);
  Extension := ExtractFileExt(FileName);
  Pos1 := 3;
  Pos2 := Pos('(', BaseName);
  if (Pos2 > Pos1) then
    begin
    Begining := Copy(BaseName, 1, Pos1-1);
    Portion := Copy(BaseName, Pos1, Pos2-Pos1);
    Ending := Copy(BaseName, Pos2, Length(BaseName));
    BaseName := Begining + LowerCase(Portion) + Ending;
    end;
  FileName := BaseName + LowerCase(Extension);
end.

smile

Offline

#3 2006-06-15 06:00

LawOfNonContradiction
Member
From: USA
Registered: 2006-04-28
Posts: 45

Re: Renamer: Case filter: ranges like delete

thanks that helped me sort out some functions for other scripts.

Offline

Board footer

Powered by FluxBB