Murga-Projects Forums
Opening HTML Reports - Printable Version

+- Murga-Projects Forums (
+-- Forum: Project Forums (/forumdisplay.php?fid=1)
+--- Forum: MurgaLua - General (/forumdisplay.php?fid=2)
+--- Thread: Opening HTML Reports (/showthread.php?tid=387)

Opening HTML Reports - RogerL - 07-11-2010 09:01 AM

I plan to write some HTML reports to a file from my murgaLua program and then call the end-users system to open the file in a browser to display the report (for viewing and/or printing). Just wondering how in murgaLua I can open a file using whatever is the default program (in this case a browser) for a specific file type.

RE: Opening HTML Reports - mikshaw - 07-13-2010 09:51 AM

FLTK has a basic browser (Fl_Help_View) you can use to display the pages, but it doesn't have print functionality built in, as far as I know.

Running a default browser is specific to each user's system, so if you want to do this you'd have to determine what operating system is being used, and then figure out (via external script, most likely) what the default is. I don't believe this is something that Lua can do by itself. Also keep in mind that default applications are also dependent on the user's desktop environment.

RE: Opening HTML Reports - RogerL - 07-13-2010 02:49 PM

Thanks - I had managed to do it in Jabaco (jvm clone of VB6) by using some functionality as follows :

If java#awt#Desktop.isDesktopSupported Then
Dim d As java#awt#Desktop = java#awt#Desktop.getDesktop File(filename))
End If

But I guess that's java specific.[/i]

RE: Opening HTML Reports - jpjacobs - 07-15-2010 12:51 AM

For most linuxes, a sensible try could be using /etc/alternatives/x-www-browser or firefox, and wasn't there in windows an open which autodetects which filetype is being opened, and selects the default?
Otherwise, there is LuaCom included in murgaLua (look in the bin/windows directory in the tarbal), although I have no clue how that exactly works, but it is capable of at least opening up excel and the like ... might do explorer too perhaps...



RE: Opening HTML Reports - mikshaw - 07-16-2010 12:10 AM

A while back I was testing out a desktop-independent file manager that used a unique method to determine defaults. It had a script that included a long series of applications for each desired action, and tested each one in the series until it found an installed executable. I could tell you how to do this in Linux (OSX can probably work the same way), but I don't know if you can do it in Windows.

There were some older distros that used "mozilla" or "netscape" as default, but I found that I always had to change that. The same could be said for "firefox" today, since the variety of popular browsers has been increasing in recent years.

I'm kind of surprised that applications don't make more use of user environment variables like EDITOR and PAGER. The /etc/alternatives concept is ok, but since they're links they're not user configurable.