<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>marius &#187; Midnight Inbox</title>
	<atom:link href="http://devilx.net/tag/midnight-inbox/feed/" rel="self" type="application/rss+xml" />
	<link>http://devilx.net</link>
	<description></description>
	<lastBuildDate>Wed, 25 Jan 2012 07:42:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Automating Things</title>
		<link>http://devilx.net/2010/02/21/automating-things/</link>
		<comments>http://devilx.net/2010/02/21/automating-things/#comments</comments>
		<pubDate>Sun, 21 Feb 2010 14:56:58 +0000</pubDate>
		<dc:creator>Marius</dc:creator>
				<category><![CDATA[Mac and stuff ...]]></category>
		<category><![CDATA[New & Cool]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[AppleScript]]></category>
		<category><![CDATA[Automator]]></category>
		<category><![CDATA[Chandler]]></category>
		<category><![CDATA[Dropbox]]></category>
		<category><![CDATA[GTD]]></category>
		<category><![CDATA[Hacking]]></category>
		<category><![CDATA[iChat]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Mail.app]]></category>
		<category><![CDATA[Midnight Inbox]]></category>
		<category><![CDATA[MobileMe]]></category>
		<category><![CDATA[The Hit List]]></category>
		<category><![CDATA[Things]]></category>

		<guid isPermaLink="false">http://www.devilx.net/?p=1138</guid>
		<description><![CDATA[CulturedCode&#8217;s Things is probably one of the best GTD applications available on the Mac OS X and the iPhone platform. Yet, there really is no alternative that supports managing your tasks in such a big scale like Things does. I &#8230; <a href="http://devilx.net/2010/02/21/automating-things/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a title="Things" href="http://culturedcode.com/things/" target="_blank">CulturedCode&#8217;s Things</a> is probably one of the best GTD applications available on the Mac OS X and the iPhone platform. Yet, there really is no alternative that supports managing your tasks in such a big scale like Things does. I know <a title="The Hit List" href="http://www.potionfactory.com/thehitlist/" target="_blank">Potion Factory&#8217;s The Hit List</a> as well as I know <a title="Chandler Project" href="http://chandlerproject.org/" target="_blank">Chandler</a>, <a title="Midnight Beep Softworks" href="http://www.midnightbeep.com/" target="_blank">Midnight Inbox</a> and others &#8211; but they all kinda lack of specific features or just don&#8217;t integrate that good into one&#8217;s everyday workflow. I would really love to see The Hit List being developed more active and finally provide an <a title="The Hit List Mobile" href="http://www.flickr.com/photos/andypotion/4213848965/" target="_blank">iPhone client</a> that might beat the crap out of CulturedCode&#8217;s Things bundle, which yet still doesn&#8217;t allow me to keep each client in sync via MobileMe/without being in the same network or using <a title="Dropbox" href="http://www.dropbox.com/referrals/NTIxODYyMjk5" target="_blank">Dropbox</a> for desktop-to-desktop sync.</p>
<p>However, since (at least for me) there&#8217;s nothing comparable to Things, I&#8217;m trying to benefit from using it the best I can. One possibility to do so is the automation of task-creation. Wouldn&#8217;t it be cool to have Things automatically pack specific e-mails together as tasks you would only need to get done &#8211; without actually having the trouble of importing the information from Mail.app manually into Things first? I solved this problem for myself by using a feature that Things, Mail.app and Mac OS X provide me by default: AppleScript.</p>
<p>Now, how would this automated task-creation look like. First, a piece of code is needed, which gets the specific information out of an e-mail and tells Things to add those information to its library. The <a title="MailToThings" href="http://culturedcode.com/things/wiki/index.php/MailToThings" target="_blank">CulturedCode Wiki</a> already provides us such a script and first I&#8217;ve tried to use that. Unfortunately, the script seems to be something hacked together with Apple&#8217;s Automator and interferes with the UI, what causes the process of task-creation to be visible to the end-user. I didn&#8217;t want that &#8211; so I just hacked together my own AppleScript using the AppleScript Edior:</p>
<pre>on perform_mail_action(info)
	tell application "Mail"
		set selectedMessages to |SelectedMessages| of info
		set theRule to |Rule| of info
		repeat with eachMessage in selectedMessages
			set theSubject to subject of eachMessage
			set theContent to content of eachMessage
			tell application "Things"
				set newToDo to make new to do with properties {name:theSubject, due date:current date, notes:theContent} at beginning of list "Inbox"
			end tell
			set the (read status) of eachMessage to true
		end repeat
	end tell
end perform_mail_action</pre>
<p>You can simply copy &amp; paste this code into your AppleScript Editor and save it somewhere in your filesystem as AppleScript.</p>
<p>Next, we need this script to be called as soon as a new mail arrives. Let&#8217;s use Mail.app&#8217;s &#8220;Rules&#8221; for doing that!</p>
<div id="attachment_1139" class="wp-caption alignnone" style="width: 310px"><a href="http://www.devilx.net/wp-content/uploads/2010/02/mailtothings.png"><img class="size-medium wp-image-1139" title="Mail to Things" src="http://www.devilx.net/wp-content/uploads/2010/02/mailtothings-300x122.png" alt="Mail to Things Rule" width="300" height="122" /></a><p class="wp-caption-text">Mail.app Rule for Mail to Things</p></div>
<p>As &#8220;Run AppleScript&#8221; the script you&#8217;ve saved before needs to be specified. What rule you use for yourself actually depends on your incoming mails. In this example, I&#8217;m checking the mail&#8217;s subject to contain the string [ToDo]: for the script to act on that e-mail. Of course, you can also add another action *after* the &#8220;Run AppleScript&#8221; for Mail.app to delete the mail afterwards. The only thing my script does is to mark the mails that matched as read.</p>
<p>Now try it out on your own. Write yourself an e-mail containing your match-criteria and you&#8217;ll see that the script will automatically add a new task within your Things&#8217; Inbox, containing all details from within the mail itself. Of course, this script can be enhanced for example by leaving away the match-criteria from the subject (s/matchpattern//g), by cutting off everything after &#8220;&#8211; &#8221; (signature) or maybe even delegating the task to a co-worker or an area of responsibility by parsing the mail&#8217;s body. Feel free to extend it the way you need it. <img src='http://devilx.net/wp-content/plugins/smilies-themer/Riceballs/smile.png' alt=':)' class='wp-smiley' /> </p>
<p><em>PS: You can make the Inbox entries not being due by today by simply removing the &#8220;due date:current date&#8221; parameter from the script.</em></p>
<p><strong>//UPDATE:</strong></p>
<p>Because this whole automation topic is so much fun, I&#8217;ve just written an AppleScript that automatically adds every conversation-line you receive that starts with the pattern &#8220;task: &#8221; to your Things Inbox. <img src='http://devilx.net/wp-content/plugins/smilies-themer/Riceballs/smile.png' alt=':)' class='wp-smiley' /> </p>
<p>Here&#8217;s the AppleScript:</p>
<pre>using terms from application "iChat"
	on message received theMessage from theBuddy for textChat
		set theBuddy to full name of theBuddy

		if theMessage starts with "task: " then
			tell application "Things"
				set newToDo to make new to do with properties {name:theBuddy &amp; ": " &amp; my LeetReplacer((get theMessage), "task: ", "")} at beginning of list "Inbox"
			end tell
		end if
	end message received
end using terms from

on LeetReplacer(strng, srch, replc)
	tell (a reference to my text item delimiters)
		set {old, contents} to {contents, srch}
		set {strng, contents} to {strng's text items, replc}
		set {strng, contents} to {strng as Unicode text, old}
	end tell
	return strng
end LeetReplacer</pre>
<p>And here&#8217;s how you can include it into iChat:</p>
<div id="attachment_1142" class="wp-caption alignnone" style="width: 310px"><a href="http://www.devilx.net/wp-content/uploads/2010/02/ichattothings.png"><img class="size-medium wp-image-1142" title="iChat to Things" src="http://www.devilx.net/wp-content/uploads/2010/02/ichattothings-300x192.png" alt="iChat to Things" width="300" height="192" /></a><p class="wp-caption-text">iChat to Things</p></div>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://devilx.net/2010/02/21/automating-things/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

