You are not logged in.
Pages: 1
Idea:
an user create an script to do something like create an custom counter.
Then he have to use an regex subpattern part too to split the file name and
add the counter at the right place.
My assuming was just to use the insert rule to add the script result at the right place:
Insert Script Result: [path\script.pas][...]
Where Pos: 6
or
Where After Text: (
Read the *WIKI* for HELP + MANUAL + Tips&Tricks.
If ReNamer had helped you, please *DONATE* to Denis or buy a PRO license. (Read *Lite vs Pro*)
Offline
I see that it can be useful in practice, but it is not worth the development time.
Offline
Thanks for considering this.
Since i found "WideInsert()" again today,
i build an framework to rebuild the Insert rule
as an addition to my main script
to insert the script result (e.g. an custom counter) in the FileName where i want at easy.
Note: i just build the script without many test runs, so test this with test files only.
You can use this whole script as addition for your script
or copy&paste just the procedure or just the code you need.
You can use more then one insert option at once if you like,
e.g.
Prefix(InsertStr);
AND
Suffix(InsertStr);
AND
Position(InsertStr, 3);
Hope this is helpful and i did not that many nonsense
//InsertRule
////////////////////////////////////////////////////////////////////////////////////
///////// some procedures, don't modify (Note: all skips extension) ///////////////
Procedure Prefix(InsertStr: WideString);
begin
FileName := InsertStr + FileName;
end;
Procedure Suffix(InsertStr: WideString);
begin
FileName := WideExtractBaseName(FileName) + InsertStr + WideExtractFileExt(FileName);
end;
Procedure Position(InsertStr: WideString; InsertPos: Integer);
var
Base: WideString;
begin
Base := WideExtractBaseName(FileName);
WideInsert( InsertStr, Base, InsertPos);
FileName := Base + WideExtractFileExt(FileName);
end;
Procedure PositionRight(InsertStr: WideString; InsertPos: Integer);
begin
WideInsert( InsertStr , FileName, Length(WideExtractBaseName(FileName)) -InsertPos+2);
end;
Procedure AfterText(InsertStr, InsertAfterChar: WideString);
var
InsertPos: Integer;
begin
// Find the InsertPos automatically by searching
// the first occurrence of char 'x'
IF (InsertAfterChar <> '') then
InsertPos := pos(InsertAfterChar, FileName) +1;
IF (InsertPos>1) Then
WideInsert( InsertStr , FileName, InsertPos);
end;
Procedure BeforeText(InsertStr, InsertBeforeChar: WideString);
var
InsertPos: Integer;
begin
// Find the InsertPos automatically by searching
// the first occurrence of char 'x'
IF (InsertBeforeChar <> '') then
InsertPos := pos(InsertBeforeChar, FileName);
IF (InsertPos>1) Then
WideInsert( InsertStr , FileName, InsertPos);
end;
////////// end procedures //////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////
//////// the main script here //////////////////////////////////////////////////////
var
InsertStr: WideString;
begin
//
// Put your main script here...
//
// "InsertStr" is result from your "main script"
InsertStr := '_TEST_';
//New FileName (uncomment one or more as you need):
//Prefix(InsertStr);
//Suffix(InsertStr);
//Position(InsertStr, 3);
//PositionRight(InsertStr, 4);
//AfterText(InsertStr, '- ');
//BeforeText(InsertStr, ' -');
//or use an independent string: 'My string'
Prefix('TEST_');
PositionRight(InsertStr, 4);
//Prefix('My string ');
//AfterText(' (', '- ');
//Suffix(')');
end.
Read the *WIKI* for HELP + MANUAL + Tips&Tricks.
If ReNamer had helped you, please *DONATE* to Denis or buy a PRO license. (Read *Lite vs Pro*)
Offline
Pages: 1