You are not logged in.
I would like to insert "sent_" before the last 3 digits,
From:
family_001.jpg
work_023.jpg
friend_098.jpg
day1_003.jpg
day24_050.jpg
To:
family_sent_001.jpg
work_sent_023.jpg
friend_sent_098.jpg
day1_sent_003.jpg
day24_sent_050.jpg
"Insert" only got a "left-to-right" position option,
so how could I do this by using other rules,
please help, thanks a lot.
Offline
Use PascalScript rule, and put this code:
const
RIGHT = 3;
TEXT = 'sent_';
var
Position: Integer;
begin
Position := WideLength(FileName) - WideLength(
WideExtractFileExt(FileName)) - RIGHT + 1;
if Position < 1 then Position := 1;
WideInsert(TEXT, FileName, Position);
end.
You can change the constants at the top of the script (RIGHT and TEXT).
Alternatively, you could use RegEx rule, to insert text before the last "_" (underscore), but that might get a bit complicated.
Offline
Thank you Denis, it works, but will you consider to apply such function to "Insert" for the coming version? It is a lot easier to rename it than using PascalScript. ^_^
Offline
I will consider it
Offline