I'm developing a Cocoa/Objective C application that reads the active document from any application using AppScript. I've done this part successfully, but it would be really good to be able to tell for sure whether the application is document-based or not.
The obvious approach is to look at the AXDocument attribute of the active window within the application and if it contains a path, we know the app is document-based. However, this doesn't work if the document is unsaved. It's also pretty clumsy. Rather annoyingly, the AXDocument attribute may appear in a non-document application, so it's presence or absence cannot be used to provide the information I seek.
I've tried looking at the other properties and attributes exposed through AppleScript of both an application process and a single window. None of these items seem to tell me for sure whether the app is document-based or not.
I've also tried looking through a few Info.plist files, but can't see anything that reliably indicates this. Am I just not looking hard enough? Or is there a good way of doing this in Objective C or AppleScript?