1 Reply
      Latest reply on Jul 8, 2019 5:19 AM by ChristophV
      ChristophV Level 1 Level 1 (10 points)

        Hi,

         

        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 :-(

         

        Any tips?

         

        All the best

           Christoph