<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: OmniFocus Task Auto-Import via iOS Mail Flags</title>
	<atom:link href="http://www.hanchorllc.com/2011/12/11/omnifocus-task-auto-import-via-ios-mail-flags/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.hanchorllc.com/2011/12/11/omnifocus-task-auto-import-via-ios-mail-flags/</link>
	<description>iPhone, iPad, Cocoa and Rails Development - Santa Barbara, CA. I make your products come to life.</description>
	<lastBuildDate>Thu, 25 Apr 2013 19:56:03 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Simon Minshall</title>
		<link>http://www.hanchorllc.com/2011/12/11/omnifocus-task-auto-import-via-ios-mail-flags/comment-page-1/#comment-4738</link>
		<dc:creator>Simon Minshall</dc:creator>
		<pubDate>Thu, 29 Nov 2012 19:13:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.hanchorllc.com/?p=203#comment-4738</guid>
		<description>I also got the same error.  Traced it to having inactive accounts in my list of accounts that were being processed.  The first few items in the list of my accounts were active and were processed.  The next one was inactive and Hunter&#039;s script tried to process it and failed raising an exception, terminating the script.

Two solutions:  
1: Wrap the contents of the first repeat block in a &quot;try&quot; block
2: Test if the acct is active and only process it of that&#039;s true.

I went with 2: because AS is slow enough when processing mail. Here&#039;s the revision:


&lt;code&gt;
on run
	tell application &quot;Mail&quot;
		repeat with _acct in imap accounts
			--Look For Flagged Messages in the INBOX
			set _acct_name to name of _acct
			log _acct_name
			if _acct is enabled then
				set _inbox to _acct&#039;s mailbox &quot;INBOX&quot;
				
				set _messages to ¬
					((every message of _inbox ¬
						whose flagged status is true))
				
				repeat with eachMessage in _messages
					
					set theStart to missing value
					set theDue to missing value
					set theOmniTask to missing value
					set theTitle to the subject of eachMessage
					set theNotes to the content of eachMessage
					set theCombinedBody to &quot;message://%3c&quot; &amp; message id of eachMessage &amp; &quot;%3e&quot; &amp; return &amp; return &amp; theNotes
					
					tell application &quot;OmniFocus&quot;
						tell default document
							set newTaskProps to {name:theTitle}
							if theStart is not missing value then set newTaskProps to newTaskProps if theDue is not missing value then set newTaskProps to newTaskProps if theCombinedBody is not missing value then set newTaskProps to newTaskProps set newTask to make new inbox task with properties newTaskProps
						end tell
					end tell
					set flagged status of eachMessage to false
				end repeat
			end if
		end repeat
	end tell
end run
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>I also got the same error.  Traced it to having inactive accounts in my list of accounts that were being processed.  The first few items in the list of my accounts were active and were processed.  The next one was inactive and Hunter&#8217;s script tried to process it and failed raising an exception, terminating the script.</p>
<p>Two solutions:<br />
1: Wrap the contents of the first repeat block in a &#8220;try&#8221; block<br />
2: Test if the acct is active and only process it of that&#8217;s true.</p>
<p>I went with 2: because AS is slow enough when processing mail. Here&#8217;s the revision:</p>
<p><code><br />
on run<br />
	tell application "Mail"<br />
		repeat with _acct in imap accounts<br />
			--Look For Flagged Messages in the INBOX<br />
			set _acct_name to name of _acct<br />
			log _acct_name<br />
			if _acct is enabled then<br />
				set _inbox to _acct's mailbox "INBOX"</p>
<p>				set _messages to ¬<br />
					((every message of _inbox ¬<br />
						whose flagged status is true))</p>
<p>				repeat with eachMessage in _messages</p>
<p>					set theStart to missing value<br />
					set theDue to missing value<br />
					set theOmniTask to missing value<br />
					set theTitle to the subject of eachMessage<br />
					set theNotes to the content of eachMessage<br />
					set theCombinedBody to "message://%3c" &amp; message id of eachMessage &amp; "%3e" &amp; return &amp; return &amp; theNotes</p>
