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 Extras
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
Add new inbox item Thread Tools Search this Thread Display Modes
A customer asked for an applescript that let them add an inbox item when OmniFocus wasn't running. In case that's useful for other folks, here's what I slapped together:

Code:
set itemText to display dialog "Enter text you'd like to add to OmniFocus:" default answer ""
set newItem to text returned of itemText as Unicode text
tell application "OmniFocus" to tell default document
     make new inbox task with properties {name:newItem}
end tell

Last edited by Brian; 2008-03-24 at 03:40 PM..
 
Handy, but "myText" on line 1 should be "itemText". Thanks for posting.
 
I am the best applescript coder ever. Fixed.
 
Problem with using AppleScript here is that it'll launch OmniFocus, which means that this is not a transparent way to record something and continue on with what you're doing.

I store things that I want to hit the OF inbox in iCal; use a separate calendar if you like. This way, things are captured without distracting me. QuickSilver has a nifty capture tool for iCal, and there are tons of others; likewise, items I enter on my Palm get the same treatment.
 
launching OmniFocus if it wasn't running was something the customer was looking for, but yeah - if you don't want that, another way would be more appropriate.

Customer had one more request, so tweaked the script a bit more. It now
a) finds a window pointed at your default document (if you have more than one window open) and brings that forward.
b) switches that window to project mode if you're in context mode
c) adds the inbox to your sidebar selection if it isn't already selected.

Code:
set itemText to display dialog "Enter text you'd like to add to OmniFocus:" default answer ""
set newItem to text returned of itemText as Unicode text
tell application "OmniFocus"
	tell default document
		make new inbox task with properties {name:newItem}
	end tell
	
	set defDocID to id of default document
	set defDocWindow to ""
	repeat with w in windows of it
		set d to document of w
		if d is not missing value then
			if id of d is defDocID then
				set defDocWindow to w
				exit repeat
			end if
		end if
	end repeat
	if defDocWindow is "" then
		set filePath to file of default document
		set defDoc to open filePath
		tell defDoc
			set defDocWindow to make new document window
		end tell
	end if
	
	set selected view mode identifier of defDocWindow to "project"
	
	tell sidebar of defDocWindow
		set selected of inbox to true
	end tell
	
	activate
end tell

Last edited by Brian; 2008-03-27 at 05:07 PM..
 
This is a nice script...but

you still end up opening Omni-f, though it is in the back ground. I know it was mentioned in another thread it takes up lots of energy to keep Omni-f running, but why not open Omni-f and insert your task properly --- it takes less than 2 minutes the timie threshold for GTD

just wondering...
 
This sounds like just what I need, but could someone kindly tell a non-scripter how to put this script to use??
Thankyou!
Kim
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Phantom Inbox Item asoon OmniFocus for iPhone 2 2012-08-21 01:50 AM
Can't Add Text To New Inbox Item daveyaffe OmniFocus for iPhone 5 2010-07-30 09:49 PM
Item Count for Inbox JShadow007 OmniFocus 1 for Mac 3 2009-11-23 12:38 PM
Red font for new Inbox item mjw OmniFocus 1 for Mac 3 2009-09-14 09:48 AM
Inbox item count markbrown00 OmniFocus 1 for Mac 29 2007-07-15 07:31 AM


All times are GMT -8. The time now is 03:46 PM.


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