Opening urls

hi could any one tell me how to open a web page in ruby i can open files
on my pc IO.popen(wmp){file location}
but cant seem to do web pages also my browser is chrome do i need i.e
instead
thanks

···

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

hi could any one tell me how to open a web page in ruby

require 'open-uri'
open 'http://example.com/foo' do |web|
  # ...
end

That's one way.

i can open files
on my pc IO.popen(wmp){file location}

I seriously doubt that this is how you open files.

but cant seem to do web pages also my browser is chrome do i need i.e
instead

No, never. Also, your browser has nothing to do with Ruby's ability to make
network connections.

Or is that what you're asking? Or are you asking how to get Ruby to point your
web browser to that location?

···

On Tuesday, May 18, 2010 01:47:39 pm Mark Kirby wrote:

sorry i use IO.popen(file location here) to open files works fine i
wanted my program to open the page with a specifide command

···

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

Or is that what you're asking? Or are you asking how to get Ruby to
point your
web browser to that location?

yes this is what i want please help me

···

--
Posted via http://www.ruby-forum.com/\.

Mark Kirby wrote:

Or is that what you're asking? Or are you asking how to get Ruby to
point your
web browser to that location?

yes this is what i want please help me

There is a pretty good blog devoted to automating Windows using Ruby.
If you are using Internet Explorer you may want to check it out. The
URL is Ruby on Windows: ie\. I've used the
information there to write Ruby scripts to automatically open Internet
Explorer and navigate to a web page. It required 'win32ole', which
comes standard with the Ruby windows installer.

--Alex

···

--
Posted via http://www.ruby-forum.com/\.

Alex DeCaria wrote:

Mark Kirby wrote:

Or is that what you're asking? Or are you asking how to get Ruby to
point your
web browser to that location?

yes this is what i want please help me

There is a pretty good blog devoted to automating Windows using Ruby.
If you are using Internet Explorer you may want to check it out. The
URL is Ruby on Windows: ie\. I've used the
information there to write Ruby scripts to automatically open Internet
Explorer and navigate to a web page. It required 'win32ole', which
comes standard with the Ruby windows installer.

--Alex

thanx ill try this

···

--
Posted via http://www.ruby-forum.com/\.

As an example, here is a program that will open internet explorer,
navigate to a flight tracker webite, and automatically refresh every 60
seconds.

--Alex

require 'win32ole'
print "Enter Airline and Flight Number: "
flight = gets.strip
n = 60
browser = WIN32OLE.new('InternetExplorer.Application')
browser.navigate("http://www.flightaware.com/live/flight/#{flight}")
browser.visible = true
loop do
  sleep(n)
  browser.refresh
  print Time.now, "\n"
end

···

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