You are not logged in.
Pages: 1
I have a mockup file that is named [Test] v1 (919).bmml and I was wondering if I could use Renamer in order to increment the v1 to v2.
If that doesn't work, is there a way to use Regex to find the number in the file and append the meta tag File Folder before it? The file folder it is in, is called Font Clipping.
The end result that I am looking for is:
[Test] Font Clipping v1 (919).bmml
Offline
Hi and welcome.
You can have what you want.
FROM:
[Test] v1 (919).bmml
TO:
[Test] v2 (919).bmml
OR:
[Test] <parentfolder> v1 (919).bmml
OR even:
[Test] <parentfolder> v2 (919).bmml
How depends on your real file names and what you want.
The easiest is for
FROM:
[Test] v1 (919).bmml
TO:
[Test] <parentfolder> v1 (919).bmml
Go to Insert rule and take an look for the 'Insert Meta Tag' button (Yes, it's an button)
The tag for <parentfolder> is :File_FolderName:
So add :File_FolderName: plus an following space
and choose 'Before text:[ V1]'
- - -
To increment the v1 to v2 just use Replace 'V1' with 'V2'
- - -
If you want to increment every digit by one, no matter which value, then you have to mention that.
Then we can use an PascalScript with an RegEx to match the space-V-digit-space and do the math on that match.
So provide some more infos or examples, e.g. how can one catch the digit to increment?
Always that one after the 'V' ? Always one digit or any amount?
.
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
The Pascal script sounds good, but I don't know that Programming language.
Specifications and Desired Result
After v for version preceded by MockupName which is inputted by me
Whenever the number [0-9] follows v
Usually have 10 or less versions, so 0-9 single digits would be fine
The v must be after the FolderName meta tag
The FolderName meta tag must be after some text enclosed by brackets
Desired Result
[SomeText] FolderName MockupName v[0-9].bmml
Example:
[Test] Text Clipping Issues Text appears to clip v1.bmml
I didn't know you needed specifics, I can be very specific, but it doesn't always call for it in every forum. Thanks for the heads up.
Offline
Ahh, you already replied.
So an quick answer before i am offline.
Try this script. See the wiki how to use scripts.
Test with example files, and only three or four, first:
This script will only work once per file, because i match "] v1"
var
SubPatterns: TStringsArray;
NumberFound, Calculation: integer;
Begin
//RegEx for "[Test] v1 (919).bmml"
SubPatterns:=SubMatchesRegEx(
WideExtractBaseName(FileName),'(.*] )v(\d+)( .*)',false);
if Length(SubPatterns) <=0 then exit;
NumberFound := StrToInt( SubPatterns[1] );
Calculation := NumberFound + 1 ;
FileName :=
//part one of the original filename:
SubPatterns[0]
//add parent folder name:
+ CalculateMetaTag(FilePath, ':File_FolderName:')
//prompt the user for an string: (remove the line if not needed)
+ ' ' + InputBox('MockupName','your input for ' +FileName,'')
//add the matched and now calculated number:
+ ' v' + IntToStr(Calculation)
//add part three of the original name:
+ SubPatterns[2]
//and at last add the original extension:
+ WideExtractFileExt(FileName);
End.
An word about the regex:
'(.*] )' will match "[Test] " and is stored in SubPatterns[0]
'v' matches the letter "v"
'(\d+)' will match one-ore-more digit(s) => "1" and is stored in SubPatterns[1]
'( .*)' will match the rest " (919)" and is stored in SubPatterns[2]
The extension bmml is handled separately
HTH?
If yes, please read my footer.
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
Thanks for making that script, I actually had to alter the script at the top, because it didn't work
Removed-[== PascalScript ==]
New script is
var
SubPatterns: TStringsArray;
NumberFound, Calculation: integer;
Begin
//RegEx for "[Test] v1 (919).bmml"
SubPatterns:=SubMatchesRegEx(
WideExtractBaseName(FileName),'(.*] )v(\d+)( .*)',false);
if Length(SubPatterns) <=0 then exit;
NumberFound := StrToInt( SubPatterns[1] );
Calculation := NumberFound + 1 ;
FileName :=
//part one of the original filename:
SubPatterns[0]
//add parent folder name:
+ CalculateMetaTag(FilePath, ':File_FolderName:')
//prompt the user for an string: (remove the line if not needed)
+ ' ' + InputBox('MockupName','your input for ' +FileName,'')
//add the matched and now calculated number:
+ ' v' + IntToStr(Calculation)
//add part three of the original name:
+ SubPatterns[2]
//and at last add the original extension:
+ WideExtractFileExt(FileName);
End.
Offline
Pages: 1