<p>					tell application "OmniFocus"<br />
						tell default document<br />
							set newTaskProps to {name:theTitle}<br />
							if theStart is not missing value then set newTaskProps to newTaskProps if theDue is not missing value then set newTaskProps to newTaskProps if theCombinedBody is not missing value then set newTaskProps to newTaskProps set newTask to make new inbox task with properties newTaskProps<br />
						end tell<br />
					end tell<br />
					set flagged status of eachMessage to false<br />
				end repeat<br />
			end if<br />
		end repeat<br />
	end tell<br />
end run<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John</title>
		<link>http://www.hanchorllc.com/2011/12/11/omnifocus-task-auto-import-via-ios-mail-flags/comment-page-1/#comment-4729</link>
		<dc:creator>John</dc:creator>
		<pubDate>Thu, 18 Oct 2012 14:32:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.hanchorllc.com/?p=203#comment-4729</guid>
		<description>I&#039;m having the same issue.  :(</description>
		<content:encoded><![CDATA[<p>I&#8217;m having the same issue.  <img src='http://www.hanchorllc.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hunter</title>
		<link>http://www.hanchorllc.com/2011/12/11/omnifocus-task-auto-import-via-ios-mail-flags/comment-page-1/#comment-4728</link>
		<dc:creator>Hunter</dc:creator>
		<pubDate>Wed, 03 Oct 2012 16:40:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.hanchorllc.com/?p=203#comment-4728</guid>
		<description>AppleScript is not a language I have much experience in myself so I&#039;m not sure if I&#039;ll be able to help. Maybe someone else will see this and knows the answer!</description>
		<content:encoded><![CDATA[<p>AppleScript is not a language I have much experience in myself so I&#8217;m not sure if I&#8217;ll be able to help. Maybe someone else will see this and knows the answer!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Phil Collins</title>
		<link>http://www.hanchorllc.com/2011/12/11/omnifocus-task-auto-import-via-ios-mail-flags/comment-page-1/#comment-4727</link>
		<dc:creator>Phil Collins</dc:creator>
		<pubDate>Wed, 03 Oct 2012 11:06:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.hanchorllc.com/?p=203#comment-4727</guid>
		<description>Hunter

Have stumbled on your script and if I could get it to work it would complete my workflow!!!

Problem I have is twofold...

1. I&#039;m an applescript novice (make that complete novice!!)
2. have compiled the script and popped it into com.apple.mail
3. I have then used Mail Act on to call the script for flags - does this run continuoalsy or do I need to put a time mechanism in here?
3. when I run the cript from applescript editor I get the following error...

error &quot;Mail got an error: Can’t get item 2 of every message of mailbox \&quot;INBOX\&quot; of account \&quot;Phil Personal\&quot; whose flagged status = true. Invalid index.&quot; number -1719

Help - any advice guidance gratefully received!

Cheers

Phil</description>
		<content:encoded><![CDATA[<p>Hunter</p>
<p>Have stumbled on your script and if I could get it to work it would complete my workflow!!!</p>
<p>Problem I have is twofold&#8230;</p>
<p>1. I&#8217;m an applescript novice (make that complete novice!!)<br />
2. have compiled the script and popped it into com.apple.mail<br />
3. I have then used Mail Act on to call the script for flags &#8211; does this run continuoalsy or do I need to put a time mechanism in here?<br />
3. when I run the cript from applescript editor I get the following error&#8230;</p>
<p>error &#8220;Mail got an error: Can’t get item 2 of every message of mailbox \&#8221;INBOX\&#8221; of account \&#8221;Phil Personal\&#8221; whose flagged status = true. Invalid index.&#8221; number -1719</p>
<p>Help &#8211; any advice guidance gratefully received!</p>
<p>Cheers</p>
<p>Phil</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Payne</title>
		<link>http://www.hanchorllc.com/2011/12/11/omnifocus-task-auto-import-via-ios-mail-flags/comment-page-1/#comment-4697</link>
		<dc:creator>John Payne</dc:creator>
		<pubDate>Fri, 10 Feb 2012 16:08:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.hanchorllc.com/?p=203#comment-4697</guid>
		<description>Working with Exchange!
Exchange accounts are of type &quot;unknown&quot;.  Awesome :)
I&#039;ve been using this for over a month, so it&#039;s about darn time I sent it back to you.

I have Exchange server side rules moving some messages into different folders.  However, I want the flagging to still look in those, so I created a list.  I use 0 and 1 to keep certain folders near the top of the pile.
Secondly, rather than just unflagging the email message, I want to clean up my inbox(es).  So any email that&#039;s sent into Omnifocus also gets moved into the 1OMNIFOCUS folder on my Exchange account (even if I flagged it in a different account.  I&#039;m weird like that).   The mail URL still finds that message but it saves me a step of filtering it.  I only want to touch a message once when I&#039;m processing my inbox.

&lt;code&gt;
on run
	set _exchange_interesting_mailboxes to {&quot;Inbox&quot;, &quot;0GROUP1&quot;, &quot;0GROUP2&quot;}
	set _omnifocus_followup to &quot;1OMNIFOCUS&quot;
	with timeout of 90000 seconds
		-- first find our Exchange account so we only store follow up items there
		tell application &quot;Mail&quot;
			repeat with _acct in accounts
				set _acct_status to enabled of _acct
				if _acct_status is true then
					set _acct_type to account type of _acct
					if _acct_type is unknown then
						set _acct_server to server name of _acct
						set _acct_name to name of _acct
						if _acct_server contains &quot;.SOMETHING TO IDENTIFY YOUR EXCHANGE SERVER&quot; then
							set exchange_account to _acct_name
						end if
					end if
				end if
			end repeat
		end tell
		
		tell application &quot;Mail&quot;
			
			repeat with _acct in accounts
				set _acct_status to enabled of _acct
				if _acct_status is true then
					
					--Look For Flagged Messages in the INBOX
					set _acct_name to name of _acct
					set _acct_type to account type of _acct
					if _acct_type is unknown then
						#set _inbox to _acct&#039;s mailbox &quot;Inbox&quot;
						set _mailbox_list to _exchange_interesting_mailboxes
					else
						#set _inbox to _acct&#039;s mailbox &quot;INBOX&quot;
						set _mailbox_list to {&quot;INBOX&quot;}
					end if
					
					
					repeat with _mbx in _mailbox_list
						set _inbox to _acct&#039;s mailbox _mbx
						
						set _msgs_to_capture to (every message of _inbox whose flagged status is true)
						repeat with eachMessage in _msgs_to_capture
							
							
							set theStart to missing value
							set theDue to missing value
							set theOmniTask to missing value
							
							set theTitle to the subject of eachMessage
							set theNotes to the content of eachMessage
							
							set theCombinedBody to &quot;message://%3c&quot; &amp; message id of eachMessage &amp; &quot;%3e&quot; &amp; return &amp; return &amp; theNotes
							
							tell application &quot;OmniFocus&quot;
								tell default document
									set newTaskProps to {name:theTitle}
									if theStart is not missing value then set newTaskProps to newTaskProps if theDue is not missing value then set newTaskProps to newTaskProps if theCombinedBody is not missing value then set newTaskProps to newTaskProps set newTask to make new inbox task with properties newTaskProps
								end tell
							end tell
							
							set flagged status of eachMessage to false
							move eachMessage to mailbox _omnifocus_followup of account exchange_account
						end repeat
					end repeat
				end if
			end repeat
		end tell
	end timeout
end run
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Working with Exchange!<br />
Exchange accounts are of type &#8220;unknown&#8221;.  Awesome <img src='http://www.hanchorllc.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
I&#8217;ve been using this for over a month, so it&#8217;s about darn time I sent it back to you.</p>
<p>I have Exchange server side rules moving some messages into different folders.  However, I want the flagging to still look in those, so I created a list.  I use 0 and 1 to keep certain folders near the top of the pile.<br />
Secondly, rather than just unflagging the email message, I want to clean up my inbox(es).  So any email that&#8217;s sent into Omnifocus also gets moved into the 1OMNIFOCUS folder on my Exchange account (even if I flagged it in a different account.  I&#8217;m weird like that).   The mail URL still finds that message but it saves me a step of filtering it.  I only want to touch a message once when I&#8217;m processing my inbox.</p>
<p><code><br />
on run<br />
	set _exchange_interesting_mailboxes to {"Inbox", "0GROUP1", "0GROUP2"}<br />
	set _omnifocus_followup to "1OMNIFOCUS"<br />
	with timeout of 90000 seconds<br />
		-- first find our Exchange account so we only store follow up items there<br />
		tell application "Mail"<br />
			repeat with _acct in accounts<br />
				set _acct_status to enabled of _acct<br />
				if _acct_status is true then<br />
					set _acct_type to account type of _acct<br />
					if _acct_type is unknown then<br />
						set _acct_server to server name of _acct<br />
						set _acct_name to name of _acct<br />
						if _acct_server contains ".SOMETHING TO IDENTIFY YOUR EXCHANGE SERVER" then<br />
							set exchange_account to _acct_name<br />
						end if<br />
					end if<br />
				end if<br />
			end repeat<br />
		end tell</p>
<p>		tell application "Mail"</p>
<p>			repeat with _acct in accounts<br />
				set _acct_status to enabled of _acct<br />
				if _acct_status is true then</p>
<p>					--Look For Flagged Messages in the INBOX<br />
					set _acct_name to name of _acct<br />
					set _acct_type to account type of _acct<br />
					if _acct_type is unknown then<br />
						#set _inbox to _acct's mailbox "Inbox"<br />
						set _mailbox_list to _exchange_interesting_mailboxes<br />
					else<br />
						#set _inbox to _acct's mailbox "INBOX"<br />
						set _mailbox_list to {"INBOX"}<br />
					end if</p>
<p>					repeat with _mbx in _mailbox_list<br />
						set _inbox to _acct's mailbox _mbx</p>
<p>						set _msgs_to_capture to (every message of _inbox whose flagged status is true)<br />
						repeat with eachMessage in _msgs_to_capture</p>
<p>							set theStart to missing value<br />
							set theDue to missing value<br />
							set theOmniTask to missing value</p>
<p>							set theTitle to the subject of eachMessage<br />
							set theNotes to the content of eachMessage</p>
<p>							set theCombinedBody to "message://%3c" &amp; message id of eachMessage &amp; "%3e" &amp; return &amp; return &amp; theNotes</p>
<p>							tell application "OmniFocus"<br />
								tell default document<br />
									set newTaskProps to {name:theTitle}<br />
									if theStart is not missing value then set newTaskProps to newTaskProps if theDue is not missing value then set newTaskProps to newTaskProps if theCombinedBody is not missing value then set newTaskProps to newTaskProps set newTask to make new inbox task with properties newTaskProps<br />
								end tell<br />
							end tell</p>
<p>							set flagged status of eachMessage to false<br />
							move eachMessage to mailbox _omnifocus_followup of account exchange_account<br />
						end repeat<br />
					end repeat<br />
				end if<br />
			end repeat<br />
		end tell<br />
	end timeout<br />
end run<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill</title>
		<link>http://www.hanchorllc.com/2011/12/11/omnifocus-task-auto-import-via-ios-mail-flags/comment-page-1/#comment-4690</link>
		<dc:creator>Bill</dc:creator>
		<pubDate>Sat, 21 Jan 2012 20:32:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.hanchorllc.com/?p=203#comment-4690</guid>
		<description>Yes, flag goes from iOS Mail to Mac Mail to gmail web view.  I&#039;m using IMAP, I think my friend does also.   Sounds like you found the sticking point.</description>
		<content:encoded><![CDATA[<p>Yes, flag goes from iOS Mail to Mac Mail to gmail web view.  I&#8217;m using IMAP, I think my friend does also.   Sounds like you found the sticking point.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hunter</title>
		<link>http://www.hanchorllc.com/2011/12/11/omnifocus-task-auto-import-via-ios-mail-flags/comment-page-1/#comment-4687</link>
		<dc:creator>Hunter</dc:creator>
		<pubDate>Tue, 17 Jan 2012 17:53:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.hanchorllc.com/?p=203#comment-4687</guid>
		<description>Upon closer inspection, I may have figured this out... Turns out, my iPhone was setup to use Gmail as Exchange, not as IMAP. That appears to be where the breakage is (Exchange ActiveSync supports flags but it appears Google&#039;s implementation does not). So, it&#039;s likely true that the IMAP bit works fine and those of us with trouble are using ActiveSync to access Gmail, to access the extra features that come with that option. Sounds like to get push, calendar and contact sync, you have to give up flags... I&#039;ll update the post.</description>
		<content:encoded><![CDATA[<p>Upon closer inspection, I may have figured this out&#8230; Turns out, my iPhone was setup to use Gmail as Exchange, not as IMAP. That appears to be where the breakage is (Exchange ActiveSync supports flags but it appears Google&#8217;s implementation does not). So, it&#8217;s likely true that the IMAP bit works fine and those of us with trouble are using ActiveSync to access Gmail, to access the extra features that come with that option. Sounds like to get push, calendar and contact sync, you have to give up flags&#8230; I&#8217;ll update the post.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hunter</title>
		<link>http://www.hanchorllc.com/2011/12/11/omnifocus-task-auto-import-via-ios-mail-flags/comment-page-1/#comment-4685</link>
		<dc:creator>Hunter</dc:creator>
		<pubDate>Tue, 17 Jan 2012 17:42:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.hanchorllc.com/?p=203#comment-4685</guid>
		<description>Just to be clear - for both of you guys, when you use the flag function in the native iOS Mail app, that flag makes it&#039;s way to Mail.app on the Mac? I think that&#039;s what we&#039;re all saying but since it doesn&#039;t work for me at all in either of my accounts, it&#039;s a surprise to hear.

In talking to a few other people in relation to this script, I&#039;m definitely not alone. I&#039;d love to determine what the other variable is.</description>
		<content:encoded><![CDATA[<p>Just to be clear &#8211; for both of you guys, when you use the flag function in the native iOS Mail app, that flag makes it&#8217;s way to Mail.app on the Mac? I think that&#8217;s what we&#8217;re all saying but since it doesn&#8217;t work for me at all in either of my accounts, it&#8217;s a surprise to hear.</p>
<p>In talking to a few other people in relation to this script, I&#8217;m definitely not alone. I&#8217;d love to determine what the other variable is.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill</title>
		<link>http://www.hanchorllc.com/2011/12/11/omnifocus-task-auto-import-via-ios-mail-flags/comment-page-1/#comment-4684</link>
		<dc:creator>Bill</dc:creator>
		<pubDate>Tue, 17 Jan 2012 17:26:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.hanchorllc.com/?p=203#comment-4684</guid>
		<description>I spoke to my friend, who said he is unaware of any Gmail implementation details with regards to stars/flagging, but that he uses it all the time without difficulty in conjunction with Mail.app, the gmail web app, and the Mail for iPod touch.  Maybe it&#039;s all in the wrist :-)</description>
		<content:encoded><![CDATA[<p>I spoke to my friend, who said he is unaware of any Gmail implementation details with regards to stars/flagging, but that he uses it all the time without difficulty in conjunction with Mail.app, the gmail web app, and the Mail for iPod touch.  Maybe it&#8217;s all in the wrist <img src='http://www.hanchorllc.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hunter</title>
		<link>http://www.hanchorllc.com/2011/12/11/omnifocus-task-auto-import-via-ios-mail-flags/comment-page-1/#comment-4621</link>
		<dc:creator>Hunter</dc:creator>
		<pubDate>Wed, 04 Jan 2012 02:28:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.hanchorllc.com/?p=203#comment-4621</guid>
		<description>Oh, Apple Engineering could be wrong. They&#039;ve certainly closed bug reports of mine in the past erroneously.

Anyway, if you do get a chance to ask your friend, I&#039;d love to hear the details. It would be awesome if this could all work seamlessly.</description>
		<content:encoded><![CDATA[<p>Oh, Apple Engineering could be wrong. They&#8217;ve certainly closed bug reports of mine in the past erroneously.</p>
<p>Anyway, if you do get a chance to ask your friend, I&#8217;d love to hear the details. It would be awesome if this could all work seamlessly.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
