Can Xojo locate the windows of another app running concurrently?

I would like to be able to do a windowshot of the window(s) of another app that is running at the same time. The window/screenshot part is OK. Question is how can the Xojo app identify what apps are running together with data on their window locations?

declares or plugins depending on what OS you’re targetting

MacOS

The answer is going to be platform specific and require declares. More information is needed. Platform?

Wished you’d said Windows as this is actually some what easier there :slight_smile:
All this stuff USED to be in the Carbon Accessibility API and you could get a list of app and the windows they owned etc
I’m not sure where they have relocated all of that or whether you can, without accessibility or some kind of scripting support in the other app, even tell the system to do more than bring that app to the foreground ie/ if you cant write a script like “tell app X to open Window Y” I suspect you wont be able to control it from your app
MBS has an accessibility plugin that exposes some things that can help

If all you need is to bring the other app to the foreground and then take the screen shot (?) that might be a lot simpler and quite possible
Either an MBS plugin or declares into NSWorkspace
https://stackoverflow.com/questions/51463198/swift-macos-can-i-detect-or-make-other-app-to-be-in-the-foreground

Yes, that’s basically what I need. AppleScript or MBS would be fine - just need some pointers…

see this thread where sam posted
https://forum.xojo.com/57964-getting-the-name-of-the-foreground-app

you can use declares OR MBS to do both of the things required

Apple has some notes about these methods on their docs you might need to be aware of
https://developer.apple.com/documentation/appkit/nsworkspace?language=objc

Much thanks Norman.

Any time
As one of the ski patrollers I ski with said “That just seems to be your nature to help”
I try :slight_smile:

You may also take a look at System Events (using the Apple Script Editor, “File” menu, “Open dictionary…”. Locate and open “System Events”). In its dictionary, look for the “Processes Suite”.
You can then even have pure Xojo code using AppleEvents.

We have WindowsListMBS class for Windows and CGWindowMBS module for MacOS in MBS Xojo Plugins.