Hi,

What about using this?

dim i as integer
dim w as window
for i=0 to REALbasic.WindowCount-1
    w=window(i)
    if w<>nil and instr(w.title,"Play)>0 then
       msgbox("I found the window")
       exit
    end if
 next

I have something similar for updating a list of windows of a particular kind.

Lee

On 2 Mar 2012, at 14:19, tiram...@rockisland.com wrote:

> Hello,
> 
> I have been working on this issue for days and for the life of me I cannot
> figure it out.
> 
> I have this simple code to look for specific window titles:
> 
>  Dim WindowList(-1) as Dictionary = CGWindowMBS.GetWindowListInfo(16,0)
>  Dim WindowName as string
> 
>  for each d as Dictionary in WindowList
>    WindowName = d.Lookup(CGWindowMBS.kCGWindowName, "")
>    If instr(1,WindowName,"Play") > 0 then MsgBox "I found the window"
>  next
> 
> The above code works just fine and I find the windows without any problems
> and its 100% accurate. The problem arises is when I add the above code to
> my main program in a thread as it fails to find the window with a 100%
> failure rate.
> 
> What my program is doing is clicking a button on a window then it waits
> for 5 seconds (In essence waiting for a new window to appear with a thread
> sleep timer) then the above code is run looking for the new window.
> 
> Why would putting this code in a thread affect the results? Any help would
> be appreciated.
> 
> Thanks
> 
> 
> _______________________________________________
> Mbsplugins_monkeybreadsoftware.info mailing list
> mbsplugins@monkeybreadsoftware.info
> https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info

Lee Badham

www.bodoni.co.uk | www.presssign.com


_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
mbsplugins@monkeybreadsoftware.info
https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info

Reply via email to