#1 2019-03-26 16:20

narayan
Senior Member
Registered: 2009-02-08
Posts: 471

ReNamer gives error while renaming pdf files using Pascal Script

When I try the pdf renaming PascalScript, ReNamer gives this error:

Preview process has been terminated due to a critical error:
Pascal Script Execute:
[Line 13] Exception: Access violation

I updated the file to the latest beta (dated 26-3-2019), but I get the same error.

Earlier the same script worked well.
(I have placed the pdfinfo.exe in the same folder as ReNamer.exe file.)

Offline

#2 2019-03-26 16:24

narayan
Senior Member
Registered: 2009-02-08
Posts: 471

Re: ReNamer gives error while renaming pdf files using Pascal Script

Since the forum has multiple versions of the pdf name script, I am reproducing my script below:

{ Extract PDF tag }

const
  PDF_INFO = 'pdfinfo.exe';
  PDF_TAG = 'Title';

function ExtractTagPDF(const Info, Tag: string): string;
var
  Lines: TStringsArray;
  I, Delim: Integer;
begin
  Result := '';
  Lines := WideSplitString(Info, #13#10);
  for I := 0 to Length(Lines)-1 do
  if WideSameText(Tag, Copy(Lines[i], 1, Length(Tag))) then
  begin
    Delim := WidePos(':', Lines[i]);
    if Delim > 0 then
    begin
      Result := WideCopy(Lines[i], Delim+1, WideLength(Lines[i]));
      Result := Trim(Result);
    end;
  end;
end;

var
  Command, Output: string;
  TagValue: string;

begin
  Command := '"'+PDF_INFO+'" "'+FilePath+'"';
  ExecConsoleApp(Command, Output);
  TagValue := ExtractTagPDF(Output, PDF_TAG);
  FileName := TagValue + WideExtractFileExt(FileName);
end.

Offline

#3 2019-03-26 16:25

narayan
Senior Member
Registered: 2009-02-08
Posts: 471

Re: ReNamer gives error while renaming pdf files using Pascal Script

Line#13 seems to be this: Lines := WideSplitString(Info, #13#10);

Offline

#4 2019-03-26 19:17

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 1,161

Re: ReNamer gives error while renaming pdf files using Pascal Script

Lines: TStringsArray;
Lines := WideSplitString(...);

Do you see the error?

If not, see the list of functions:
http://www.den4b.com/wiki/ReNamer:Pasca … :Functions

I will take a look later on if you got it ;-)


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

#5 2019-03-27 04:48

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,440

Re: ReNamer gives error while renaming pdf files using Pascal Script

Thanks for reporting.

It appears to be a significant interoperability issue between the newer compiler (FPC 3) and the scripting engine (Pascal Script).

This issue seems to affect all pascal script functions which return dynamic arrays, such as WideSplitString.

The investigation continues...

Offline

#6 2019-04-24 06:03

narayan
Senior Member
Registered: 2009-02-08
Posts: 471

Re: ReNamer gives error while renaming pdf files using Pascal Script

Hi

Is there a workaround for this issue? IMHO reverting to older version is fine as long as it works.

With the latest issue, we cannot use Pascalscript for pdf-renaming at all.

My collection of downloaded pdf files is increasing day-by-day, so this is a major issue for me!

Offline

#7 2019-04-24 14:55

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,440

Re: ReNamer gives error while renaming pdf files using Pascal Script

narayan wrote:

Is there a workaround for this issue?

Yes, there is, and it is already available in ReNamer v7.0.0.4 Beta cool

http://www.den4b.com/changelogs/renamer/7..7.0.0.4

Offline

Board footer

Powered by FluxBB