The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > OmniFocus > OmniFocus for iPhone
FAQ Members List Calendar Today's Posts

 
Adding "Send to OmniFocus" to other iPhone apps Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
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:
omnifocus:///add?name=hello%20world&note=text%20and%20http://example.org/%20link
And 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=%@&note=%@", 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."];
}
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".

Last edited by Ken Case; 2010-01-10 at 09:09 AM.. Reason: Added a pointer to our translations of "Send to OmniFocus"
 
 




Similar Threads
Thread Thread Starter Forum Replies Last Post
"Omnifocus: Send to Inbox" Service is Missing chipwarren OmniFocus 1 for Mac 1 2012-07-02 08:13 PM
Mail's "Send to OmniFocus" keyboard shortcut broken tjfallis@blackrockmarketi OmniFocus 1 for Mac 7 2012-02-10 11:25 PM
Getting "Send to OmniFocus" support in Atomic Web Browser via Javascript endoftheQ OmniFocus for iPhone 2 2011-07-18 04:58 PM
"OmniFocus: Send to Inbox" service grayed out Kevin Yank OmniFocus 1 for Mac 2 2007-11-19 02:37 PM
OmniOutliner "Send to OmniFocus" Script curt.clifton OmniFocus 1 for Mac 4 2007-06-20 06:04 PM


All times are GMT -8. The time now is 04:04 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.