how to access a script variable from Delphi; prin

edited 5:13AM 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 5:13AM
    Use TfrxReport.OnPrintReport event. The name of the currently selected printer is in frxPrinters.Printer.Name.
  • edited 5:13AM
    and what about the second question.
    How to access script variable from Delphi?
    Thanks.
  • edited 5:13AM
    Try to use frxReport.Script1.Variables
  • edited 5:13AM
    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 5:13AM
    You tried Report.Script. My suggestion is about Report.Script1.
  • edited 5:13AM
    Thanks, that returns really the value. But what is Script1? Why have we 2 Objects : Script and Script1 and what's the difference?
  • edited 5:13AM
    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

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.