Hi Karina,

> Does anyone know if it's possible with lingo or some Xtra (buddy?)
> to check if an  external application is open?

Your intuition is right: you can use BudAPI for this. Look into the
baWindowList() and baWindowInfo() methods.

Here's a thing I once wrote for this task -- I found it reliable enough,
but always wanted to do more with it. If you improve on it (shouldn't be
difficult), please post it back!


if AppIsOpen( "Netscape" ) then
  -- do your stuff
end if

--=======================
on AppIsOpen( strAppName )
  -- 1) Get a list of all the open windows
  lsAllWindows = baWindowList( EMPTY,EMPTY,FALSE )
  lsAppWindows = []
  
  -- 2) Look thru it for the app we need
  repeat with win in lsAllWindows
    winTitle = baWindowInfo( win,"title" )
    if winTitle = EMPTY then next repeat
    bIsProbablyOpen = winTitle contains strAppName
    if bIsProbablyOpen then lsAppWindows.add( win )
  end repeat
  
  -- Did we find anything?
  if lsAppWindows.count then
    return TRUE -- or return the list if you prefer
  end if
  
  -- We found nada
  return FALSE
end


Hope it's helpful,
Rob

/*********************************
* Rob Wingate, Software Human    *
* http://www.vingage.com         *
* mailto:[EMAIL PROTECTED] *
*********************************/

[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to