Is there a way to create a an HTML Viewer in a console app?

Hello all,

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?

Tim

No
HTMLviewer needs a Window server
Not a version of Windows but the process that draws windows menus, and all manner of UI

But if you have short working in a web app - its basically a console app already so it would seem you can use Shorts in a console app

Where’s @bkeeney ? or @Tim ?
Either of them could tell you better than I can

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?

Mac? Windows? Linux?

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.

Hello all,

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.

Tim

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).

1 Like

Hi Tim,

Interesting…

My current use utilizes an MBS plugin for creating pdf files. Which is exactly the output I am looking for, a pdf that will be emailed.

**Edit
BTW, was starting with the Web API 1 using Xojo 2019R1.1

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.

1 Like

Depending on how it’s coded, if Shorts can output directly to PDF through one of the available plugins, that might be the best… that way the output would not depend on which Xojo framework is used.

I know for PDFs I do the text measurements in the Einhugur plugin for my hand coded reports.

-Karen

1 Like

Thank you all,
Appreciate the hints! Ill be looking into more of this.

Tim

1 Like

Hello All,

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.

Two questions:

  1. If using a console app, how do I create the graphics class? I can use either the latest Xojo version or 2019R1.1

  2. 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.

Thanks all,
Tim

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.

A Picture then use its graphics property

Highly subjective
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)

True, even if you change the question to “Which version is worse? Web1 or Web2”.

But in the latter case I would argue “Web1”, as it is (as you said) a dead horse which no one should ride any longer.

Thanks guys!
Tim

Hi all,

Any feedback in the following?
Tim