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
Okay, I think I've got this running now

The Context setter line has to read:

set taskContext to context "ReQall" of default document

Also, to process the inbox automatically, add this line before the last "end tell"

compact default document

What I don't understand is why I kept getting a compiler error when I first tried to add these lines.

And I still don't understand the need for the line:

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

Thanks to everyone for their help!
 
This doesn't add anything new for those who have a running reQall script... but here's the whole thing ready for copy-paste (incorporates comments from this thread).

In its current state it doesn't assign a context, but if you want to do that just uncomment as indicated.

Code:
(* Modified "Jott to OmniFocus" modified by dbyler to work with reQall mail. *)
-- Derived from work that is Copyright  2007, Curtis Clifton All rights reserved.
-- Modified to work specifically with Jott messages.
-- See http://forums.omnigroup.com/showthread.php?t=7651

-- If true, then the sender of the message is included in the action's description.
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) + 18
		set messageEnd to (offset of "Edit this item at" in theContent) - 2
		set taskName to rich text messageStart through messageEnd of theContent
		if (includeSender) then
			set taskName to taskName & " (via " & messageSender & ")"
		end if
		set theDoc to default document
		--Uncomment next line if you wish to set default context. Context must exist first.
		--set taskContext to context "reQall" of default document
		tell theDoc
			-- Delete the next line, uncomment the next one if you wish to set default context
			set propRecord to {name:taskName}
			--	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 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
 
Quote:
Originally Posted by dbyler View Post
This doesn't add anything new for those who have a running reQall script... but here's the whole thing ready for copy-paste (incorporates comments from this thread).
thanks for the script.. i have a very simple Mac question.. WHERE do i put that code? :)

thanks
 
Fire up the Script Editor, which can be found in the Applescript folder in your Applications Folder. Paste in the code, then save it in Library/Scripts/Applications/OmniFocus (you'll have to create the OmniFocus folder) with some appropriate name. You can then install it as a toolbar button in OmniFocus, or invoke it from the Applescript menu (which you need to turn on if you want it with Applescript Utility, in that same folder), or invoke it from a Mail rule (what you'll want to do in this case).
 
Hi,

Thanks for the script, this looks like it could be very helpful. Unfortunately, I seem to be running into some problems: Basically, I created the script (following the instructions set within the comments of the script) and placed it in the AppleScript OmniFocus folder. When I run the script, however, I get mixed results -- some of the reQall email messages create a proper task in omnifocus, while other reQall emails create a huge garbled mess of a task. For example, earlier I set a reminder for myself and with the message selected in Mail.app I ran the applescript -- here is the resulting task created within OmniFocus:

PHP Code:
t@reqall.com>
Receivedfrom smtpin133.mac.com ([unknown] [10.150.68.133])
 
