Closed trevorstr closed 6 months ago
NSWorkspace.sharedWorkspace().runningApplications()
returns an array of NSRunningApplication
objects, not NSApplication
. If you want to get the list of open windows in another app, you'll likely need to use AppleScript/Apple Events.
NSWorkspace.sharedWorkspace().runningApplications()
returns an array ofNSRunningApplication
objects, notNSApplication
. If you want to get the list of open windows in another app, you'll likely need to use AppleScript/Apple Events.
Indeed. The ScriptingBridge framework is a fairly easy way to interact with AppleScript/AppleEvents, and you can use the Script Editor
application to check what applications support.
Describe the bug
I am trying to obtain a list of windows for an
NSApplication
instance. However, thewindows()
variable seems to be missing from theNSApplication
class in PyObjC.Platform information
To Reproduce
See script above
Expected behavior
According to the documentation for AppKit, there's supposed to be a
windows
variable exposed from theNSApplication
class, which returns an array of windows for the application.https://developer.apple.com/documentation/appkit/nsapplication/app_windows