frontmost window, overall
set ExstWinList_ to ""
tell application "System Events" to set VisApp_ to every application process whose visible is true
set VisAppCnt_ to count items of VisApp_
repeat with i_ from 1 to VisAppCnt_
set VisAppNm_ to name of item i_ of VisApp_
try
tell application VisAppNm_ to set FWNm_ to name of window 1
if FWNm_ is not "" then
try
tell application VisAppNm_ to set FWNm_ to name of document 1
end try
end if
if FWNm_ is not "" then set ExstWinList_ to ExstWinList_ & "Application "" & VisAppNm_ & "" has a frontmost window named "" & FWNm_ & "."" & return & return
end try
end repeat
display dialog "The following applications each have at least one window on the desktop: " & return & return & ExstWinList_
MAC pro, Mac OS X (10.4.11)