Desktop App with HTML control and JavaScript

Is it possible to use the HTMLviewer in a desktop app and call the ExecuteJavaScript method to set a text field or click a button in the Webpage displayed in the HTMLviewer? Could you do this if the fields or buttons were not visible?

Obviously you would somehow need to get the control ID back to the desktop program.

Yes, yes, and yes.

Unless you expect the field ID to change (for most cases this won’t happen) you don’t need to communicate HTML Viewer contents back out to your app. If you can avoid the need for that you’ll save yourself a bunch of trouble because there’s no official way to get data out of the HTML Viewer.

Tim, thanks for the insight.

I had the need to get the serial number from a computer (Mac and Windows). I wrote a desktop program but because of the variety of ODBC connections for various Windows versions I could not always connect to a MS-SQL server to save the data.

I ended up using the desktop app (compiled for both OS X and Windows) to get the serial number then launch a Web App in the HTMLviewer. To get the serial number into the Web App I put it in a URL parameter.

The final step would be to end the desktop app and use Javascript to “Click” a button on the Web App to do a graceful exit when the desktop app ends. Right now I just have a short timeout on the Web App since killing the desktop app just disconnects the HTMLview like closing the browser.

By the way I used SmartPacker (sold here in the Xojo store) to pack the Windows EXE and DLLs into a single EXE which makes it much cleaner.

Now I just have to figure out a bit of Javascript.