You are not logged in.
can the Problem be that it isnt in an while loop?
Offline
Have you tried it with a simple set of Insert and Replace rules as described in a previous post?
Offline
i found the error it was ;
old Code
// 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 then
FileName := FileName + '_NSM' + vExt;
else
FileName := FileName + '_AZ' + vExt;
end;
// Bedingung .3dm
working Code
// 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 then
FileName := FileName + '_NSM' + vExt
else
FileName := FileName + '_AZ' + vExt
end;
// Bedingung .3dm
The Compiler didnt Crashs anymore but the Filtering isnt work .3dm with _AZ_ in his name is still named as _NSM
Last edited by exploid (2019-08-23 13:18)
Offline
Ah, I see. (copy&paste error)
There should be only one semicolon, the one at the end.
FileName := FileName + '_NSM' + vExt
else
FileName := FileName + '_AZ' + vExt;
EDIT:
Oh, I am too late, you already god it.
@den4b
He need this as part of a bigger code, see his code block at the first page.
Last edited by Stefan (2019-08-23 14:24)
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
No Problem
but it looks like REMatches gives no Result so the algorythmus dosnt work to check the files so its many files to check i change with this script like 200 or 300 items.
Checks this system with regex each file or all files and name all as _AZ if one will be found?
i let the Script give me an Output from REMatches the result is Fehler: Type mismatch
Last edited by exploid (2019-08-23 16:45)
Offline
i Got it
var
vExt: WideString;
REMatches: TWideStringArray;
BaseName: WideString;
// Dateiendung Filtern
vExt := WideExtractFileExt(FilePath);
BaseName := WideExtractBaseName(FilePath);
// Dateiendung Filtern
// 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(BaseName,'(.+)(_AZ_)(.+)',true);
if (Length(REMatches) <= 0) then
//no match, no _AZ_ found
FileName := FileName + '_NSM' + vExt
else
FileName := FileName + '_AZ' + vExt;
end;
// Bedingung .3dm
i used now BaseName and the change to your code is that i dont pick the FileName i pick the FilePath to the file, after that it works fine thanks for your Great help.
Schöne Grüße vom Saarland
Last edited by exploid (2019-08-23 17:02)
Offline