Handle double click on a file associated with my application

When my application starts up I want to check if the application starts because of double click in Finder, or open file in Finder. If the file is opened from Finder I will not show Welcome screen and open directly the file. But if there is no such file it will show Welcome screen. I can register for kAEOpenDocuments but I had to wait for the event to be triggered and how long should I wait. What would be the proper way to handle this

Answered by DTS Engineer in 835907022

Here's a summary of the information from this page ~

  • if an app is being launched to open some documents it will be sent an 'odoc' "Open Documents" (kAEOpenDocuments) Apple event
  • if an app is being launched to print some documents it will be sent a 'pdoc' "Print Documents" (kAEPrintDocuments) Apple event
  • otherwise, the app will be sent an 'oapp' "Open Application" (kAEOpenApplication) Apple event
  • And, if an app is already running and it's being swapped into the foreground in front of other apps, it will be sent a 'rapp' "Re-open Application" (kAEReopenApplication) Apple event

Here's a summary of the information from this page ~

  • if an app is being launched to open some documents it will be sent an 'odoc' "Open Documents" (kAEOpenDocuments) Apple event
  • if an app is being launched to print some documents it will be sent a 'pdoc' "Print Documents" (kAEPrintDocuments) Apple event
  • otherwise, the app will be sent an 'oapp' "Open Application" (kAEOpenApplication) Apple event
  • And, if an app is already running and it's being swapped into the foreground in front of other apps, it will be sent a 'rapp' "Re-open Application" (kAEReopenApplication) Apple event
Handle double click on a file associated with my application
 
 
Q