Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Note: I was still researching this while you updated with what you used, but I'll add this FWIW.</p> <p>Using the bundle identifier of the application is generally a more robust way to refer to an app then using the name alone, as a user could move or rename the app in OS X, but they can't easily change the bundle identifier. Moreover, even while Apple renamed iCal.app to Calendar.app, the <code>CFBundleIdentifier</code> is still <code>com.apple.iCal</code>.</p> <pre><code>if (![[NSWorkspace sharedWorkspace] launchAppWithBundleIdentifier:@"com.apple.iCal" options:NSWorkspaceLaunchDefault additionalEventParamDescriptor:nil launchIdentifier:NULL]) { NSLog(@"launching Calendar.app failed!"); } </code></pre> <p>The above code will work even if your app is sandboxed. You could potentially try to create a custom <code>NSAppleEventDescriptor</code> that would specify the equivalent of something like the following AppleScript code, but it will likely be denied because of the sandbox:</p> <pre><code>view calendar at date "Sunday, April 8, 2012 4:28:43 PM" </code></pre> <p>If your app doesn't have to be sandboxed, it's much easier if you use the Scripting Bridge, and with that method it's possible to select a specific <code>NSDate</code>.</p> <p>Sample project using ScriptingBridge: <a href="http://www.markdouma.com/developer/OpenCalendar.zip" rel="noreferrer">OpenCalendar.zip</a></p> <p>In that project, I use the following code:</p> <pre><code>SBCalendarApplication *calendarApp = [SBApplication applicationWithBundleIdentifier:@"com.apple.iCal"]; [calendarApp viewCalendarAt:[self.datePicker dateValue]]; </code></pre> <p>That will launch Calendar.app/iCal.app and change the calendar to the specified date.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload