From: Ernest Ellingson Date: 2005-07-07T21:15:46+09:00 Subject: Re: win32ole help daz wrote: > Ernest Ellingson wrote: > >>require 'win32ole' >>WinHttpRequestOption_EnableRedirects = 6 >>web = WIN32OLE.new("WinHttp.WinHttpRequest.5.1") >>web.Option(WinHttpRequestOption_EnableRedirects)= false # syntax error >> > > > EDIT (was same reply as Pit gave) > > I don't have WinHttp on this machine so I can't check this. > > >>C:/RubyScripts/postFrostHTTP.rb:4:in `method_missing': Option >>(WIN32OLERuntimeError) >> OLE error code:80020004 in >> >> HRESULT error code:0x80020004 >> Parameter not found. from C:/RubyScripts/postFrostHTTP.rb:4 >> > > > (( web.Option[6] = false )) > If WIN32OLE is using the hash notation to access attributes, > there would be a problem with a method called '6' (illegal). > > > You could try examining the Option object with something like: > > web.Option.each { |opt| p opt } # might not have an 'each' method > > Use Ruby's "introspection" to nosey around and see what's available: > > # may be useful to quote on this newsgroup > p web.Option.class > puts '==========' > puts((web.Option.methods - Object.methods).sort) > puts '==========' > puts((web.methods - Object.methods).sort) > puts '==========' > > # If (e.g.) 'ole_methods' is in the list > puts web.ole_methods > > > I'm fairly confident with Ruby but I always have to mess around > trying different hacks with COM objects. Someone who uses them > twice a year is in much the same position as a COM newbie. > > > daz > > > Thanks for the hint. ran into a few problems web.Option.each failed web.Option.methods doesn't exist changed to puts((web.methods - Object.methods).sort) this yielded the following list [] []= _getproperty _invoke _setproperty each invoke method_missing ole_free ole_func_methods ole_get_methods ole_method ole_method_help ole_methods ole_obj_help ole_put_methods setproperty Expeimented with the setproperty method I used web.setproperty('Option', WinHttpRequestOption_EnableRedirects, false) That did the trick. Thanks again Ernie