question about ruby under windows

  • Thread starter MENON Jean-Francois
  • Start date
M

MENON Jean-Francois

hello,

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

jf
 
J

James Britt

MENON said:
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
 
R

Robert Klemme

James Britt said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top