1

I am trying to launch an app, and open a specific document with it. For example, to launch Sublime Text, I can do it using the following call [[NSWorkspace sharedWorkspace] launchAppWithBundleIdentifier:@"com.sublimetext.3" options:(0) additionalEventParamDescriptor:nil launchIdentifier:nil];

How do I pass a url of a document to the app, to make Sublime Text open this document after launch? I believe this can be done using additionalEventParamDescriptor, but I can't find an example anywhere on how to build a correct NSAppleEventDescriptor for an "open document" event. Thanks!

O.W.Grant
  • 163
  • 11
  • 2
    Is there a particular reason for for using AppleEvents instead of NSWorkspace's `openFile:withApplication:`? – red_menace Feb 04 '20 at 18:55
  • Thanks @red_menace. No reason, actually (but still curious how to do it via Apple Events) – O.W.Grant Feb 04 '20 at 22:23
  • Does this answer your question? [How to send and receive NSAppleEventDescriptor when using NSWorkspace to open URLs between apps?](https://stackoverflow.com/questions/57438168/how-to-send-and-receive-nsappleeventdescriptor-when-using-nsworkspace-to-open-ur) – Willeke Feb 05 '20 at 06:11

0 Answers0