question about ruby under windows

Discussion in 'Ruby' started by MENON Jean-Francois, Oct 5, 2003.

  1. hello,

    is it possible in a ruby script to make Internet Explorer and/or
    Netscape open a URL?
    thx

    jf
    MENON Jean-Francois, Oct 5, 2003
    #1
    1. Advertising

  2. MENON Jean-Francois

    James Britt Guest

    MENON Jean-Francois wrote:
    > hello,
    >
    > is it possible in a ruby script to make Internet Explorer and/or
    > Netscape open a URL?
    > thx




    Something like this should work:


    require 'win32ole'
    ie = WIN32OLE.new('InternetExplorer.Application')
    ie.visible = true
    ie.navigate( "http://www.ruby-doc.org" )


    You can also use backticks to launch a browser as if from the command line:

    exe = 'e:/Program Files/mozilla.org/Mozilla/mozilla.exe'
    url = "http://www.ruby-doc.org"
    `start "#{exe}" "#{url}"`



    James Britt

    >
    > jf
    >
    >
    James Britt, Oct 5, 2003
    #2
    1. Advertising

  3. "James Britt" <> schrieb im Newsbeitrag
    news:...
    > MENON Jean-Francois wrote:
    > > hello,
    > >
    > > is it possible in a ruby script to make Internet Explorer and/or
    > > Netscape open a URL?
    > > thx

    >
    >
    >
    > Something like this should work:
    >
    >
    > require 'win32ole'
    > ie = WIN32OLE.new('InternetExplorer.Application')
    > ie.visible = true
    > ie.navigate( "http://www.ruby-doc.org" )
    >
    >
    > You can also use backticks to launch a browser as if from the command

    line:
    >
    > exe = 'e:/Program Files/mozilla.org/Mozilla/mozilla.exe'
    > url = "http://www.ruby-doc.org"
    > `start "#{exe}" "#{url}"`


    On most systems even:

    system( ENV["COMSPEC"], "/c", "start", "http://www.ruby-doc.org" )

    which will launch the default browser.

    robert
    Robert Klemme, Oct 5, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. hshdude
    Replies:
    12
    Views:
    1,050
    Dimitri Maziuk
    Nov 4, 2004
  2. Michael Mueller
    Replies:
    0
    Views:
    129
    Michael Mueller
    Jun 2, 2005
  3. Ronald Fischer
    Replies:
    2
    Views:
    125
    Ronald Fischer
    Jun 22, 2007
  4. Patrick Li
    Replies:
    1
    Views:
    107
    Patrick Li
    Aug 24, 2008
  5. Stefan Ram
    Replies:
    5
    Views:
    150
    Stefan Ram
    Mar 17, 2014
Loading...

Share This Page