[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

WIN32OLE, IE, open an html document..

aldric[removeme]

1/23/2009 7:28:00 PM

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 :)

Thank you,

--Aldric
1 Answer

aldric[removeme]

1/23/2009 9:42:00 PM

0

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 :)
>
> Thank you,
>
> --Aldric
Fixed ... I just did ie.navigate "myurl.html" instead and got rid of all
the 'while busy' loops, which were unneeded.