The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniFocus Extras (http://forums.omnigroup.com/forumdisplay.php?f=44)
-   -   Simple, highly portable python script for Command-line inbox tasks (http://forums.omnigroup.com/showthread.php?t=30592)

abeck99 2013-08-05 12:38 AM

Simple, highly portable python script for Command-line inbox tasks
 
1 Attachment(s)
I've been using OmniFocus for many years now, but recently lost my primary input (broken phone), so I needed an easy way to collect tasks for processing on my iPad(s).
Since I've got a web dav running on my hostgator account, I wrote a simple script to just push things to the inbox via email.

This python script should work out of the box for any 2.6-2.7 python installation. The only extra file I use is Evan Fosmacks filelock.py. The advantage here is that this is very portable, and most other scripts require OmniFocus is installed. There is risk as updates or edge cases could cause issues. Use at your own risk!

Just unzip this into the directory that OmniFocus.ofocus lives and set up your exim filter or procmail filter to pipe emails into the script.

For example, hostgator uses exim, so I set up an email account at SOME_EMAIL_ADDRESS, and modified the exim filter script (located at /etc/vfilters/MY_DOMAIN_NAME.com) to include:

[CODE]
#taskToOmnifocus
if
$header_to: matches "SOME_EMAIL_ADDRESS"
then
pipe "python /PATH_TO_SCRIPT/addTask.py"
endif
[/CODE]

Now when I send an email to [email]SOME_EMAIL_ADDRESS@MY_DOMAIN_NAME.com[/email] it will read every non-empty line in the body of the email and create separate inbox tasks. Remember to delete sigs before sending the email.

Alternatively you can use this as a commandline script, just run
[CODE]python addTask.py "Some new task" "Another new task"[/CODE]

I didn't want any bells and whistles since I like to collect directly into my inbox and add contexts/etc when processing, but it is very simple to add extra stuff if you are so inclined.

Please back up your omnifocus database before running this - I have not encountered any problems but I am not responsible for anything going pear shaped.

One question for the Omni guys - what does rank do? I take the highest rank value and increment it, but it seems like multiple things can have the same rank. I wasn't sure what good that value does.


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

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