Difference between revisions of "ReNamer:Scripts:Index filenames"

From den4b Wiki
Jump to navigation Jump to search
(Created page with '{{Up|ReNamer:Scripts}} Demonstrates how to insert an incrementing number into the filename. == Code 1 == Author: Denis Kozlov. Date: 13 February 2007. Replaces the whole file…')
 
m (Text replacement - "<source>" to "<syntaxhighlight lang="pascal">")
 
(One intermediate revision by the same user not shown)
Line 9: Line 9:
 
Replaces the whole filename with the incrementing number.
 
Replaces the whole filename with the incrementing number.
  
<source>
+
<syntaxhighlight lang="pascal">
 
var
 
var
 
   I: Integer;
 
   I: Integer;
Line 17: Line 17:
 
   FileName := IntToStr(I);
 
   FileName := IntToStr(I);
 
end.
 
end.
</source>
+
</syntaxhighlight>
  
 
== Code 2 ==
 
== Code 2 ==
Line 25: Line 25:
 
Append an incrementing number surrounded with brackets to the end of the base name.
 
Append an incrementing number surrounded with brackets to the end of the base name.
  
<source>
+
<syntaxhighlight lang="pascal">
 
var
 
var
 
   I: Integer;
 
   I: Integer;
Line 34: Line 34:
 
     IntToStr(I) + ')' + WideExtractFileExt(FileName);
 
     IntToStr(I) + ')' + WideExtractFileExt(FileName);
 
end.
 
end.
</source>
+
</syntaxhighlight>

Latest revision as of 16:04, 8 February 2017

Demonstrates how to insert an incrementing number into the filename.

Code 1

Author: Denis Kozlov. Date: 13 February 2007.

Replaces the whole filename with the incrementing number.

var
  I: Integer;

begin
  I := I + 1;
  FileName := IntToStr(I);
end.

Code 2

Author: Denis Kozlov. Date: 8 September 2010.

Append an incrementing number surrounded with brackets to the end of the base name.

var
  I: Integer;

begin
  I := I + 1;
  FileName := WideExtractBaseName(FileName) + ' (' +
    IntToStr(I) + ')' + WideExtractFileExt(FileName);
end.