From: Bret Pettichord Date: 2008-08-11T23:35:28+09:00 Subject: Re: if expression within a thread ------=_Part_43753_30807176.1218465467732 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Calls to windows API's will block *all* threads in Ruby. This is why Watir's click_no_wait method spawns a process and not merely a thread. Bret On Mon, Aug 11, 2008 at 6:37 AM, aidy wrote: > Hi, > > I am using Watir and Autoit (win32 test tool) > > Here is my code > > > autoit = WIN32OLE.new("AutoItX3.Control") > t = Thread.new(autoit) { > if autoit.WinWait("Authentication Required", "", 5) == > 1 > autoit.Send(username) > autoit.Send("{TAB}") > autoit.Send(password) > autoit.Send("{ENTER}") > end > } > m = Thread.new(self) {self.goto(url)} > m.join; t.join > > > When a user navigates to a url, an authentication dialog may appear. > > If this appears I would like to enter a username and password > > If I manually type the url and run this > > require 'win32ole' > autoit = WIN32OLE.new("AutoItX3.Control") > autoit.WinWait("Authentication Required", "", 5) > > A success of 1 is returned. > > I wonder if I can use if expressions in Ruby threads, as the if > block is never executed. Maybe the winwait function in autoit is not > able to thread. > > Any ideas, please? > > Thanks > > Aidy > > -- Bret Pettichord CTO, WatirCraft LLC, http://www.watircraft.com Lead Developer, Watir, http://wtr.rubyforge.org Blog (Essays), http://www.io.com/~wazmo/blog MiniBlog (Links), http://feeds.feedburner.com/bretshotlist ------=_Part_43753_30807176.1218465467732--