how to access a script variable from Delphi; prin

edited 1:47AM in FastReport 3.0
1.
PrinterOptions.Printer returns always 'Default', but I need the name of the
Printer. Even when I change the printer in Print Dialog, it would return
'Default' again.
I need a printer log, it is important to know which printer exact has
printed the report.

2.
I try to create a variable on the top of the script, to give it a value and
then to access it from Delphi:

FastReport:
[B]var[/B]
PrintLog:string;
PrintLog := 'test';

Delphi:
P:=frxReport1.Script.Variables ['PrintLog'];
  if not VarIsNull(p) then
 showmessage(Vartostr(P));

It returns always null!

in 2.53 was possible to access the variable in this way:
P:=frVariables['PrintLog'];
And now?

Comments

  • edited 1:47AM
    Use TfrxReport.OnPrintReport event. The name of the currently selected printer is in frxPrinters.Printer.Name.
  • edited 1:47AM
    and what about the second question.
    How to access script variable from Delphi?
    Thanks.
  • edited 1:47AM
    Try to use frxReport.Script1.Variables
  • edited 1:47AM
    I have tried it (please, see the code at the top of the topic).
    But I receive always NULL , I have tried many times)!!!
  • edited 1:47AM
    You tried Report.Script. My suggestion is about Report.Script1.
  • edited 1:47AM
    Thanks, that returns really the value. But what is Script1? Why have we 2 Objects : Script and Script1 and what's the difference?
  • edited 1:47AM
    Report.Script1 is for internal script; it is cleared and filled with compiled script each time before running a report. Report.Script is for external purposes such as adding variables, functions etc. Maybe I will join these two scripts in the future releases.

Leave a Comment