Reputation: 6044
What is the simplest way to get the name of the application that has a window with title "someWinTitle".
I know that it can be found by cycling through all the applications in loops but is there an elegant one liner to accomplish this?
Upvotes: 0
Views: 282
Reputation: 3542
You can use filters in AppleScript to get a list of filtered objects, if the application supports it of course. Here's an example that will return the process(es) whose browsers has this page open.
tell application "System Events"
get name of every process whose name of every window contains "applescript - Get the name of the application with window title \"someWinTitle\" - Stack Overflow"
end tell
Upvotes: 1