You are not logged in.
Pages: 1
Hi
this is part of code i done before was working fine till today,
It's not running anymore, [Line 15] Error: Type mismatch, can you please help
var Files : TStringsArray;
Parts : TStringsArray;
Path : WideString;
begin
Parts := SubMatchesRegEx(FileName, '(.+\))', False);
ShowMessage( 'Parts[0] = ' + Parts[0] );
Path := WideExtractFilePath(FilePath);
SetLength(Files, 0 );
WideScanDirForFiles( Path, Files, False, False, False, Parts[0] + '*.mp4' );
WideScanDirForFiles( Path, Files, False, False, False, Parts[0] + '*.mkv' );
WideScanDirForFiles( Path, Files, False, False, False, Parts[0] + '*.avi' );
WideScanDirForFiles( Path, Files, False, False, False, Parts[0] + '*.m4v' );
ShowMessage( 'Files = ' + IntToStr(length(Files)) );
end.
Offline
You need to change the type of Files and Parts variables from TStringsArray to TWideStringArray type.
TStringsArray type has been deprecated since ReNamer 5.75. It has been replaced by TWideStringArray type. In ReNamer 6.7, all function declarations have been updated to eliminate the use of the legacy TStringsArray type, in favor of TWideStringArray type.
Offline
I have amended the variables type from TStringsArray to TWideStringArray type
Now I am getting different error
[Line 9] Exception: Out Of Range
[Line 15] Exception: Out Of Range
also I tried
regarding Line 9
ShowMessage( 'Parts[0] = ' + WideToAnsi(Parts[0]) );
and Line 15
WideScanDirForFiles( Path, Files, False, False, False, Parts[0] + AnsiToWide('*.mp4') );
and got the same error : Exception: Out Of Range
Offline
"Exception: Out Of Range" means here:
there is nothing in 'Parts[0]', as probably your RegEx doesn't much anything?
To avoid that error message, you can use:
Parts := SubMatchesRegEx(FileName, '(.+\))', False);
if Length(Parts) <1 then exit;
..... your code here
-or-
Parts := SubMatchesRegEx(FileName, '(.+\))', False);
If Length(Parts)>0 Then
begin
..... your code here
end;
- - -
If you need help on RegEx, post some example file names and what you expect the RE should match.
- - -
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
Thank you for your help
Offline
Pages: 1