You are not logged in.
Hello Guys,
i Have an Question, i want to use this Tool to Rename our Files.
Not to my Question, we have an Syntax in our Files "Filename_AZ_Filename.3dm" and Files like "Filename.3dm" is it Possible to Filter That _AZ_ and change that File to another Name ?
We User for Normal .3dm Files "Filename_NSM.3dm" and for Files with that _AZ_ we use "Filename_AZ.3dm".
Here is my code that i use at the Moment.
var
vExt: WideString;
begin
// Dateiendung Filtern
vExt := WideExtractFileExt(FilePath);
// Dateiendung Filtern
// Bedingung .PDF
if vExt = '.pdf' then
begin
FileName := FileName + '_AZ' + vExt;
end;
// Bedingung .PDF
// Bedingung .3dm
if vExt = '.3dm' then
begin
FileName := FileName + '_NSM' + vExt;
end;
// Bedingung .3dm
// Bedingung .stl
if vExt = '.stl' then
begin
FileName := FileName + '_SM' + vExt;
end;
// Bedingung .3dm
// Bedingung .obj
if vExt = '.obj' then
begin
FileName := FileName + '_SM' + vExt;
end;
// Bedingung .obj
end.
Thanks for your Help.
Offline
Hello!
It is not clear from your description what exactly you want to achieve, in addition to your script.
Can you please provide examples of input and desired output filenames?
Offline
ok we Have Files like That : VB.000_015_001_000_AZ__Samarkand_Rubin_Teller Flach 16cm.3dm That Files should be Renamed as
10-4732-2660_Samarkand Rubin_Brotteller 16cm_AZ.3dm and Normal Files without _AZ_ in his Name should be Renamed as
10-4732-2660_Samarkand Rubin_Brotteller 16cm_NSM.3dm so if the Original Name dont Contains an _AZ_ in his Name it should Renamed as _NSM and if it Contains an _AZ_ in his Name it is an _AZ File.
NSM is an 3D Scan that is Recreated in Rhino in Our System
and AZ is for the Documentation File from our Products.
Offline
It would be better if you had provided a bigger list of example filenames and example output, but let's see what we have so far.
Rules:
1) Insert: Insert "_NSM" as Suffix (skip extension)
2) Replace: Replace using wildcards "*_AZ_*_NSM" with "$1_$2_AZ" (skip extension)
Example:
VB.000_015_001_000_AZ_Samarkand_Rubin_Teller Flach 16cm.3dm VB.000_015_001_000_Samarkand_Rubin_Teller Flach 16cm_AZ.3dm
VB.000_015_001_000_Samarkand_Rubin_Teller Flach 16cm.3dm VB.000_015_001_000_Samarkand_Rubin_Teller Flach 16cm_NSM.3dm
Offline
Hallo und willkommen, exploid.
we have Files "Filename_AZ_Filename.3dm" and Files like "Filename.3dm"
for Normal .3dm Files >> "Filename_NSM.3dm"
for Files with that _AZ_ >>"Filename_AZ.3dm".
FROM:
"Filename_AZ_Filename.3dm"
TO:
"Filename_AZ.3dm".
-and-
FROM:
"Filename.3dm"
TO:
"Filename_NSM.3dm"
Try to add that to your code ( I hope I got it right, den4b? ):
var
REMatches: TWideStringArray;
// Bedingung .3dm
if vExt = '.3dm' then
begin
// split the filename into parts by utilizing regular expressions:
// SubMatchesRegEx(const Input, Find: WideString; const CaseSensitive: Boolean): TWideStringArray;
REMatches:=SubMatchesRegEx(FileName,'(.+)(_AZ_)(.+)',true);
if Length(REMatches) <=0 then
//no match, no _AZ_ found
FileName := FileName + '_NSM' + vExt
else
FileName := FileName + '_AZ' + vExt;
end;
// Bedingung .3dm
HTH?
Last edited by Stefan (2019-08-23 14:26)
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
if i add my Files i Got an Error
Unknown Identifier 'BaseName'
and ye i think you know what i am seaching for
Last edited by exploid (2019-08-23 11:27)
Offline
Sorry, exploid.
This was a copy from an another script.
Try to use FileName instead of BaseName....
Or use BaseName yourself everywhere instead of whole FileName:
BaseName: WideString;
BaseName := WideExtractBaseName(FileName);
FileName := BaseName + '_AZ' + vExt;
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
ok if i add FileName i got another error its Identifier expected.
Offline
ok if i add FileName i got another error its Identifier expected.
Read the message, on which Line the error occurs, then take a look on that line of code to spot the error.
You can post here the text of the whole error message and also the line of code in trouble (and your whole script, just in case).
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
ok the error is on else
FileName := FileName + '_NSM' + vExt;
else
FileName := FileName + '_AZ' + vExt;
the error is Fehler : Identifier expected
but i see no error there
Last edited by exploid (2019-08-23 12:35)
Offline