0
獲取具有標題爲「someWinTitle」的窗口的應用程序的名稱的最簡單方法是什麼?獲取窗口標題爲「someWinTitle」的應用程序的名稱
我知道可以通過循環遍歷循環中的所有應用程序來找到它,但是有沒有一個優雅的單行程來實現這一點?
獲取具有標題爲「someWinTitle」的窗口的應用程序的名稱的最簡單方法是什麼?獲取窗口標題爲「someWinTitle」的應用程序的名稱
我知道可以通過循環遍歷循環中的所有應用程序來找到它,但是有沒有一個優雅的單行程來實現這一點?
您可以使用AppleScript中的過濾器來獲取已過濾對象的列表,當然如果應用程序支持它的話。以下是一個將返回瀏覽器打開此頁面的進程的示例。
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