The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniFocus Extras (http://forums.omnigroup.com/forumdisplay.php?f=44)
-   -   Add new inbox item (http://forums.omnigroup.com/showthread.php?t=7587)

Brian 2008-03-24 01:49 PM

Add new inbox item
 
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
[/CODE]

Toadling 2008-03-24 03:23 PM

Handy, but "myText" on line 1 should be "itemText". Thanks for posting.

Brian 2008-03-24 03:40 PM

I am the best applescript coder ever. Fixed.

jporten 2008-03-26 12:13 PM

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.

Brian 2008-03-27 03:24 PM

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
[/CODE]

librarymonkey27 2008-03-30 05:31 AM

but
 
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...

kimomni 2008-03-31 07:55 AM

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

librarymonkey27 2008-03-31 06:28 PM

look to the faq
 
go to this

[URL]http://forums.omnigroup.com/showthread.php?t=7453[/URL]

thread


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

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