ReNamer, Script for delete BEFORE or AFTER specific strings
Some PascalScripts for ReNamer
This Script search and delete filename AFTER the specific strings, include itself.
- { This script cut filename by string - }
- const
- SEARCH_STRING = 'specific strings here';
- var
- BaseName: WideString; Length, Position: Integer;
- begin
- BaseName := WideExtractBaseName(FileName);
- Length := WideLength(BaseName);
- Position := WidePos(SEARCH_STRING, BaseName);
- WideDelete(BaseName, Position-1, Length-Position+2);
- FileName := BaseName + WideExtractFileExt(FileName);
- end.
This Script opposite to Search and delete filename BEFORE the specific strings, include itself too.
- { This script cut filename by string - }
- const
- SEARCH_STRING = 'specific strings here';
- var
- BaseName: WideString; Position: Integer;
- begin
- BaseName := WideExtractBaseName(FileName);
- Position := WidePos(SEARCH_STRING, BaseName);
- WideDelete(BaseName, 1, Position);
- FileName := BaseName + WideExtractFileExt(FileName);
- end.
沒有留言:
張貼留言