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

 
Using ReQall.com to get tasks into OmniFocus Thread Tools Search this Thread Display Modes
I have been playing around with the iPhone version and also the desktop version trying to figure things out. I see where OmniFocus can add tasks based on specially formatted emails.

I'm also testing ReQall. It is an iPhone app that will convert a voice command to text. I recall seeing where it can send emails with new tasks, but haven't researched how customizable the emails are.

My question is has anyone tried to link these two programs together? It would be nice to send a quick voice command to add a task to OmniFocus.
 
I hacked together something that's working for me, based on
a couple other people's mail-into-ical scripts that have been
hashed around on the 'net for several years. Embarassingly I've
forgotten the original sources for major portions of the code,
so I can't give credit where it's due - only can say that most of
the bugs and kludges are mine.

http://idisk.mac.com/willray-Public?view=web

Download the mAil_tWo_iCal.scpt file.

You'll need to edit it internally to put it in an appropriate
calendar.

I have a "Penciled" calendar where I put incoming
tasks and possibly-scheduled items - OmniFocus is configured
to sync that with a "Penciled" context, which is used for nothing
except capturing that calendar. I also have OF configured to leave
tasks in the inbox until they've had both a context and a project
assigned, so things that land in Penciled, also show up in the
inbox. Requires the discipline to change the context when you
process your inbox, but that doesn't so far seem an impediment.

Mail has a rule set up to run this AppleScript whenever a message
with a subject starting with "Task : " appears in the inbox.

It has a second rule set up to move messages starting with "Task : "
into an archived tasks box.

These are set up as independent rules, because Mail, for reasons
impenetrable to me, has started arbitrarily reordering actions
inside rules. The script relies on the message being in the inbox
and being unread, and at least on my machine, when I try to add
a "move the message" action to the same rule that invokes the
AppleScript, Mail rearranges the actions and puts the "move" action
before the AppleScript action. (I'm pretty sure this is a new bug
in Leopard - rules didn't rearrange themselves previously, to the
best of my recollection).

Hmm - what else..

Ah, the script fills in the to-do task URL with the Mail message ID,
but Omnifocus re-writes that to be a URL to point to the OF task,
once it's synced it into the OF database. To make sure that you
can still get back to the Mail task, the script also writes the text of
the URL into the task note body - sometimes this appears clickable,
sometimes you need to highlight it and "go to URL". Either way,
it's an ugly URL, but I haven't taken the time to figure out how
to do a clip-o-tron-like URL-text redisplay, or rewrap the message
body in RTF, so that it shows up prettily in the note.

Oh, and the script's a bit cheeky, and still contains various debugging
bits that should be excised, and inelegancies that should be polished.
I of course am not making any warranties as to its utility, and don't
have that much time for maintenance, but I'll do my best to help
with setting it up, if there are questions. I'd also love to see
improvements, if anyone feels like banging on more functionality.

Good luck,
Will Ray
 
Thanks for writing that. I'll check it out. If I make any changes, do you mind if I repost it in the forums?
 
I use Jott - which seems like a similar idea - by setting up at Jott recipient to the "email+omnifocus@whatever.com" email address, which is then auto-imported into the mailbox by the mail rule.
 
