I want to allow the user to choose wether a document is opened or auto processed when opened from the outside.
When currently a document is opened with the app it always opens a document window, not calling the AppDelegate's application:openURLs:
So the question is:
How do I detect when a file is opened
• via Finder "Open With" or
• dragged onto the Dock icon
while bypass when
• Recent files is used or
• File -> Open / The Open Panel
• a document is reopeend
• a document is duplicated etc.
or any way that is clearly meant to open a doucment window.
I have tried overwriting the NSDocumentController, but the open method here does not allow me to distinguish why the file is opened. In NSApplication all document related tasks are in the NSApplication(NSEventHandling) extension and cannot be overwriten, and the actual open event is triggerd by nextEventWithMask:… and intercepting that seemes kind of hackish and cannot be the approach Apple designated for this situation. (especially since the Events are not even well documented :-(
All the best
Just to clarify:
I basically just want to destinguish if a open file comes from outside the app or inside the app. (In case the listing of events looked confusing)