[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

open browser

Christian Kerth

12/6/2007 11:52:00 AM

Is there a way to open a browser window from ruby, that works on
windows, linux and macos?

thx ck
--
Posted via http://www.ruby-....

12 Answers

fedzor

12/6/2007 12:28:00 PM

0

Check out launchy. Its good for opening native applications.

http://rubyforge.org/projects/copiou...

launchy is there (used by heel).


On Dec 6, 2007, at 6:52 AM, Christian Kerth wrote:

> Is there a way to open a browser window from ruby, that works on
> windows, linux and macos?
>
> thx ck
> --
> Posted via http://www.ruby-....
>


John Joyce

12/6/2007 12:42:00 PM

0


On Dec 6, 2007, at 5:52 AM, Christian Kerth wrote:

> Is there a way to open a browser window from ruby, that works on
> windows, linux and macos?
>
>
Not really easily.
You could possibly write code for each OS and many different possible
browsers, then wrap all of it with a detect system function that
which system to run code for, then check for browsers you can open...

However, if you're considering using a web-based user-interface for
cross-platform, that's not a bad idea.
Thus the easiest way to open a browser window on 3 platforms is to
get users to click on a link or bookmark!

Christian Kerth

12/6/2007 12:47:00 PM

0

thefed wrote:
> Check out launchy. Its good for opening native applications.
>
> http://rubyforge.org/projects/copiou...
>
> launchy is there (used by heel).

I installed this launchy gem and it works in general, but obviously not
in my context. I have a small wxruby app with just a task bar tray menu.
When i click on this tray icon i want the appolication to open the
browser and point to a certain address. The launchy call is processed
when i kill the application, not at clicking time.

any ideas? thx ck
--
Posted via http://www.ruby-....

Xavier Noria

12/6/2007 3:46:00 PM

0

On Dec 6, 2007, at 1:47 PM, Christian Kerth wrote:

> thefed wrote:
>> Check out launchy. Its good for opening native applications.
>>
>> http://rubyforge.org/projects/copiou...
>>
>> launchy is there (used by heel).
>
> I installed this launchy gem and it works in general, but obviously
> not
> in my context. I have a small wxruby app with just a task bar tray
> menu.
> When i click on this tray icon i want the appolication to open the
> browser and point to a certain address. The launchy call is processed
> when i kill the application, not at clicking time.

The basic idea in pseudocode would be:

command = windows ? 'start /B' : macosx ? 'open' : '???'
system(%Q[#{command} "#{url}"])

The /B flag prevents start from creating a Window on Windows.

Problem is I don't think there's a cross-desktop/window manager
launcher for Linux. You could look for "/usr/bin/firefox" or whatever
but what if it is there but user's default browser is Konqueror?

-- fxn


Tanner Burson

12/6/2007 9:20:00 PM

0

Note: parts of this message were removed by the gateway to make it a legal Usenet post.

On Dec 6, 2007 6:47 AM, Christian Kerth <christian.kerth@dynamicmedia.at>
wrote:

> thefed wrote:
> > Check out launchy. Its good for opening native applications.
> >
> > http://rubyforge.org/projects/copiou...
> >
> > launchy is there (used by heel).
>
> I installed this launchy gem and it works in general, but obviously not
> in my context. I have a small wxruby app with just a task bar tray menu.
> When i click on this tray icon i want the appolication to open the
> browser and point to a certain address. The launchy call is processed
> when i kill the application, not at clicking time.
>

Have you tried forking, or launching a new ruby process to execute the
launchy call?


>
> any ideas? thx ck
> --
> Posted via http://www.ruby-....
>
>


--
===Tanner Burson===
tanner.burson@gmail.com
http://www.tanner...

ara.t.howard

12/6/2007 9:32:00 PM

0


On Dec 6, 2007, at 8:45 AM, Xavier Noria wrote:

> Problem is I don't think there's a cross-desktop/window manager
> launcher for Linux. You could look for "/usr/bin/firefox" or
> whatever but what if it is there but user's default browser is
> Konqueror?

it's called 'htmlview'

a @ http://codeforp...
--
it is not enough to be compassionate. you must act.
h.h. the 14th dalai lama




Xavier Noria

12/6/2007 10:01:00 PM

0

On Dec 6, 2007, at 10:31 PM, ara.t.howard wrote:

>> Problem is I don't think there's a cross-desktop/window manager
>> launcher for Linux. You could look for "/usr/bin/firefox" or
>> whatever but what if it is there but user's default browser is
>> Konqueror?
>
> it's called 'htmlview'

Is it normally installed?

ara.t.howard

12/6/2007 10:46:00 PM

0


On Dec 6, 2007, at 3:00 PM, Xavier Noria wrote:

> Is it normally installed?

it's pretty common - but not universal. i would think something like

system "htmlview #{ uri } || firefox #{ uri } || mozilla #{ uri }"

etc would work. see what launchy does.

a @ http://codeforp...
--
it is not enough to be compassionate. you must act.
h.h. the 14th dalai lama




Joel VanderWerf

12/7/2007 4:01:00 AM

0

Xavier Noria wrote:
> Problem is I don't think there's a cross-desktop/window manager launcher
> for Linux. You could look for "/usr/bin/firefox" or whatever but what if
> it is there but user's default browser is Konqueror?

The general opener in KDE is:

kfmclient exec <url-or-file>

--
vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407

Peter Bunyan

12/7/2007 7:59:00 AM

0

Christian Kerth wrote:
> Is there a way to open a browser window from ruby, that works on
> windows, linux and macos?
>
> thx ck

I'm not 100% sure, but I think you can just launch a URL in Windows and
it will open your default web browser at that page.

--
Posted via http://www.ruby-....