<?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/"
	xmlns:media="http://search.yahoo.com/mrss/">

<channel>
	<title>TannieSpace &#187; applescript</title>
	<atom:link href="http://tanniespace.com/tag/applescript/feed/" rel="self" type="application/rss+xml" />
	<link>http://tanniespace.com</link>
	<description>geekery, drawing, and then some</description>
	<lastBuildDate>Sat, 24 Dec 2011 08:32:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Snoozing, deferring and other things in OmniFocus</title>
		<link>http://tanniespace.com/2010/snoozing-deferring-and-other-things-in-omnifocus/</link>
		<comments>http://tanniespace.com/2010/snoozing-deferring-and-other-things-in-omnifocus/#comments</comments>
		<pubDate></pubDate>
		<dc:creator>tanja</dc:creator>
				<category><![CDATA[geekery]]></category>
		<category><![CDATA[applescript]]></category>
		<category><![CDATA[hotkeys]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[omnifocus]]></category>

		<guid isPermaLink="false">http://tanniespace.com/?p=1642</guid>
		<description><![CDATA[A while back I wrote about snoozing and deferring tasks in OmniFocus and Dan&#8217;s scripts. He has since added two more scripts, to move tasks to today and tomorrow quickly. Sometimes I don&#8217;t check my task-list for a few days (for whatever reason) and then I may ==cough== have tons of overdue items. These two [...]]]></description>
			<content:encoded><![CDATA[<p>A <a href="http://tanniespace.com/postponing-tasks-in-omnifocus-and-snoozing/">while back</a> I wrote about snoozing and deferring tasks in OmniFocus and <a href="http://bylr.net/3/category/omnifocus/">Dan&#8217;s scripts</a>. He has since added <a href="http://bylr.net/3/2010/01/today-and-tomorrow-omnifocus-scripts/">two more scripts</a>, to move tasks to today and tomorrow quickly. Sometimes I don&#8217;t check my task-list for a few days (for whatever reason) and then I may ==<em>cough</em>== have tons of overdue items. These two scripts easily let me put them on the right day, either today or tomorrow, and helps me clean up fast.</p>

<p>I&#8217;ve set up the same shortcut keys in <a href="http://www.red-sweater.com/fastscripts/">Fastscripts</a>.</p>

<p>Today I&#8217;ve also edited my task-list. I had too many things on them and felt overwhelmed. After listening to one of Michael Nobbs&#8217; <a href="http://audioboo.fm/boos/88852-happy-new-year-and-a-little-about-the-20-minute-trick">audioboo</a> in which he mentioned his three things to do list and the twenty minute trick (I go for fifteen), and also mentioned that once something becomes a habit he just does it and doesn&#8217;t add it to the list anymore, I decided to remove a few items that I know I do anyway. It looks much smaller and much easier to manage.</p>

<p>I might actually go and do something today&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://tanniespace.com/2010/snoozing-deferring-and-other-things-in-omnifocus/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create a new task in a project</title>
		<link>http://tanniespace.com/2009/create-a-new-task-in-a-project/</link>
		<comments>http://tanniespace.com/2009/create-a-new-task-in-a-project/#comments</comments>
		<pubDate></pubDate>
		<dc:creator>tanja</dc:creator>
				<category><![CDATA[geekery]]></category>
		<category><![CDATA[random_stuff]]></category>
		<category><![CDATA[applescript]]></category>
		<category><![CDATA[context]]></category>
		<category><![CDATA[omnifocus]]></category>
		<category><![CDATA[project]]></category>

		<guid isPermaLink="false">http://tanniespace.com/create-a-new-task-in-a-project/</guid>
		<description><![CDATA[For completion sake, I decided to post the bit to create a new task in a new or existing project in OmniFocus through AppleScript. I have this in my script that creates tasks from my mail. If you know a bit of AppleScript, this should help out. If I have the energy, I might post [...]]]></description>
			<content:encoded><![CDATA[<p>For completion sake, I decided to post the bit to create a new task in a new or existing project in OmniFocus through AppleScript. I have this in my script that creates tasks from my mail.</p>

<p>If you know a bit of AppleScript, this should help out. If I have the energy, I might post the entire script later and explain the parts.</p>

<p>In this case, it took longest to figure out the following part:</p>

<div class="codecolorer-container applescript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="applescript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #ff0033; font-weight: bold;">tell</span> MyProject<br />
&nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> theTask <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">make</span> <span style="color: #0066ff;">new</span> task <span style="color: #ff0033; font-weight: bold;">with</span> <span style="color: #0066ff;">properties</span>¬<br />
&nbsp;<span style="color: #000000;">&#123;</span><span style="color: #0066ff;">name</span>:MyTaskTopic, context:MyContext, note:ThisNote<span style="color: #000000;">&#125;</span><br />
<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span></div></div>

<p>Apparently, when creating a new task you have to tell the project. If you want to set the context, you instead tell the task to set its context property to something.</p>

<p>This does make sense, in the way that you always tell the <em>containing</em> item to do something.</p>

<p><span id="more-1208"></span>
The part I use in my script:</p>

<div class="codecolorer-container applescript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="applescript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #ff0033; font-weight: bold;">if</span> MyContext <span style="color: #ff0033; font-weight: bold;">is</span> <span style="color: #ff0033;">equal</span> <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;NONE&quot;</span> <span style="color: #ff0033;">and</span> MyProject <span style="color: #ff0033; font-weight: bold;">is</span> <span style="color: #ff0033;">equal</span> <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;NONE&quot;</span> <span style="color: #ff0033; font-weight: bold;">then</span><br />
&nbsp; &nbsp;<span style="color: #ff0033; font-weight: bold;">set</span> theTask <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">make</span> <span style="color: #0066ff;">new</span> inbox task ¬<br />
&nbsp; &nbsp; &nbsp;<span style="color: #ff0033; font-weight: bold;">with</span> <span style="color: #0066ff;">properties</span> <span style="color: #000000;">&#123;</span><span style="color: #0066ff;">name</span>:MyTaskTopic, note:ThisNote<span style="color: #000000;">&#125;</span><br />
&nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> ProjectString <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;INBOX&quot;</span><br />
<br />
<span style="color: #ff0033; font-weight: bold;">else</span> <span style="color: #ff0033; font-weight: bold;">if</span> MyContext <span style="color: #ff0033; font-weight: bold;">is</span> <span style="color: #ff0033;">equal</span> <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;NONE&quot;</span> <span style="color: #ff0033;">and</span> ¬<br />
&nbsp;MyProject <span style="color: #ff0033; font-weight: bold;">is</span> <span style="color: #ff0033;">not</span> <span style="color: #ff0033;">equal</span> <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;NONE&quot;</span> <span style="color: #ff0033; font-weight: bold;">then</span><br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">tell</span> MyProject<br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> theTask <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">make</span> <span style="color: #0066ff;">new</span> task ¬<br />
&nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">with</span> <span style="color: #0066ff;">properties</span> <span style="color: #000000;">&#123;</span><span style="color: #0066ff;">name</span>:MyTaskTopic, note:ThisNote<span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span><br />
<br />
<span style="color: #ff0033; font-weight: bold;">else</span> <span style="color: #ff0033; font-weight: bold;">if</span> MyProject <span style="color: #ff0033; font-weight: bold;">is</span> <span style="color: #ff0033;">equal</span> <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;NONE&quot;</span> <span style="color: #ff0033;">and</span> ¬<br />
&nbsp; &nbsp; MyContext <span style="color: #ff0033; font-weight: bold;">is</span> <span style="color: #ff0033;">not</span> <span style="color: #ff0033;">equal</span> <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;NONE&quot;</span> <span style="color: #ff0033; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> theTask <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">make</span> <span style="color: #0066ff;">new</span> inbox task ¬<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">with</span> <span style="color: #0066ff;">properties</span> <span style="color: #000000;">&#123;</span><span style="color: #0066ff;">name</span>:MyTaskTopic, context:MyContext, note:ThisNote<span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> ProjectString <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;INBOX&quot;</span><br />
<br />
<span style="color: #ff0033; font-weight: bold;">else</span><br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">tell</span> MyProject<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> theTask <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">make</span> <span style="color: #0066ff;">new</span> task ¬<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">with</span> <span style="color: #0066ff;">properties</span> <span style="color: #000000;">&#123;</span><span style="color: #0066ff;">name</span>:MyTaskTopic, context:MyContext, note:ThisNote<span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span><br />
<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">if</span><br />
<br />
<span style="color: #ff0033; font-weight: bold;">try</span><br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> Datum <span style="color: #ff0033; font-weight: bold;">to</span> setDueDate<br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> due date <span style="color: #ff0033; font-weight: bold;">of</span> theTask <span style="color: #ff0033; font-weight: bold;">to</span> setDueDate<br />
<span style="color: #ff0033; font-weight: bold;">on</span> <span style="color: #ff0033; font-weight: bold;">error</span><br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> due date <span style="color: #ff0033; font-weight: bold;">of</span> theTask <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>current date<span style="color: #000000;">&#41;</span> <span style="color: #000000;">+</span> <span style="color: #000000;">604800</span><span style="color: #000000;">&#41;</span><br />
<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">try</span><br />
&nbsp; <br />
<span style="color: #ff0033; font-weight: bold;">tell</span> theTask<br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> note <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #ff0033; font-weight: bold;">return</span> <span style="color: #000000;">&amp;</span> <span style="color: #ff0033; font-weight: bold;">return</span><br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">tell</span> note<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> theURL <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;message://&lt; &quot;</span> <span style="color: #000000;">&amp;</span> message_id <span style="color: #000000;">&amp;</span> <span style="color: #009900;">&quot;&gt;&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> linkText <span style="color: #ff0033; font-weight: bold;">to</span> theURL<br />
&nbsp; &nbsp; &nbsp; &nbsp; insert linkText at <span style="color: #ff0033;">before</span> <span style="color: #ff0033;">first</span> character<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> value <span style="color: #ff0033; font-weight: bold;">of</span> attribute <span style="color: #009900;">&quot;link&quot;</span> <span style="color: #ff0033; font-weight: bold;">of</span> style <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #0066ff;">paragraph</span> <span style="color: #000000;">1</span> <span style="color: #ff0033; font-weight: bold;">to</span> theURL<br />
&nbsp; &nbsp; &nbsp; &nbsp; insert message_content at <span style="color: #ff0033;">before</span> <span style="color: #ff0033;">last</span> character<br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span><br />
<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span></div></div>

<p>which works like a charm.</p>
]]></content:encoded>
			<wfw:commentRss>http://tanniespace.com/2009/create-a-new-task-in-a-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Applescripts for OmniFocus: change the context or project of selected tasks.</title>
		<link>http://tanniespace.com/2009/applescripts-for-omnifocus-change-the-context-or-project-of-selected-tasks/</link>
		<comments>http://tanniespace.com/2009/applescripts-for-omnifocus-change-the-context-or-project-of-selected-tasks/#comments</comments>
		<pubDate></pubDate>
		<dc:creator>tanja</dc:creator>
				<category><![CDATA[geekery]]></category>
		<category><![CDATA[random_stuff]]></category>
		<category><![CDATA[applescript]]></category>
		<category><![CDATA[context]]></category>
		<category><![CDATA[e-mail]]></category>
		<category><![CDATA[easy]]></category>
		<category><![CDATA[list]]></category>
		<category><![CDATA[omnifocus]]></category>
		<category><![CDATA[omniweb]]></category>
		<category><![CDATA[project]]></category>

		<guid isPermaLink="false">http://tanniespace.com/applescripts-for-omnifocus-change-the-context-or-project-of-selected-tasks/</guid>
		<description><![CDATA[I use OmniFocus a lot, and have recently tweaked some more AppleScripts to make my workflow even more smooth. I can add any mail to OmniFocus for replies, add confirmation of orders from mail to OmniFocus which will automatically go into my project-shoebox for orders, with a &#8216;waiting for&#8217; context and a due date set [...]]]></description>
			<content:encoded><![CDATA[<p>I use OmniFocus a lot, and have recently tweaked some more AppleScripts to make my workflow even more smooth. I can add any mail to OmniFocus for replies, add confirmation of orders from mail to OmniFocus which will automatically go into my project-shoebox for orders, with a &#8216;waiting for&#8217; context and a due date set to 1 week into the future, unless I&#8217;ve changed or added <a href="http://www.indev.ca/MailTags.html">MailTags</a> with a project, a keyword and a due date. In that case it&#8217;ll take the project, the first keyword and the due date and use them to set up the OmniFocus task. I have a few more scripts:</p>

<ul>
<li>in OmniWeb I can take and add a URL for later reading, it&#8217;ll go into my inbox by default</li>
<li>in OmniWeb I can take and add a URL to my &#8216;wish-list&#8217; project (with a start date for at 2 weeks in the future)</li>
<li>in OmniFocus I have scripts to easily change the context or the project of selected tasks</li>
<li>in Mail I can press a key and have the selected e-mail(s) sent to OmniFocus with a &#8216;Respond to: &#8216; before the subject line, sorting into either a default project or the one specified in MailTags, with the context set to &#8216;mail&#8217; and the message URL in the note-field</li>
<li>in OmniFocus I can select such a task, press a key to run a script that will open the message and immediately create a reply (I have a separate one for just opening, in case I have to read it thoroughly first)</li>
</ul>

<p>All these scripts make the integration between all these programs very easy. That and <a href="http://www.red-sweater.com/fastscripts/">FastScripts</a>.<br />
I found useful scripts over at <a href="http://www.rose-hulman.edu/~clifton/software.html">Curtis Clifton&#8217;s site</a>. His scripts use <a href="http://growl.info/">Growl</a> notification so if you have Growl installed you get a small notification.</p>

<p>I had some trouble putting my own scripts together, so I decided to paste the info here, just in case I need it later on, or someone else runs into similar issues. I found it quite hard to figure out how to add a task to an existing project or to move it from inbox / other project. In the end, it only took a few lines.</p>

<p><span id="more-1207"></span>
First, when I started my script, I wanted a default project or context (I&#8217;ll use &#8216;project&#8217; from now on, but it also applies to the context-script). To do this I created a &#8216;property&#8217; at the beginning of the script:</p>

<div class="codecolorer-container applescript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="applescript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #ff0033; font-weight: bold;">property</span> defaultProject : <span style="color: #009900;">&quot;Miscellaneous&quot;</span><br />
<span style="color: #ff0033; font-weight: bold;">property</span> alertItemNum : <span style="color: #009900;">&quot;&quot;</span></div></div>

<p>I used the alterItemNum for my alerts through this very simple routine:</p>

<div class="codecolorer-container applescript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="applescript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #ff0033; font-weight: bold;">on</span> notify<span style="color: #000000;">&#40;</span>alertName, alertTitle, alertText<span style="color: #000000;">&#41;</span><br />
&nbsp; <span style="color: #0066ff;">display dialog</span> alertText <span style="color: #ff0033;">as</span> <span style="color: #0066ff;">string</span> <span style="color: #ff0033; font-weight: bold;">with</span> icon <span style="color: #000000;">1</span><br />
<span style="color: #ff0033; font-weight: bold;">end</span> notify</div></div>

<p>That went at the end of my script.</p>

<p>I started by addressing OmniFocus and &#8216;talking&#8217; to the open document:</p>

<div class="codecolorer-container applescript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="applescript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;OmniFocus&quot;</span><br />
&nbsp; <span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #ff0033;">front</span> <span style="color: #0066ff;">document</span><br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #000000;">&#40;</span><span style="color: #ff0033;">first</span> <span style="color: #0066ff;">document</span> <span style="color: #0066ff;">window</span> <span style="color: #ff0033;">whose</span> <span style="color: #ff0033;">index</span> <span style="color: #ff0033; font-weight: bold;">is</span> <span style="color: #000000;">1</span><span style="color: #000000;">&#41;</span></div></div>

<p>Then, I checked to see if that document had anything selected, and if not, give an error-dialogue:</p>

<div class="codecolorer-container applescript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="applescript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #ff0033; font-weight: bold;">set</span> SelectedItems <span style="color: #ff0033; font-weight: bold;">to</span> selected trees <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #0066ff;">content</span><br />
<span style="color: #ff0033; font-weight: bold;">set</span> numItems <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">&#40;</span><span style="color: #0066ff;">count</span> <span style="color: #0066ff;">items</span> <span style="color: #ff0033; font-weight: bold;">of</span> SelectedItems<span style="color: #000000;">&#41;</span><br />
&nbsp; <span style="color: #ff0033; font-weight: bold;">if</span> numItems <span style="color: #ff0033; font-weight: bold;">is</span> <span style="color: #000000;">0</span> <span style="color: #ff0033; font-weight: bold;">then</span><br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> alertName <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;Error&quot;</span><br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> alertTitle <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;Script failure&quot;</span><br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> alertText <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;No valid task(s) selected&quot;</span><br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">my</span> notify<span style="color: #000000;">&#40;</span>alertName, alertTitle, alertText<span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">return</span><br />
&nbsp; <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">if</span></div></div>

<p>If I have no items selected, the script will call the alert routine from above ( my notify(alertName, alertTitle, alertText) ). Because I created a separate routine, I can use this anywhere in the script.</p>

<p>Next, display a dialogue asking for the project:</p>

<div class="codecolorer-container applescript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="applescript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0066ff;">display dialog</span> <span style="color: #009900;">&quot;Change to what Project? &quot;</span> <span style="color: #0066ff;">default answer</span> defaultProject <span style="color: #0066ff;">buttons</span> <span style="color: #000000;">&#123;</span><span style="color: #009900;">&quot;Cancel&quot;</span>, <span style="color: #009900;">&quot;OK&quot;</span><span style="color: #000000;">&#125;</span> default button <span style="color: #000000;">2</span><br />
<br />
<span style="color: #ff0033; font-weight: bold;">set</span> theProject <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">&#40;</span><span style="color: #ff0033;">the</span> <span style="color: #0066ff;">text</span> returned <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #ff0033;">the</span> <span style="color: #0066ff;">result</span><span style="color: #000000;">&#41;</span></div></div>

<p>The variable &#8216;theProject&#8217; will now contain the name of the (new) project to move the tasks too.</p>

<p>Next, the loop to go through all the items and move them:</p>

<div class="codecolorer-container applescript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="applescript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #ff0033; font-weight: bold;">set</span> selectNum <span style="color: #ff0033; font-weight: bold;">to</span> numItems<br />
<span style="color: #ff0033; font-weight: bold;">set</span> successTot <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">0</span><br />
&nbsp;<span style="color: #ff0033; font-weight: bold;">repeat</span> <span style="color: #ff0033; font-weight: bold;">while</span> selectNum &gt; <span style="color: #000000;">0</span><br />
&nbsp; &nbsp;<span style="color: #ff0033; font-weight: bold;">set</span> selectedItem <span style="color: #ff0033; font-weight: bold;">to</span> value <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #0066ff;">item</span> selectNum <span style="color: #ff0033; font-weight: bold;">of</span> SelectedItems<br />
&nbsp; &nbsp;<span style="color: #ff0033; font-weight: bold;">set</span> succeeded <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #ff0033; font-weight: bold;">my</span> ChangeProject<span style="color: #000000;">&#40;</span>selectedItem, theProject<span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp;<span style="color: #ff0033; font-weight: bold;">if</span> succeeded <span style="color: #ff0033; font-weight: bold;">then</span> <span style="color: #ff0033; font-weight: bold;">set</span> successTot <span style="color: #ff0033; font-weight: bold;">to</span> successTot <span style="color: #000000;">+</span> <span style="color: #000000;">1</span><br />
&nbsp; &nbsp;<span style="color: #ff0033; font-weight: bold;">set</span> selectNum <span style="color: #ff0033; font-weight: bold;">to</span> selectNum <span style="color: #000000;">-</span> <span style="color: #000000;">1</span><br />
&nbsp;<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">repeat</span></div></div>

<p>This loop will end as soon as the variable &#8216;selectNum&#8217; (= numItems which I set to the count of the items in the variable SelectedItems) reaches 0. It calls the routine &#8216;ChangeProject&#8217; which I&#8217;ll get to in a bit, but I first want to wrap up this part.
Let me also explain the &#8216;if succeeded then set successTot to successTot + 1&#8242; line. The line before sets &#8216;succeeded&#8217; to the result of the ChangeProject routine. This result can mean anything, numbers, letters, whatever. In this case we use it to return a &#8216;true&#8217; or &#8216;false&#8217;. That way, we only need to use &#8216;if succeeded&#8217; (which will either be &#8216;true&#8217; or &#8216;false&#8217;) as a condition. We don&#8217;t need to check the actual content of the variable. This can come in handy for various checks, and it took me a while to catch on to that, so I figured I&#8217;d mention it here.</p>

<p>To end this main routine, I used:</p>

<div class="codecolorer-container applescript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="applescript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> alertName <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;General&quot;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> alertTitle <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;Script complete&quot;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">if</span> successTot <span style="color: #000000;">&amp;</span>gt; <span style="color: #000000;">1</span> <span style="color: #ff0033; font-weight: bold;">then</span> <span style="color: #ff0033; font-weight: bold;">set</span> alertItemNum <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;s&quot;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> alertText <span style="color: #ff0033; font-weight: bold;">to</span> successTot <span style="color: #000000;">&amp;</span> <span style="color: #009900;">&quot; item&quot;</span> <span style="color: #000000;">&amp;</span> alertItemNum <span style="color: #000000;">&amp;</span> <span style="color: #009900;">&quot; changed to Project &quot;</span> <span style="color: #000000;">&amp;</span> theProject<br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span><br />
&nbsp; <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span><br />
<span style="color: #ff0033; font-weight: bold;">my</span> notify<span style="color: #000000;">&#40;</span>alertName, alertTitle, alertText<span style="color: #000000;">&#41;</span><br />
<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span></div></div>

<p>Basically, this tells the dialogue box to say the script ran successfully and displays the number of items successfully moved and only to use the &#8216;s&#8217; after &#8216;item&#8217; if the count of successful moves is higher than 1.</p>

<p>That wraps up the main part.</p>

<p>The routine to actually move the task to the other project only took 21 lines:</p>

<div class="codecolorer-container applescript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="applescript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #ff0033; font-weight: bold;">on</span> ChangeProject<span style="color: #000000;">&#40;</span>selectedItem, theProject<span style="color: #000000;">&#41;</span><br />
&nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> success <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">false</span><br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;OmniFocus&quot;</span> <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #ff0033; font-weight: bold;">tell</span> default <span style="color: #0066ff;">document</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>theProject <span style="color: #ff0033; font-weight: bold;">is</span> <span style="color: #ff0033;">not</span> <span style="color: #009900;">&quot;&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #ff0033; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> MyProjectArray <span style="color: #ff0033; font-weight: bold;">to</span> null<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> MyProjectArray <span style="color: #ff0033; font-weight: bold;">to</span> complete theProject <span style="color: #ff0033;">as</span> project maximum matches <span style="color: #000000;">1</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">try</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> MyProjectID <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">id</span> <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #ff0033;">first</span> <span style="color: #0066ff;">item</span> <span style="color: #ff0033; font-weight: bold;">of</span> MyProjectArray<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> theNewProject <span style="color: #ff0033; font-weight: bold;">to</span> project <span style="color: #0066ff;">id</span> MyProjectID<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">on</span> <span style="color: #ff0033; font-weight: bold;">error</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> theNewProject <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">&#40;</span><span style="color: #0066ff;">make</span> project <span style="color: #ff0033; font-weight: bold;">with</span> <span style="color: #0066ff;">properties</span> <span style="color: #000000;">&#123;</span><span style="color: #0066ff;">name</span>:theProject<span style="color: #000000;">&#125;</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">try</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">try</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> newtask <span style="color: #ff0033; font-weight: bold;">to</span> selectedItem<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066ff;">move</span> newtask <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">of</span> tasks <span style="color: #ff0033; font-weight: bold;">of</span> theNewProject<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> success <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">true</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">try</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">if</span><br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span><br />
&nbsp; <span style="color: #ff0033; font-weight: bold;">return</span> success<br />
<span style="color: #ff0033; font-weight: bold;">end</span> ChangeProject</div></div>

<p>The first line sets the success to &#8216;false&#8217;, because we want to actively, <em>after</em> having our success, set it to &#8216;true&#8217;.<br />
We then chat with OmniFocus again, and this time, we&#8217;ll just talk to the default document (the one you have open). If the variable &#8216;theProject&#8217; is not empty, we&#8217;ll continue. If it is, the &#8216;if-end if&#8217; ends, without having set the &#8216;success&#8217; variable to true (and thus, the script failed). You could technically build in an extra loop to change it to a default project, however, I prefer it this way. If I accidentally emptied that dialogue-box, nothing will happen, just as I like it.</p>

<p>If theProject does contain something (anything), the script continues with its routine. It sets the MyProjectArry to null (makes it empty, just in case). It then used OmniFocus complete option to find the first matching project of OmniFocuses project-list. If you&#8217;ve ever only typed the first three letters in one of OmniFocus&#8217;s project-areas (to set the project) and it magically came up with the right project, this is the same thing. It means you only have to type the first three or four letters of your project, and the script will find it. If it can&#8217;t find the project, it will create it for you (at the end of your project-list).</p>

<p>After that, it will simply try to add the task to the desired project.</p>

<div class="codecolorer-container applescript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="applescript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #ff0033; font-weight: bold;">try</span><br />
&nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> newtask <span style="color: #ff0033; font-weight: bold;">to</span> selectedItem<br />
&nbsp; <span style="color: #0066ff;">move</span> newtask <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">of</span> tasks <span style="color: #ff0033; font-weight: bold;">of</span> theNewProject<br />
&nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> success <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">true</span><br />
<span style="color: #ff0033; font-weight: bold;">end</span></div></div>

<p>I&#8217;ve copied this part again, because <em>this</em> took me hours to figure out. I knew how to do it for a context-change:</p>

<div class="codecolorer-container applescript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="applescript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #ff0033; font-weight: bold;">try</span><br />
&nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> newtask <span style="color: #ff0033; font-weight: bold;">to</span> selectedItem<br />
&nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> context <span style="color: #ff0033; font-weight: bold;">of</span> newtask <span style="color: #ff0033; font-weight: bold;">to</span> theNewContext<br />
&nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> success <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">true</span><br />
<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">try</span></div></div>

<p>so I tried to &#8216;set project of newtask to theNewProject&#8217; but that didn&#8217;t work. It drove me crazy for a while, still haven&#8217;t fully recovered&#8230;</p>

<p>But it works! The complete script changes the project of selected tasks and gives a confirmation dialogue (so you know that it happened). Of course, before using it, make a back up of your OmniFocus database, and run the script from Script Editor first. Open the &#8216;Event Log&#8217; (&#8984;-3) to follow what happens while you run the script.</p>

<p><strong>zipped up version of <a href="http://tanniespace.com/files/2009/09/ChangeProject.scpt.zip">ChangeProject</a> and <a href="http://tanniespace.com/files/2009/09/ChangeContext.scpt.zip">ChangeContext</a> for easy downloading</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://tanniespace.com/2009/applescripts-for-omnifocus-change-the-context-or-project-of-selected-tasks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bit.ly + TextExpander + Applescript = WIN!</title>
		<link>http://tanniespace.com/2009/bitly-textexpander-applescript-win/</link>
		<comments>http://tanniespace.com/2009/bitly-textexpander-applescript-win/#comments</comments>
		<pubDate></pubDate>
		<dc:creator>tanja</dc:creator>
				<category><![CDATA[geekery]]></category>
		<category><![CDATA[applescript]]></category>
		<category><![CDATA[omniweb]]></category>
		<category><![CDATA[textexpander]]></category>

		<guid isPermaLink="false">http://tanniespace.com/?p=777</guid>
		<description><![CDATA[I wanted an easy way to shorten my URLs through one of the URL-shorteners out there. I liked bit.ly, because it&#8217;s nice and short, has an easy to navigate web-interface (without a mouse) and I can use its magic with my terminal (cURL). I also very much like TextExpander and after googling a bit, I [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted an easy way to shorten my URLs through one of the URL-shorteners out there. I liked <a href="http://bit.ly/">bit.ly</a>, because it&#8217;s nice and short, has an easy to navigate web-interface (without a mouse) and I can use its magic with my terminal (cURL).</p>

<p>I also very much like <a href="http://www.smileonmymac.com/TextExpander/">TextExpander</a> and after googling a bit, I ofcourse found an <a href="http://www.livedigitally.com/2008/07/23/how-to-automatic-url-shortening-with-bitly-and-textexpander/">Applescript for TextExpander and Bit.ly</a>. That link also shows how to set it up in TextExpander, very handy!
The script does not however use your actual bit.ly account so you can keep track of the URLs you shorten. I tweaked it and made adjustments and it took hours and ofcourse, then I find <a href="http://snipplr.com/view/13743/bitly-urlshortening-script-for-textexpander-that-associates-urls-with-your-bitly-account/">this</a> which is almost exactly what I had, except with URL-encoding (yummy).
The only problem with that one was that I couldn&#8217;t get it to have the URLs show up in my recent history. The &#8216;history=1&#8242; didn&#8217;t seem to work.</p>

<p>I tweaked some more and came up with something that completely does what I want. I use <a href="http://www.omnigroup.com/applications/omniweb/">OmniWeb</a> so I replaced the</p>

<div class="codecolorer-container applescript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="applescript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #ff0033; font-weight: bold;">set</span> <span style="color: #ff0033;">the</span> PageURL <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">&#40;</span><span style="color: #0066ff;"><span style="color: #ff0033;">the</span> clipboard</span> <span style="color: #ff0033;">as</span> <span style="color: #0066ff;">string</span><span style="color: #000000;">&#41;</span></div></div>

<p>with</p>

<div class="codecolorer-container applescript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="applescript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;OmniWeb&quot;</span><br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> PageURL <span style="color: #ff0033; font-weight: bold;">to</span> address <span style="color: #ff0033; font-weight: bold;">of</span> active <span style="color: #0066ff;">tab</span> <span style="color: #ff0033; font-weight: bold;">of</span> browser <span style="color: #000000;">1</span><br />
<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span></div></div>

<p>If you use safari, use</p>

<div class="codecolorer-container applescript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="applescript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;Safari&quot;</span><br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> PageURL <span style="color: #ff0033; font-weight: bold;">to</span> URL <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #ff0033;">front</span> <span style="color: #0066ff;">document</span><br />
<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span></div></div>

<p><span id="more-777"></span>
I&#8217;ve made this as readable as possible, the &#8216;&not;&#8217; do matter in Applescript.</p>

<div class="codecolorer-container applescript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="applescript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;OmniWeb&quot;</span><br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> PageURL <span style="color: #ff0033; font-weight: bold;">to</span> address <span style="color: #ff0033; font-weight: bold;">of</span> active <span style="color: #0066ff;">tab</span> <span style="color: #ff0033; font-weight: bold;">of</span> browser <span style="color: #000000;">1</span><br />
<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span><br />
<br />
<span style="color: #ff0033; font-weight: bold;">set</span> login <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;YOUR LOGIN&quot;</span><br />
<span style="color: #ff0033; font-weight: bold;">set</span> api_key <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;YOUR API KEY&quot;</span><br />
<span style="color: #ff0033; font-weight: bold;">set</span> <span style="color: #ff0033;">the</span> EncodedURL <span style="color: #ff0033; font-weight: bold;">to</span> urlencode<span style="color: #000000;">&#40;</span>PageURL<span style="color: #000000;">&#41;</span> <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #0066ff;">me</span><br />
<br />
<span style="color: #ff0033; font-weight: bold;">set</span> curlCMD <span style="color: #ff0033; font-weight: bold;">to</span> ¬<br />
&nbsp; &nbsp; <span style="color: #009900;">&quot;curl --stderr /dev/null <span style="color: #000000; font-weight: bold;">\&quot;</span>http://api.bit.ly/v3/shorten?format=txt&amp;longUrl=&quot;</span> ¬<br />
&nbsp; &nbsp; <span style="color: #000000;">&amp;</span> EncodedURL <span style="color: #000000;">&amp;</span> <span style="color: #009900;">&quot;&amp;history=1&amp;login=&quot;</span> <span style="color: #000000;">&amp;</span> login ¬<br />
&nbsp; &nbsp; <span style="color: #000000;">&amp;</span> <span style="color: #009900;">&quot;&amp;apiKey=&quot;</span> <span style="color: #000000;">&amp;</span> api_key ¬<br />
&nbsp; &nbsp; <span style="color: #000000;">&amp;</span> <span style="color: #009900;">&quot;<span style="color: #000000; font-weight: bold;">\&quot;</span>&quot;</span><br />
<br />
<br />
<span style="color: #808080; font-style: italic;">-- Run the script and get the result:</span><br />
<span style="color: #ff0033; font-weight: bold;">set</span> bitlyURL <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">&#40;</span><span style="color: #0066ff;">do shell script</span> curlCMD<span style="color: #000000;">&#41;</span><br />
<br />
<span style="color: #ff0033; font-weight: bold;">return</span> bitlyURL<br />
<br />
<span style="color: #ff0033; font-weight: bold;">on</span> urlencode<span style="color: #000000;">&#40;</span>theText<span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> theTextEnc <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;&quot;</span><br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">repeat</span> <span style="color: #ff0033; font-weight: bold;">with</span> eachChar <span style="color: #ff0033; font-weight: bold;">in</span> characters <span style="color: #ff0033; font-weight: bold;">of</span> theText<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> useChar <span style="color: #ff0033; font-weight: bold;">to</span> eachChar<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> eachCharNum <span style="color: #ff0033; font-weight: bold;">to</span> ASCII <span style="color: #0066ff;">number</span> <span style="color: #ff0033; font-weight: bold;">of</span> eachChar<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">if</span> eachCharNum <span style="color: #000000;">=</span> <span style="color: #000000;">32</span> <span style="color: #ff0033; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> useChar <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;+&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">else</span> <span style="color: #ff0033; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>eachCharNum ≠ <span style="color: #000000;">42</span><span style="color: #000000;">&#41;</span> <span style="color: #ff0033;">and</span> <span style="color: #000000;">&#40;</span>eachCharNum ≠ <span style="color: #000000;">95</span><span style="color: #000000;">&#41;</span> ¬<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033;">and</span> <span style="color: #000000;">&#40;</span>eachCharNum <span style="color: #000000;">&lt;</span> <span style="color: #000000;">45</span> <span style="color: #ff0033;">or</span> eachCharNum &gt; <span style="color: #000000;">46</span><span style="color: #000000;">&#41;</span> ¬<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033;">and</span> <span style="color: #000000;">&#40;</span>eachCharNum <span style="color: #000000;">&lt;</span> <span style="color: #000000;">48</span> <span style="color: #ff0033;">or</span> eachCharNum &gt; <span style="color: #000000;">57</span><span style="color: #000000;">&#41;</span> ¬<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033;">and</span> <span style="color: #000000;">&#40;</span>eachCharNum <span style="color: #000000;">&lt;</span> <span style="color: #000000;">65</span> <span style="color: #ff0033;">or</span> eachCharNum &gt; <span style="color: #000000;">90</span><span style="color: #000000;">&#41;</span> ¬<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033;">and</span> <span style="color: #000000;">&#40;</span>eachCharNum <span style="color: #000000;">&lt;</span> <span style="color: #000000;">97</span> <span style="color: #ff0033;">or</span> eachCharNum &gt; <span style="color: #000000;">122</span><span style="color: #000000;">&#41;</span> <span style="color: #ff0033; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> firstDig <span style="color: #ff0033; font-weight: bold;">to</span> round <span style="color: #000000;">&#40;</span>eachCharNum <span style="color: #000000;">/</span> <span style="color: #000000;">16</span><span style="color: #000000;">&#41;</span> rounding down<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> secondDig <span style="color: #ff0033; font-weight: bold;">to</span> eachCharNum <span style="color: #ff0033;">mod</span> <span style="color: #000000;">16</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">if</span> firstDig &gt; <span style="color: #000000;">9</span> <span style="color: #ff0033; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> aNum <span style="color: #ff0033; font-weight: bold;">to</span> firstDig <span style="color: #000000;">+</span> <span style="color: #000000;">55</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> firstDig <span style="color: #ff0033; font-weight: bold;">to</span> ASCII character aNum<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">if</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">if</span> secondDig &gt; <span style="color: #000000;">9</span> <span style="color: #ff0033; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> aNum <span style="color: #ff0033; font-weight: bold;">to</span> secondDig <span style="color: #000000;">+</span> <span style="color: #000000;">55</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> secondDig <span style="color: #ff0033; font-weight: bold;">to</span> ASCII character aNum<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">if</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> numHex <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">&#40;</span><span style="color: #009900;">&quot;%&quot;</span> <span style="color: #000000;">&amp;</span> <span style="color: #000000;">&#40;</span>firstDig <span style="color: #ff0033;">as</span> <span style="color: #0066ff;">string</span><span style="color: #000000;">&#41;</span> ¬<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&amp;</span> <span style="color: #000000;">&#40;</span>secondDig <span style="color: #ff0033;">as</span> <span style="color: #0066ff;">string</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #ff0033;">as</span> <span style="color: #0066ff;">string</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> useChar <span style="color: #ff0033; font-weight: bold;">to</span> numHex<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">if</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> theTextEnc <span style="color: #ff0033; font-weight: bold;">to</span> theTextEnc <span style="color: #000000;">&amp;</span> useChar <span style="color: #ff0033;">as</span> <span style="color: #0066ff;">string</span><br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">repeat</span><br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">return</span> theTextEnc<br />
<span style="color: #ff0033; font-weight: bold;">end</span> urlencode</div></div>

<p>ETA (2010.09.30): bit.ly changed a few things so I changed the script above to reflect that</p>
]]></content:encoded>
			<wfw:commentRss>http://tanniespace.com/2009/bitly-textexpander-applescript-win/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>OmniWeb now free!</title>
		<link>http://tanniespace.com/2009/omniweb-now-free/</link>
		<comments>http://tanniespace.com/2009/omniweb-now-free/#comments</comments>
		<pubDate></pubDate>
		<dc:creator>tanja</dc:creator>
				<category><![CDATA[geekery]]></category>
		<category><![CDATA[applescript]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[omniweb]]></category>

		<guid isPermaLink="false">http://tanniespace.com/?p=687</guid>
		<description><![CDATA[Once again I got frustrated with Firefox and Safari for numerous reasons. I went over to the OmniGroup site to check out OmniWeb cause I really liked using its demo. I wanted to see what price they charged and see if I would want to part with that (next month) to solve my frustrations with [...]]]></description>
			<content:encoded><![CDATA[<p>Once again I got frustrated with <a href="http://www.mozilla.com/firefox/">Firefox</a> and <a href="http://www.apple.com/safari/">Safari</a> for numerous reasons. I went over to the <a href="http://www.omnigroup.com/">OmniGroup site</a> to check out <a href="http://www.omnigroup.com/applications/omniweb/">OmniWeb</a> cause I really liked using its demo. I wanted to see what price they charged and see if I would want to part with that (next month) to solve my frustrations with The Other Browsers.</p>

<p>And they made it <a href="http://blog.omnigroup.com/2009/02/25/omniweb-omnidazzle-omnidisksweeper-and-omniobjectmeter-now-freeware/">free</a>. I suck for only finding out now, three weeks after they made it free, but at least it means I can have my lovely browser that supports applescript <em>and</em> Services (looking at you, Firefox!), doesn&#8217;t take ages to load a page (again, looking at you, Firefox!) and supports non-mouse browsing (Firefox! no wait, that&#8217;s actually Safari&#8230;.).</p>

<p>Very happy :D</p>
]]></content:encoded>
			<wfw:commentRss>http://tanniespace.com/2009/omniweb-now-free/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<enclosure url="http://tanniespace.com/files/2009/03/omniweb.png" length="28017" type="image/jpg" /><media:content url="http://tanniespace.com/files/2009/03/omniweb.png" width="128" height="128" medium="image" type="image/png" />	</item>
		<item>
		<title>Postponing tasks in OmniFocus (and snoozing)</title>
		<link>http://tanniespace.com/2009/postponing-tasks-in-omnifocus-and-snoozing/</link>
		<comments>http://tanniespace.com/2009/postponing-tasks-in-omnifocus-and-snoozing/#comments</comments>
		<pubDate></pubDate>
		<dc:creator>tanja</dc:creator>
				<category><![CDATA[geekery]]></category>
		<category><![CDATA[applescript]]></category>
		<category><![CDATA[gtd]]></category>
		<category><![CDATA[omnifocus]]></category>

		<guid isPermaLink="false">http://tanniespace.com/?p=663</guid>
		<description><![CDATA[For a while I&#8217;ve wanted to easily postpone tasks in OmniFocus because sometimes, I just want to procrastinate a little. Last night I started fiddling and playing with AppleScript to get this done and after a few hours of that I wanted to rip my hair out. I went to bed instead because I quite [...]]]></description>
			<content:encoded><![CDATA[<p>For a while I&#8217;ve wanted to easily postpone tasks in OmniFocus because sometimes, I just want to procrastinate a little.<br />
Last night I started fiddling and playing with AppleScript to get this done and after a few hours of that I wanted to rip my hair out. I went to bed instead because I quite like my hair intact and had a few other things to do today, so didn&#8217;t get around to it until now. I applied my google-foo to try and fix the problems I ran into.</p>

<p>And &#8216;lo and behold! I found <a href="http://bylr.net/3/2009/02/omnifocus-defer-script-updated/">Dan&#8217;s site</a> who did not only make a script to postpone the due date (defer it), it also gives you the option to defer the start date <em>and</em> he made a nifty little <a href="http://bylr.net/3/2009/02/omnifocus-snooze-script/">snooze script</a> to basically hide projects / tasks from your view until you have to do them (by adjusting the start date).</p>

<p>I&#8217;ve tossed both in my ~/Library/Scripts/Applications/OmniFocus folder and set up a hotkey in <a href="http://www.apple.com/downloads/macosx/productivity_tools/quicksilver.html">QuickSilver</a> and tried it out on a few tasks. Works like a charm!</p>
]]></content:encoded>
			<wfw:commentRss>http://tanniespace.com/2009/postponing-tasks-in-omnifocus-and-snoozing/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	<enclosure url="http://tanniespace.com/files/2009/03/omnifocus.png" length="15226" type="image/jpg" /><media:content url="http://tanniespace.com/files/2009/03/omnifocus.png" width="96" height="96" medium="image" type="image/png" />	</item>
	</channel>
</rss>

