I need to create an automated report generator - Using BKS Shorts. So far I have only working with it in a web app, it does work very good. My plan is to create either a web app (who’s page is never seen) or better an Console Service App. All of the info to select which report is in the database.
Since this uses an HTML viewer, is there a way to incorporate that into a console app? I don’t think so, but what do you guys think?
The htmlviewer in the project was only for the html renderer output. It’s not a requirement of shorts. The graphics engine for console provides wildly different measurements sometimes, so I can’t say I’d trust the output from anything but a a desktop app.
More details, of course, always help provide a better answer.
From the user aspect, what exactly are you trying to build?
Technically you can have a WebView without window in a console app and then run the event loop for a second, so the asynchronous loading of the website can happen.
A bit tricky, but I think people have done it before on macOS.
Basically what I am trying to build is an automated way of creating a report, then emailing it.
The target will be windows for development then Raspberry Pi for production. I’ll use a data base to store the report name (report created using the report builder in Shorts), from and to dates/times and the date/time to run the report.
Nobody will actually look at or work directly with the automator, only the reports that it emails.
Web app may be easiest to create, the only concern I have, and have not tested yet, is to know if the the page needs to be spawned (by a client request) before page elements can be used. Not sure if code can be used to spawn the page (if necessary) or where it should go? I think in the app, since the session would need to be created by a client request, but may be easier to do do in Session.
What kind of output are you trying to create though? Shorts relies on the Graphics class to get text sizes. The Graphics class reports wildly different and usually wrong size information for console / web apps. You will be unable to create anything other than a text-only report without building a Desktop app (since Xojo’s PDFGraphics is going to suffer the same flaw).
If you build a report with static sizes (like you aren’t using expandable text boxes or dynamic positioning) you should be able to run it from console or web. It’s when you ask Shorts (or the Graphics class) for the size of text that the difference in Graphics frameworks comes into play.
After doing a lot of experimenting, I have been able to boil down Shorts to only those parts that are required to create a report.
If using a console app, how do I create the graphics class? I can use either the latest Xojo version or 2019R1.1
If using a web app
Which version is best? Web1 or Web2
I would use a timer to check on the actual time so the report is created when desired. Would this go in the App, Session or a page? Recall that no human will be looking at this on a browser. One thought is to use the Timer in the App, which at the right time creates a new page in session. Not sure if that is correct or not.
Ideally, this would be done in a console app, but whichever way is going to be best. The biggest consideration for these, is that when on the target Linux Raspberry Pi machine, I have all of my apps set to auto start and if they are terminated for some reason, the OS will start it back up. This has worked for both Console and Web apps.
I was going to ask, but for the Mac, I know it’s possible to add the AppKit framework to a console application, but I think you’d have to create a window to add a WebView to in order for it to render, and even then, I honestly not sure if it would work or how reliably.
Pick which ever you like but Web 1 is dead and buried as far as Xojo is concerned so …
If you use a Picture then it will work in either a web or console projects (since web projects are basically console apps in disguise)