I have Preview running with open 10 pdf, my program should be able to retrieve a list with all these pdfs.
Well, thatโs the hard part. You can get windows through Accessibility, but Accessibility does not associate them with any document object.
AppleScript will work for some applications, but Preview is not one of them. Indeed, most applications are not.
Thus, you can get a list of windows quite easily, but getting meaningful information about or from inside these windows varies from difficult to impossible. Your best bet may be a combination of Accessibility reports, AppleScript, and errors for scriptless applications, as well as the knowledge that your application will not work at all.
source share