by ms212.mac.com (Sun Java(tmSystem Messaging Server 7u3-12.01 64bit (built
 Oct 15 2009
)) with ESMTP id <0KXN000J9D6UTI20@ms212.mac.com> for
 ********@
mac.comWed10 Feb 2010 14:30:30 -0800 (PST)
Original-recipientrfc822;********@mac.com
Received
from mail.reqall.com ([72.32.189.34])
 
by smtpin133.mac.com (Sun Java(tmSystem Messaging Server 7u3-14.01 64bit
 
(built Dec 27 2009)) with ESMTP id <0KXN00BG0D6U5G50@smtpin133.mac.com> for
 **********@
mac.com (ORCPT *********@mac.com); Wed,
 
10 Feb 2010 14:30:30 -0800 (PST)
X-Proofpoint-Virus-Versionvendor=fsecure
 engine
=1.12.8161:2.4.5,1.2.40,4.0.166
 definitions
=2010-02-10_16:2010-02-06,2010-02-10,2010-02-10 signatures=0
X
-Proofpoint-Spam-Detailsrule=notspam policy=default score=0 spamscore=0
 ipscore
=0 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0
 reason
=mlx engine=5.0.0-0908210000 definitions=main-1002100193
Received
from qtechinc.com (97500-web1.qtechinc.com [192.168.1.34])
    
by mail.reqall.com (Postfixwith ESMTP id 190AF18738    for
 <*******[
edited]@mac.com>; Wed10 Feb 2010 16:01:08 -0600 (CST)
DateWed10 Feb 2010 22:01:08 +0000
From
reQall <post@reqall.com>
Reply-toreQall <post@reqall.com>
To: *********@mac.com
Message
-id: <74334b732ca4cb1c_d_pid_5035163@reqall.com>
SubjectReminder for Feb 102010 2:00 PMremind me to open at 2:00pm
MIME
-version1.0
Content
-typemultipart/mixed;
 
boundary=mimepart_4b732ca41824c_649d..fdbfe3b6a3b0


--mimepart_4b732ca41824c_649d..fdbfe3b6a3b0
Content
-Typemultipart/alternativeboundary=mimepart_4b732ca418763_649d..fdbfe3b6a4d4


--mimepart_4b732ca418763_649d..fdbfe3b6a4d4
Content
-Typetext/plaincharset=utf-8
Content
-Transfer-EncodingQuoted-printable
Content
-Dispositioninline



reQall reminder
:

remind me to open at 2:00pm
http
://www.reqall.com/webnew/webeditpost/5035163
Edit this item.


-----------------------------------------------------------------------
You can control or turn off reminder emails on the http://www.reqall.com/=
webnew/notifications reQall Settings page.
You can invite your friends to try reQall at http://www.reqall.com/web/in=
vite_multiple. =

If 
you're a reQall Pro user you can reply to this email (reQall &lt;post@=
reqall.com&gt;) to tell reQall how to mark this item. Use a one-word repl=
y at the top of the content area: done, delete, pending or help.
-----------------------------------------------------------------------
http://www.reqall.com






--mimepart_4b732ca418763_649d..fdbfe3b6a4d4
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: Quoted-printable
Content-Disposition: inline



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://ww=
w.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns=3D"http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dutf-8" =
/>
<title>reQall</title>
</head>
<body style=3D" font-family:Helvetica, Verdana, Arial, sans-serif; font-s=
ize:10pt;">
 =


<strong>reQall reminder:</strong><br/>

remind me to open at 2:00pm<br>
<a href=3D"http://www.reqall.com/webnew/webeditpost/5035163" target=3D"_b=
lank" style=3D"text-decoration:none; color: #0066FF;">
 Edit this item</a><br /><br />
<hr size=3D"1" noshade=3D"noshade" color=3D"#E8E8E8" height=3D"1px"/>
<font style=3D"font-size:7pt;">
 =

You can control or turn off reminder emails on the <a href=3D"http://www.=
reqall.com/webnew/notifications" target=3D"_blank" style=3D"text-decorati=
on:none; color: #0066FF;"> reQall Settings</a> page.
<br />You can <a href=3D"http://www.reqall.com/web/invite_multiple" targe=
t=3D"_blank" style=3D"text-decoration:none; color: #0066FF;">invite your =
friends</a>  to try reQall. <br />
If you'
re a reQall Pro user you can reply to this email to tell reQall ho=
w to mark this item. Use a one-word reply at the top of the content area:=
 
donedeletepending or help.

</
font>
<
hr size=3D"1" noshade=3D"noshade" color=3D"silver" height=3D"1px"/>
 =

<
font style=3D"font-size:7pt;"><a href=3D"http://www.reqall.com/" style=3D=
"text-decoration:none; color: #0066FF;">www.reqall.com</a></font>
</
body>
</
html>
 =





--
mimepart_4b732ca418763_649d..fdbfe3b6a4d4--

--
mimepart_4b732ca41824c_649d..fdbfe3b6a3b0-- (via reQall
Any help on what this means would be greatly appreciated. Also, exactly what do I have to set the mail rules to in the Mail.app in order for messages from reQall to automatically be filed into omnifocus? I can't seem to get that to work either.

Thank you so so much for your help!

PS - here is the applescript code I am using just in case that is needed:

PHP Code:
(* Modified "Jott to OmniFocus" modified by dbyler to work with reQall mail. *)
-- 
Derived from work that is Copyright  2007Curtis Clifton All rights reserved.
-- 
Modified to work specifically with Jott messages.
-- 
See http://forums.omnigroup.com/showthread.php?t=7651

-- If truethen the sender of the message is included in the action's description.
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) + 18
        set messageEnd to (offset of "Edit this item at" in theContent) - 2
        set taskName to rich text messageStart through messageEnd of theContent
        if (includeSender) then
            set taskName to taskName & " (via " & messageSender & ")"
        end if
        set theDoc to default document
        --Uncomment next line if you wish to set default context. Context must exist first.
        set taskContext to context "reQall" of default document
        tell theDoc
            -- Delete the next line, uncomment the next one if you wish to set default context
            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 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'm no expert on AppleScript but the problem seems to be with the Mail rules and script trying to process the "Reminder" reQall. You only need the "Added" emails to be processed into OF actions (the reminders are just tha, reminders of the same info contained in the "Added" emails).
So, add a rule in Mail that says only process emails from post@reQall.com whose subject line begins with "Added:".

I've attached a pic of the rules I use (I'm using the Script included in the above post - the one tweaked from JotNot)
Attached Thumbnails
Click image for larger version

Name:	reQall to OF rules.jpg
Views:	243
Size:	56.1 KB
ID:	1310  
 
Quote:
Originally Posted by pinkpanther View Post
Hi,

Thanks for the script, this looks like it could be very helpful. Unfortunately, I seem to be running into some problems: Basically, I created the script (following the instructions set within the comments of the script) and placed it in the AppleScript OmniFocus folder. When I run the script, however, I get mixed results -- some of the reQall email messages create a proper task in omnifocus, while other reQall emails create a huge garbled mess of a task. For example, earlier I set a reminder for myself and with the message selected in Mail.app I ran the applescript -- here is the resulting task created within OmniFocus:

PHP Code:
t@reqall.com>
Receivedfrom smtpin133.mac.com ([unknown] [10.150.68.133])
 
by ms212.mac.com (Sun Java(tmSystem Messaging Server 7u3-12.01 64bit (built
 Oct 15 2009
)) with ESMTP id <0KXN000J9D6UTI20@ms212.mac.com> for
 ********@
mac.comWed10 Feb 2010 14:30:30 -0800 (PST)
Original-recipientrfc822;********@mac.com
Received
from mail.reqall.com ([72.32.189.34])
 
by smtpin133.mac.com (Sun Java(tmSystem Messaging Server 7u3-14.01 64bit
 
(built Dec 27 2009)) with ESMTP id <0KXN00BG0D6U5G50@smtpin133.mac.com> for
 **********@
mac.com (ORCPT *********@mac.com); Wed,
 
10 Feb 2010 14:30:30 -0800 (PST)
X-Proofpoint-Virus-Versionvendor=fsecure
 engine
=1.12.8161:2.4.5,1.2.40,4.0.166
 definitions
=2010-02-10_16:2010-02-06,2010-02-10,2010-02-10 signatures=0
X
-Proofpoint-Spam-Detailsrule=notspam policy=default score=0 spamscore=0
 ipscore
=0 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0
 reason
=mlx engine=5.0.0-0908210000 definitions=main-1002100193
Received
from qtechinc.com (97500-web1.qtechinc.com [192.168.1.34])
    
by mail.reqall.com (Postfixwith ESMTP id 190AF18738    for
 <*******[
edited]@mac.com>; Wed10 Feb 2010 16:01:08 -0600 (CST)
DateWed10 Feb 2010 22:01:08 +0000
From
reQall <post@reqall.com>
Reply-toreQall <post@reqall.com>
To: *********@mac.com
Message
-id: <74334b732ca4cb1c_d_pid_5035163@reqall.com>
SubjectReminder for Feb 102010 2:00 PMremind me to open at 2:00pm
MIME
-version1.0
Content
-typemultipart/mixed;
 
boundary=mimepart_4b732ca41824c_649d..fdbfe3b6a3b0


--mimepart_4b732ca41824c_649d..fdbfe3b6a3b0
Content
-Typemultipart/alternativeboundary=mimepart_4b732ca418763_649d..fdbfe3b6a4d4


--mimepart_4b732ca418763_649d..fdbfe3b6a4d4
Content
-Typetext/plaincharset=utf-8
Content
-Transfer-EncodingQuoted-printable
Content
-Dispositioninline 
This is looking like it's a problem because ReQall is sending the emails in MIME format. This must've been a recent change from ReQall.

Does anyone have any idea on where to go from there? Is anyone using the above script and still able to decode their ReQall addition notifications?
 
OK, I dug into some of the object model for Applescript (this language, from a structure and syntax perspective, sucks) and determined that the script above *almost* works. It's accessing the Message->RawContent instead of Message->Content, so it feeds you MIME instead of Rich Text. I've made a couple of changes, and this script now works for ReQall into OmniFocus. Couple of the numeric constants had to change because of the new text that ReQall sends back.

Let me know if there are any problems.

Code:
(*Modified "Jot to OmniFocus" again by petonic on 8/18/2011. *)
(* Modified "Jott to OmniFocus" modified by dbyler to work with reQall mail. *)
-- Derived from work that is Copyright  2007, Curtis Clifton All rights reserved.
-- Modified to work specifically with Jott messages.
-- See http://forums.omnigroup.com/showthread.php?t=7651

-- If true, then the sender of the message is included in the action's description.
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 content 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 "Edit this item." in theContent) - 2
		set taskName to rich text messageStart through messageEnd of theContent
		
		if (includeSender) then
			set taskName to taskName & " (via " & messageSender & ")"
		end if
		set theDoc to default document
		--Uncomment next line if you wish to set default context. Context must exist first.
		--set taskContext to context "reQall" of default document
		tell theDoc
			-- Delete the next line, uncomment the next one if you wish to set default context
			set propRecord to {name:taskName}
			--	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 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

on write_error_log(this_error)
	set the error_log to ((path to desktop) as text) & "Script Error Log.txt"
	try
		open for access file the error_log with write permission
		write (this_error & return) to file the error_log starting at eof
		close access file the error_log
	on error
		try
			close access file the error_log
		end try
	end try
end write_error_log
 
How do you invoke it from a mail rule?

Quote:
Originally Posted by whpalmer4 View Post
Fire up the Script Editor, which can be found in the Applescript folder in your Applications Folder. Paste in the code, then save it in Library/Scripts/Applications/OmniFocus (you'll have to create the OmniFocus folder) with some appropriate name. You can then install it as a toolbar button in OmniFocus, or invoke it from the Applescript menu (which you need to turn on if you want it with Applescript Utility, in that same folder), or invoke it from a Mail rule (what you'll want to do in this case).
 
 


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 11:20 PM.


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