WIN32OLE, IE, open an html document

Ruby 1.8.6, Windows XP, IE6 and 7:

I think the following code SHOULD open a document but I get an error instead..
list is the string which is stored into the HTML document (I'm good with variable naming).

File.open('c:/EmailGroups.html', 'w') { |f| f << list }
ie = WIN32OLE.new('InternetExplorer.Application')
ie.Application.stop
while ie.Busy do
end
ie.Visible = true
while ie.Busy do
end
puts "c:/EmailGroups.html" if File.exist?('EmailGroups.html' )
url = "c:/EmailGroups.html"
ie.Document.URL = url
while ie.Busy do
end

···

________
And here is the error:
init.rb:116:in `method_missing': (WIN32OLERuntimeError)
    OLE error code:80070005 in htmlfile
      Access is denied.

    HRESULT error code:0x80020009
      Exception occurred. from init.rb:116

Line 116 is : ie.Document.URL = url.

Any help .. will be very appreciated :slight_smile:

Thank you,

--Aldric

Aldric Giacomoni wrote:

Ruby 1.8.6, Windows XP, IE6 and 7:

I think the following code SHOULD open a document but I get an error instead..
list is the string which is stored into the HTML document (I'm good with variable naming).

File.open('c:/EmailGroups.html', 'w') { |f| f << list }
ie = WIN32OLE.new('InternetExplorer.Application')
ie.Application.stop
while ie.Busy do
end
ie.Visible = true
while ie.Busy do
end
puts "c:/EmailGroups.html" if File.exist?('EmailGroups.html' )
url = "c:/EmailGroups.html"
ie.Document.URL = url
while ie.Busy do
end
________
And here is the error:
init.rb:116:in `method_missing': (WIN32OLERuntimeError)
   OLE error code:80070005 in htmlfile
     Access is denied.

   HRESULT error code:0x80020009
     Exception occurred. from init.rb:116

Line 116 is : ie.Document.URL = url.

Any help .. will be very appreciated :slight_smile:

Thank you,

--Aldric

Fixed ... I just did ie.navigate "myurl.html" instead and got rid of all the 'while busy' loops, which were unneeded.