Lookout

cancel
Showing results for 
Search instead for 
Did you mean: 

How to print a report

How Do I generate a report and print it in Lookout 5.1
0 Kudos
Message 1 of 7
(3,926 Views)
What I always do is create a panel for my report. Make this panel look just how you want your report to look. Then just connect the print data member of your panel to some sort of trigger. I use a Time-of-Day timer to initiate a print daily. It is also a good practice to make your panel background white and whatever data you are displaying black so you will use less ink. Just remember when you print a panel, it prints at the size designated in the panel properties. If you hit the "restore down" icon you will see your panel size.
0 Kudos
Message 2 of 7
(3,926 Views)

Hello Lloyd,

Like Carl said, using a Panel for creating a report and printing it with its print datamember is the easiest solution.

If you want fancier reports, and additionally want soft copies of them, you can use the Report object. This as you know generates fancy HTML reports. It's kinda powerful because you can include additional stuff in the report using its include datamember.

The problem is, there's no straightforward way of printing the HTML report generated by this Report object from within Lookout. One can always open the HTML file in a browser and print it from there. This requires user intervention and may not be desirable.

Also, if we use the Run and the DOS 'print' command, the HTML tags are printed as plain text (and not the web-page).

The workaround therefore is to use the Run object to launch the HTML file in Internet Explorer and print it. We can automate the printing with some scripting. The best part is, this script can be part of the HTML report itself as we shall see.

The attached file 'onload.txt' has a javascript function to call and execute the "WebBrowser" control. The function WebBrowser1.ExecWB(6, -1); does the main work. Here, '6' is equivalent of "print" command, and '-1' is to suppress the print confirmation dialog.

And then we have a script for registering and using the OnLoad event. This will fire when the HTML file loads in the browser.

We include this 'onload.txt' in our HTML report (see attached LKS file) using the include datamember and launch the IE with it (using the Run object). As soon as the page loads, the page gets printed to the default printer (without prompting the user). As they say, "look ma, no hands!" 🙂

If you want the browser to close itself when it's done printing, you may add the following line

self.close();

as the last line of the printit() function in the onload.txt.

You can of course use a single PushButton in Lookout for generating and printing, etc.

Hope this gives you an alternative. See the attached Lookout process file for details.

Regards,

Khalid


Download All
0 Kudos
Message 3 of 7
(3,926 Views)

I just realized there's an easier way of printing the HTML report generated by the Report object: use the Lookout WebBrowser ActiveX Control Object in Lookout to display the report file on a panel, and print the panel using its 'print' datamember!

See attached LKS for an example.

Regards,

Khalid


0 Kudos
Message 4 of 7
(3,926 Views)
I am dealing with a single computer with lookout monitoring my process, will the report object work for me without being on a network?
0 Kudos
Message 5 of 7
(3,926 Views)

Yes, the Report object and the above approach of using the Lookout WebBrowser ActiveX Object will work just fine on a standalone computer not on a network.

Instead of the web URL, you will supply the local filepath to your HTML report, E.g., "c:\temp\test.htm"

Hope this helps.

Khalid

0 Kudos
Message 6 of 7
(3,926 Views)
thanks so much for the advise, I am going the panal route. Looks like it will work just fine. Lloyd
0 Kudos
Message 7 of 7
(3,926 Views)