I modified the Jott » OmniFocus script (which, in turn, was modified from some of Curt Clifton's work) to work with reQall mail. Should handle any of the reQall types.

That said, I'll probably keep using Jott (dial-in, not iPhone app) because it's been faster and more reliable for me.

Script here:

Code:
(* Derived by dbyler from "Jott to OmniFocus" to work with reQall mail. See below. *)

-- Derived from work that is Copyright © 2007, Curtis Clifton All rights reserved.
-- Modified to work specifically with Jott messages.

-- If true, then the sender of the message is included in the action's description.

-- From http://forums.omnigroup.com/showthread.php?t=7651

property includeSender : true

property messageSender : "reQall"

on run
	tell application "Mail"
		set selectedMessages to selection
		if ((count of selectedMessages) ≠ 1) then
			display alert "Please select a message to be linked to the new action" message "This script creates a new OmniFocus action that links back to a selected message." buttons {"OK"} default button "OK" giving up after 20
			return
		end if
		my process_message(item 1 of selectedMessages)
	end tell
end run

using terms from application "Mail"
	on perform mail action with messages theMessages
		try
			set theMessageCount to count of theMessages
			repeat with theMessageIndex from 1 to theMessageCount
				my process_message(item theMessageIndex of theMessages)
			end repeat
		on error m number n
			tell application "OmniFocus"
				log "Exception in Mail action: (" & n & ") " & m
			end tell
		end try
	end perform mail action with messages
end using terms from

on process_message(theMessage)
	tell application "Mail"
		set theContent to source of theMessage
		set theDate to date sent of theMessage
		set messageId to message id of theMessage
	end tell
	
	tell application "OmniFocus"
		set messageStart to (offset of "added to reqall" in theContent) + 17
		set messageEnd to (offset of "Invite your friends" in theContent) - 76
		set taskName to rich text messageStart through messageEnd of theContent
		if (includeSender) then
			set taskName to taskName & "—" & messageSender
		end if
		set theDoc to first document
		tell theDoc
			set propRecord to {name:taskName}
			set theTask to make new inbox task with properties propRecord
		end tell
		tell theTask
			set start date to theDate
			set note to return & return
			tell note
				set theURL to "message://<" & messageId & ">"
				set linkText to theURL
				insert linkText at before first character
				set value of attribute "link" of style of paragraph 1 to theURL
			end tell
		end tell
	end tell
end process_message
 
I made two small modifications to dblyler's script to work better:
1: I changed the +17 to +21 to cut a couple more letters off the front
2: I changed "first document" to "default document", which makes it work when the OF window is closed.
 
Does anyone know how to modify the dbyler script to automatically set a context on all incoming items?
 
Quote:
Originally Posted by whshep View Post
Does anyone know how to modify the dbyler script to automatically set a context on all incoming items?
This is an example of setting context for new items in script:

tell application "OmniFocus"
set theName to "Hello"
set theContent to "Some content"
set theContext to context "Home Office" of context "Work" of first document
tell first document
set theTask to make new inbox task with properties {name:theName, note:theContent, context:theContext}
 
Quote:
Originally Posted by Lucas View Post
This is an example of setting context for new items in script:

tell application "OmniFocus"
set theName to "Hello"
set theContent to "Some content"
set theContext to context "Home Office" of context "Work" of first document
tell first document
set theTask to make new inbox task with properties {name:theName, note:theContent, context:theContext}
Okay, here's the original code, that actually works—it will put items into my OF inbox:

Code:
tell application "OmniFocus"
		set messageStart to (offset of "added to reqall" in theContent) + 18
		set messageEnd to (offset of "Edit this item" in theContent) - 2
		set taskName to rich text messageStart through messageEnd of theContent
		if (includeSender) then
			set taskName to taskName & "—" & messageSender
		end if
		set theDoc to default document
		tell theDoc
			set propRecord to {name:taskName}
			set theTask to make new inbox task with properties propRecord
		end tell
		tell theTask
			set start date to theDate
			set due date to theDate
			set note to return & return
			tell note
				set theURL to "message://<" & messageId & ">"
				set linkText to theURL
				insert linkText at before first character
				set value of attribute "link" of style of paragraph 1 to theURL
			end tell
		end tell
Now if I understand you correctly, to get the items automatically assigned to a context "ReQall," I would do something like this:

Code:
tell application "OmniFocus"
		set messageStart to (offset of "added to reqall" in theContent) + 18
		set messageEnd to (offset of "Edit this item" in theContent) - 2
		set taskName to rich text messageStart through messageEnd of theContent
		set taskContext to "ReQall"
                if (includeSender) then
			set taskName to taskName & "—" & messageSender
		end if
		set theDoc to default document
		tell theDoc
			set propRecord to {name:taskName, context:taskContext}
			set theTask to make new inbox task with properties propRecord
		end tell
		tell theTask
			set start date to theDate
			set due date to theDate
			set note to return & return
			tell note
				set theURL to "message://<" & messageId & ">"
				set linkText to theURL
				insert linkText at before first character
				set value of attribute "link" of style of paragraph 1 to theURL
			end tell
		end tell
This doesn't work—it doesn't seem to do anything.

And in your example, I don't understand the line:

set theContext to context "Home Office" of context "Work" of first document

That would seem to set the context to a "Home Office" subset of "Work," which I don't have (also, the macro is working with default document).

Any help would be appreciated!
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to import Omnifocus tasks in an own iOS App ohrobot OmniFocus Extras 1 2012-12-10 02:03 PM
Using OmniFocus for Sales Tasks JoshU Applying OmniFocus 3 2012-11-12 05:54 AM
Sending Tasks To Omnifocus From A Win PC davidhughes OmniFocus 1 for Mac 2 2010-12-01 07:00 PM
ReQall -> email -> OF rcgottlieb OmniFocus Extras 14 2010-10-20 11:26 AM
How I see my OmniFocus Tasks on my iPhone DJ-Rizzo OmniFocus Extras 6 2008-03-26 06:52 AM


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


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