On 7/11/06, Bret Pettichord wrote:
This bothers me a lot. I need to add some diagnostics to IE.attach in 1.5 trunk and then have you try it again and send the diagnostics report. Don't let me forget about this.
BretBret
I made some time to do some digging into the code (1.5.1.1054) and discovered this in the IE::_find method
class IE
...
def self._find(how, what)
shell = WIN32OLE.new("Shell.Application")
ieTemp = nil
shell.Windows.each do |window|
next unless (window.path =~ /Internet Explorer/ rescue false)Seems that in this context !~ would be desired in that last line, so I tried that in place of the =~ and it worked for me -- my attach code seems to work again.
What do you think?
Thanks for digging in to the code and sharing what you found. It's hard for me to understand where the logic error would be in this code, however. I accept that you changed it and it worked, but the =~ operator will return a number (= true) if there is a match, other wise nil (= false). Thus that line should skip ahead to the next window unless it is an Internet Explorer window. So it sounds right to me.
I should note however, that this is something that i recently changed and something which i haven't figured out how to automate a unit test for yet. I did do a lot of manual testing.... So i could accept that there is an error in here pretty easily.
I actually added this line because i was doing IE.attach(:title, //) and this was attaching to an outlook window, which cause me problems later on. This line screened that out (or maybe that case was what prompted the rescue false clause -- an idiom i've inveigled against before and yet one more reason why this code needs automated tests.)
I'll have to make this code testable or at least put in some more diagnostics so we can get to the bottom of things.
Bret
_______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general
