News : The level of daily SPAM has reached insane proportions, all registrations are now manual. I ask you to send me an e-mail (john (at) murga (dot) org), to confirm that you want me to create an account for you.


Post Reply  Post Thread 
Opening HTML Reports
Author Message
RogerL
Junior Member
**


Posts: 4
Group: Registered
Joined: Dec 2009
Status: Offline
Reputation: 0
Post: #1
Opening HTML Reports

Hi,
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.
Thanks
RogerL

07-11-2010 09:01 AM
Find all posts by this user Quote this message in a reply
mikshaw
Senior Member
****


Posts: 522
Group: Registered
Joined: Apr 2007
Status: Offline
Reputation: 5
Post: #2
RE: Opening HTML Reports

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.

07-13-2010 09:51 AM
Find all posts by this user Quote this message in a reply
RogerL
Junior Member
**


Posts: 4
Group: Registered
Joined: Dec 2009
Status: Offline
Reputation: 0
Post: #3
RE: Opening HTML Reports

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
d.open(New File(filename))
End If

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

07-13-2010 02:49 PM
Find all posts by this user Quote this message in a reply
jpjacobs
Member
***


Posts: 113
Group: Registered
Joined: Jul 2007
Status: Offline
Reputation: 0
Post: #4
RE: Opening HTML Reports

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

Greetz,

Jan-Pieter

07-15-2010 12:51 AM
Find all posts by this user Quote this message in a reply
mikshaw
Senior Member
****


Posts: 522
Group: Registered
Joined: Apr 2007
Status: Offline
Reputation: 5
Post: #5
RE: Opening HTML Reports

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.

07-16-2010 12:10 AM
Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump: