2015年11月25日 星期三

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.


  1. { This script cut filename by string - }

  2. const
  3.   SEARCH_STRING = 'specific strings here';

  4. var
  5.   BaseName: WideString; Length, Position: Integer;

  6. begin
  7.   BaseName := WideExtractBaseName(FileName);
  8.   Length := WideLength(BaseName);
  9.   Position := WidePos(SEARCH_STRING, BaseName);
  10.   WideDelete(BaseName, Position-1, Length-Position+2);
  11.   FileName := BaseName + WideExtractFileExt(FileName);

  12. end.

This Script opposite to Search and delete filename BEFORE the specific strings, include itself too.



  1. { This script cut filename by string - }

  2. const
  3.   SEARCH_STRING = 'specific strings here';

  4. var
  5.   BaseName: WideString; Position: Integer;

  6. begin
  7.   BaseName := WideExtractBaseName(FileName);
  8.   Position := WidePos(SEARCH_STRING, BaseName);
  9.   WideDelete(BaseName, 1, Position);
  10.   FileName := BaseName + WideExtractFileExt(FileName);

  11. end.

沒有留言:

張貼留言