As I mentioned earlier, the OmniFocus Quick Entry API is a simple URL-based API, much like other iPhone APIs (such as those you'll find in Twittelator and Tweetie).
Here's an example of how you would add a task:
The notion behind the "is OmniFocus Installed" test is other apps can only show the option in their app for customers who have OmniFocus 1.6 installed (so it doesn't clutter up the UI for anyone who doesn't use OmniFocus).
If you'd like an app developer to add support for OmniFocus to their app, please send them a link to this post! (And if any developers would like a free copy of OmniFocus to test this integration, they're welcome to contact me at kc@omnigroup.com and I'll see what I can do.)
P.S. — If your app is available in multiple languages, see this later post for our translations of "Send to OmniFocus".
Here's an example of how you would add a task:
omnifocus:///add?name=hello%20world¬e=text%20and%20http://example.org/%20linkAnd to make things even easier for other app developers to add "Send to OmniFocus", here's some sample iPhone code which tests whether OmniFocus 1.6 is installed and sends something to it if it is:
Code:
- (BOOL)isOmniFocusInstalled; { return [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"com.omnigroup.omnifocus:"]]; } - (void)addOmniFocusTaskWithName:(NSString *)name note:(NSString *)note; { CFStringRef legalURLCharactersToBeEscaped = (CFStringRef)@"@#$&=:/,;?+'"; NSString *encodedName = [(NSString *)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)name, NULL, legalURLCharactersToBeEscaped, kCFStringEncodingUTF8) autorelease]; NSString *encodedNote = [(NSString *)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)note, NULL, legalURLCharactersToBeEscaped, kCFStringEncodingUTF8) autorelease]; NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"omnifocus:///add?name=%@¬e=%@", encodedName, encodedNote]]; [[UIApplication sharedApplication] openURL:url]; } - (void)sampleCode; { if ([self isOmniFocusInstalled]) [self addOmniFocusTaskWithName:@"Hello world & stuff" note:@"Arbitrarily long note with links like http://example.org/ and www.omnigroup.com."]; }
If you'd like an app developer to add support for OmniFocus to their app, please send them a link to this post! (And if any developers would like a free copy of OmniFocus to test this integration, they're welcome to contact me at kc@omnigroup.com and I'll see what I can do.)
P.S. — If your app is available in multiple languages, see this later post for our translations of "Send to OmniFocus".
Last edited by Ken Case; 2010-01-10 at 10:09 AM.. Reason: Added a pointer to our translations of "Send to OmniFocus"