<?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>bylr.net &#187; applescript</title>
	<atom:link href="http://bylr.net/3/category/applescript/feed/" rel="self" type="application/rss+xml" />
	<link>http://bylr.net/3</link>
	<description>&#34;you&#039;re at this website. i guarantee it.&#34; -dan byler</description>
	<lastBuildDate>Tue, 13 Dec 2011 23:49:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>All OmniFocus AppleScripts updated to use new notification code</title>
		<link>http://bylr.net/3/2011/10/all-omnifocus-applescripts-updated-to-use-new-notification-code/</link>
		<comments>http://bylr.net/3/2011/10/all-omnifocus-applescripts-updated-to-use-new-notification-code/#comments</comments>
		<pubDate>Mon, 31 Oct 2011 09:07:01 +0000</pubDate>
		<dc:creator>Dan Byler</dc:creator>
				<category><![CDATA[OmniFocus]]></category>
		<category><![CDATA[applescript]]></category>

		<guid isPermaLink="false">http://bylr.net/3/?p=320</guid>
		<description><![CDATA[I&#8217;ve updated all the OmniFocus scripts to use new notification code, which can handle Growl 1.3, previous versions of Growl, and Growl-free systems. You can grab them individually on the Github repo or my download page. Or, just download them all in one go.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve updated all the OmniFocus scripts to use new notification code, which can handle Growl 1.3, previous versions of Growl, and Growl-free systems.</p>

<p>You can grab them individually on the <a href="https://github.com/dbyler/omnifocus-scripts">Github repo</a> or <a href="http://bylr.net/files/omnifocus">my download page</a>. Or, just <a href="https://github.com/dbyler/omnifocus-scripts/zipball/master">download them all in one go.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://bylr.net/3/2011/10/all-omnifocus-applescripts-updated-to-use-new-notification-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AppleScript and Growl: a survey of possible solutions to the &#8220;Growl not installed&#8221; problem</title>
		<link>http://bylr.net/3/2011/09/applescript-and-growl/</link>
		<comments>http://bylr.net/3/2011/09/applescript-and-growl/#comments</comments>
		<pubDate>Wed, 07 Sep 2011 16:46:09 +0000</pubDate>
		<dc:creator>Dan Byler</dc:creator>
				<category><![CDATA[applescript]]></category>

		<guid isPermaLink="false">http://bylr.net/3/?p=305</guid>
		<description><![CDATA[10/31/11: Updated to work with Growl 1.3 (MAS version). TL;DR: If you want to use Growl notifications in your AppleScripts without causing problems for people who don&#8217;t have it installed, feel free to use this code. For anyone who writes AppleScripts that use Growl notifications, the problem is familiar: if a user doesn&#8217;t have Growl [...]]]></description>
			<content:encoded><![CDATA[<blockquote>
  <p>10/31/11: Updated to work with Growl 1.3 (MAS version).</p>
</blockquote>

<p><strong><em>TL;DR:</em></strong> <em>If you want to use Growl notifications in your AppleScripts without causing problems for people who don&#8217;t have it installed, feel free to use <a href="https://github.com/dbyler/misc-scripts/raw/master/Generic%20Growl%20Code.scpt">this code</a>.</em></p>

<p>For anyone who writes AppleScripts that use Growl notifications, the problem is familiar: if a user doesn&#8217;t have Growl installed, the script throws a fit when they try to run it. Specifically, at load time, the AppleScript interpreter looks for all the applications listed in the script to retrieve their scripting dictionaries, and if it can&#8217;t find any of the listed applications, it asks the user where to find it:</p>

<p><img style="display:block; margin-left:auto; margin-right:auto;" src="http://bylr.net/3/wp-content/uploads/2011/09/Where-is-GrowlHelperApp.png" alt="Where is GrowlHelperApp.png" title="Where is GrowlHelperApp.png" border="0" width="600" height="439" /></p>

<p>This can be frustrating for users who don&#8217;t have Growl installed: either they don&#8217;t know what Growl is (and therefore have no idea what to do in this situation), or they actively prefer not to have Growl on their system. In neither case do you want to force users to install Growl.</p>

<p>Although others have written about this issue—including a couple solutions that work—I still spent a lot of time and frustration trying to work through the issue and thought it might be helpful to post a survey of different methods that don&#8217;t work—and why.</p>

<h2>Method one (bad): Growl, straight-up</h2>

<p><strong>Pros:</strong> Elegant, simple, as Growl intended. <strong>Cons:</strong> Script chokes on Growl-free systems.</p>

<p>The simplest solution is to call Growl using the intended syntax, ignoring users who don&#8217;t have Growl installed. The code is straightforward and easy to understand:</p>

<div class="codesnip-container" ><div class="applescript codesnip" style="font-family:monospace;"><span class="kw3">property</span> growlAppName : <span class="st0">&quot;Dan&#8217;s Scripts&quot;</span><br />
<span class="kw3">property</span> allNotifications : <span class="br0">&#123;</span><span class="st0">&quot;General&quot;</span>, <span class="st0">&quot;Error&quot;</span><span class="br0">&#125;</span><br />
<span class="kw3">property</span> enabledNotifications : <span class="br0">&#123;</span><span class="st0">&quot;General&quot;</span>, <span class="st0">&quot;Error&quot;</span><span class="br0">&#125;</span><br />
<span class="kw3">property</span> iconApplication : <span class="st0">&quot;OmniFocus.app&quot;</span><br />
<br />
<span class="kw3">tell</span> <span class="kw1">application</span> <span class="st0">&quot;GrowlHelperApp&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; register <span class="kw2">as</span> <span class="kw1">application</span> growlAppName all notifications allNotifications default notifications enabledNotifications icon <span class="kw3">of</span> <span class="kw1">application</span> iconApplication<br />
&nbsp; &nbsp; &nbsp; &nbsp; notify <span class="kw3">with</span> <span class="kw1">name</span> <span class="st0">&quot;General&quot;</span> title <span class="st0">&quot;Note title&quot;</span> <span class="kw1">application</span> <span class="kw1">name</span> growlAppName description <span class="st0">&quot;Note description&quot;</span><br />
<span class="kw3">end</span> <span class="kw3">tell</span></div></div>

<p>But if the point of your script is to simplify a task, it&#8217;s not very helpful to publish something that won&#8217;t run for those who don&#8217;t happen to share your idea of a pleasant notification experience.</p>

<p>And you probably don&#8217;t want to maintain two versions of the same script.</p>

<h2>Interlude: Detecting Growl</h2>

<p>To support both Growl-enabled and Growl-free systems, you need to detect whether Growl is installed before deciding what to do. For that, best practice<a name="11Sep071-a"></a><sup><a href="#11Sep071-b">1</a></sup> seems to be to first check whether Growl is running:</p>

<div class="codesnip-container" ><div class="applescript codesnip" style="font-family:monospace;"><span class="kw3">tell</span> <span class="kw1">application</span> <span class="st0">&quot;System Events&quot;</span> <span class="kw3">to</span> <span class="kw3">set</span> GrowlRunning <span class="kw3">to</span> <span class="br0">&#40;</span><span class="kw1">count</span> <span class="kw3">of</span> <span class="br0">&#40;</span><span class="kw2">every</span> process <span class="kw2">where</span> creator type <span class="kw3">is</span> <span class="st0">&quot;GRRR&quot;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> &gt; <span class="nu0">0</span></div></div>

<p>Then, if Growl isn&#8217;t running, check if it&#8217;s installed, try to launch it if so<a name="11Sep072-a"></a><sup><a href="#11Sep072-b">2</a></sup>, and run the alternative notification if not:</p>

<div class="codesnip-container" ><div class="applescript codesnip" style="font-family:monospace;"><span class="kw3">if</span> <span class="kw2">not</span> GrowlRunning <span class="kw3">then</span> <span class="co1">&#8211;if Growl isn&#8217;t running&#8230;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">set</span> GrowlPath <span class="kw3">to</span> <span class="st0">&quot;&quot;</span> <span class="co1">&#8211;check to see if Growl is installed&#8230;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">try</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">tell</span> <span class="kw1">application</span> <span class="st0">&quot;Finder&quot;</span> <span class="kw3">to</span> <span class="kw3">tell</span> <span class="br0">&#40;</span><span class="kw1">application</span> <span class="kw1">file</span> <span class="kw1">id</span> <span class="st0">&quot;GRRR&quot;</span><span class="br0">&#41;</span> <span class="kw3">to</span> <span class="kw3">set</span> strGrowlPath <span class="kw3">to</span> <span class="kw1">POSIX path</span> <span class="kw3">of</span> <span class="br0">&#40;</span>its container <span class="kw2">as</span> <span class="kw1">alias</span><span class="br0">&#41;</span> <span class="sy0">&amp;</span> <span class="kw1">name</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">end</span> <span class="kw3">try</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">if</span> GrowlPath <span class="kw3">is</span> <span class="kw2">not</span> <span class="st0">&quot;&quot;</span> <span class="kw3">then</span> <span class="co1">&#8211;&#8230;try to launch if so&#8230;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">do shell script</span> <span class="st0">&quot;open &quot;</span> <span class="sy0">&amp;</span> strGrowlPath <span class="sy0">&amp;</span> <span class="st0">&quot; &gt; /dev/null 2&gt;&amp;1 &amp;&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; delay 0.5<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">set</span> GrowlRunning <span class="kw3">to</span> <span class="kw3">my</span> IsGrowlRunning<span class="br0">&#40;</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">end</span> <span class="kw3">if</span><br />
<span class="kw3">end</span> <span class="kw3">if</span><br />
<span class="kw3">if</span> GrowlRunning <span class="kw3">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; NotifyWithGrowl<span class="br0">&#40;</span>alertName, alertTitle, alertText, useSticky<span class="br0">&#41;</span><br />
<span class="kw3">else</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; NotifyWithoutGrowl<span class="br0">&#40;</span>alertText<span class="br0">&#41;</span><br />
<span class="kw3">end</span> <span class="kw3">if</span></div></div>

<h2>Method two (bad): string encapsulation</h2>

<p><strong>Pros:</strong> Used to work; doesn&#8217;t choke on Growl-free systems. <strong>Cons:</strong> No longer works with Growl.</p>

<p>For a long while I used a very simple method that encapsulated Growl statements in a string variable, which prevents the interpreter from choking on systems that don&#8217;t have Growl installed:</p>

<div class="codesnip-container" ><div class="applescript codesnip" style="font-family:monospace;"><span class="kw3">tell</span> <span class="kw1">application</span> <span class="st0">&quot;Finder&quot;</span> <span class="kw3">to</span> <span class="kw3">tell</span> <span class="br0">&#40;</span><span class="kw1">application</span> <span class="kw1">file</span> <span class="kw1">id</span> <span class="st0">&quot;GRRR&quot;</span><span class="br0">&#41;</span> <span class="kw3">to</span> <span class="kw3">set</span> growlHelperAppName <span class="kw3">to</span> <span class="kw1">name</span><br />
<br />
<span class="kw3">tell</span> <span class="kw1">application</span> growlHelperAppName <span class="kw3">to</span> <span class="kw1">run</span> <span class="kw3">script</span> <span class="st0">&quot;register as application <span class="es0">\&quot;</span>&quot;</span> <span class="sy0">&amp;</span> growlAppName <span class="sy0">&amp;</span> <span class="st0">&quot;<span class="es0">\&quot;</span> all notifications {<span class="es0">\&quot;</span>General<span class="es0">\&quot;</span>, <span class="es0">\&quot;</span>Error<span class="es0">\&quot;</span>} &nbsp;default notifications {<span class="es0">\&quot;</span>General<span class="es0">\&quot;</span>, <span class="es0">\&quot;</span>Error<span class="es0">\&quot;</span>} icon of application <span class="es0">\&quot;</span>OmniFocus.app<span class="es0">\&quot;</span>&quot;</span><br />
<span class="kw3">tell</span> <span class="kw1">application</span> growlHelperAppName <span class="kw3">to</span> <span class="kw1">run</span> <span class="kw3">script</span> <span class="st0">&quot;notify with name <span class="es0">\&quot;</span>General<span class="es0">\&quot;</span> title <span class="es0">\&quot;</span>&quot;</span> <span class="sy0">&amp;</span> alertTitle <span class="sy0">&amp;</span> <span class="st0">&quot;<span class="es0">\&quot;</span> application name <span class="es0">\&quot;</span>&quot;</span> <span class="sy0">&amp;</span> growlAppName <span class="sy0">&amp;</span> <span class="st0">&quot;<span class="es0">\&quot;</span> description <span class="es0">\&quot;</span>&quot;</span> <span class="sy0">&amp;</span> alertText <span class="sy0">&amp;</span> <span class="st0">&quot;<span class="es0">\&quot;</span> icon of application <span class="es0">\&quot;</span>OmniFocus.app<span class="es0">\&quot;</span>&quot;</span></div></div>

<p>Unfortunately this method no longer works when Growl <em>is</em> installed:</p>

<p><img style="display:block; margin-left:auto; margin-right:auto;" src="http://bylr.net/3/wp-content/uploads/2011/09/Growl-Error.png" alt="Growl Error.png" title="Growl Error.png" border="0" width="600" height="521" /></p>

<p>So that&#8217;s out.</p>

<h2>Method three (bad): growlnotify</h2>

<p><strong>Pros:</strong> Elegant, doesn&#8217;t choke on Growl-free systems. <strong>Cons:</strong> Doesn&#8217;t work unless growlnotify is installed.</p>

<p>Another method is to use the <code>growlnotify</code> utility that ships with Growl Extras, and call it via a shell script:</p>

<div class="codesnip-container" ><div class="applescript codesnip" style="font-family:monospace;"><span class="kw1">do shell script</span> <span class="st0">&quot;/usr/local/bin/growlnotify OmniFocus &nbsp;-n &#8216;General&#8217; -m &#8216;My message&#8217;&quot;</span></div></div>

<p>But <code>growlnotify</code> isn&#8217;t part of the base Growl installation, so for Growl users who don&#8217;t have the tool installed, it won&#8217;t be obvious why the notification doesn&#8217;t work.</p>

<h2>Method four (good): osaScript</h2>

<p><strong>Pros:</strong> Works for Growl users, doesn&#8217;t choke on Growl-free systems, uses standard AppleScript syntax. <strong>Cons:</strong> Verbose and unsightly.</p>

<p>The first method I found that actually works in 2011, described by <a href="http://elasticthreads.tumblr.com/post/457996450/applescript-services-and-growl-issues">elasticthreads</a>, is to encapsulate the entire Growl-facing script as its own (perfectly quoted) string, and run that using the shell tool <code>osascript</code>:</p>

<div class="codesnip-container" ><div class="applescript codesnip" style="font-family:monospace;"><span class="kw3">set</span> osascript <span class="kw3">to</span> <span class="st0">&quot;property growlAppName : <span class="es0">\&quot;</span>Dan&#8217;s Scripts<span class="es0">\&quot;</span><br />
property allNotifications : {<span class="es0">\&quot;</span>General<span class="es0">\&quot;</span>, <span class="es0">\&quot;</span>Error<span class="es0">\&quot;</span>}<br />
property enabledNotifications : {<span class="es0">\&quot;</span>General<span class="es0">\&quot;</span>, <span class="es0">\&quot;</span>Error<span class="es0">\&quot;</span>}<br />
property iconApplication : <span class="es0">\&quot;</span>OmniFocus.app<span class="es0">\&quot;</span><br />
<br />
tell application <span class="es0">\&quot;</span>GrowlHelperApp<span class="es0">\&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; register as application growlAppName all notifications allNotifications default notifications enabledNotifications icon of application iconApplication<br />
&nbsp; &nbsp; &nbsp; &nbsp; notify with name <span class="es0">\&quot;</span>General<span class="es0">\&quot;</span> title <span class="es0">\&quot;</span>Note title<span class="es0">\&quot;</span> application name growlAppName description <span class="es0">\&quot;</span>Note description<span class="es0">\&quot;</span><br />
end tell<br />
&quot;</span><br />
<span class="kw3">set</span> shellScript <span class="kw3">to</span> <span class="st0">&quot;osascript -e &quot;</span> <span class="sy0">&amp;</span> <span class="kw1">quoted form</span> <span class="kw3">of</span> osascript <span class="sy0">&amp;</span> <span class="st0">&quot; &amp;&gt; /dev/null &amp;&quot;</span><br />
<br />
<span class="kw3">ignoring</span> <span class="kw1">application</span> responses<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">do shell script</span> shellScript<br />
<span class="kw3">end</span> <span class="kw3">ignoring</span></div></div>

<p>I didn&#8217;t want to hardcode the notification parameters, and with all the quoted stringiness, extracting them required writing a method for converting an AppleScript dictionary to string form. Here&#8217;s my complete version of this method:</p>

<div class="codesnip-container" ><div class="applescript codesnip" style="font-family:monospace;"><span class="kw3">property</span> growlAppName : <span class="st0">&quot;Dan&#8217;s Scripts&quot;</span><br />
<span class="kw3">property</span> allNotifications : <span class="br0">&#123;</span><span class="st0">&quot;General&quot;</span>, <span class="st0">&quot;Error&quot;</span><span class="br0">&#125;</span><br />
<span class="kw3">property</span> enabledNotifications : <span class="br0">&#123;</span><span class="st0">&quot;General&quot;</span>, <span class="st0">&quot;Error&quot;</span><span class="br0">&#125;</span><br />
<span class="kw3">property</span> iconApplication : <span class="st0">&quot;OmniFocus.app&quot;</span><br />
<br />
<span class="kw3">set</span> thisNotificationName <span class="kw3">to</span> <span class="st0">&quot;General&quot;</span><br />
<span class="kw3">set</span> thisNotificationTitle <span class="kw3">to</span> <span class="st0">&quot;Note title&quot;</span><br />
<span class="kw3">set</span> thisNotificationDescription <span class="kw3">to</span> <span class="st0">&quot;Note description&quot;</span><br />
<span class="kw3">tell</span> <span class="kw1">application</span> <span class="st0">&quot;Finder&quot;</span> <span class="kw3">to</span> <span class="kw3">tell</span> <span class="br0">&#40;</span><span class="kw1">application</span> <span class="kw1">file</span> <span class="kw1">id</span> <span class="st0">&quot;GRRR&quot;</span><span class="br0">&#41;</span> <span class="kw3">to</span> <span class="kw3">set</span> growlHelperAppName <span class="kw3">to</span> <span class="kw1">name</span><br />
<br />
<span class="kw3">on</span> dictToString<span class="br0">&#40;</span>dict<span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">set</span> dictString <span class="kw3">to</span> <span class="st0">&quot;{&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">repeat</span> <span class="kw3">with</span> i <span class="kw3">in</span> dict<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">if</span> <span class="br0">&#40;</span>length <span class="kw3">of</span> dictString &gt; 1<span class="br0">&#41;</span> <span class="kw3">then</span> <span class="kw3">set</span> dictString <span class="kw3">to</span> dictString <span class="sy0">&amp;</span> <span class="st0">&quot;, &quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">set</span> dictString <span class="kw3">to</span> dictString <span class="sy0">&amp;</span> <span class="st0">&quot;<span class="es0">\&quot;</span>&quot;</span> <span class="sy0">&amp;</span> i <span class="sy0">&amp;</span> <span class="st0">&quot;<span class="es0">\&quot;</span>&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">end</span> <span class="kw3">repeat</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">set</span> dictString <span class="kw3">to</span> dictString <span class="sy0">&amp;</span> <span class="st0">&quot;}&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">return</span> dictString<br />
<span class="kw3">end</span> dictToString<br />
<br />
<span class="kw3">on</span> notifyWithGrowl<span class="br0">&#40;</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">set</span> osascript <span class="kw3">to</span> <span class="st0">&quot;property growlAppName : <span class="es0">\&quot;</span>&quot;</span> <span class="sy0">&amp;</span> growlAppName <span class="sy0">&amp;</span> <span class="st0">&quot;<span class="es0">\&quot;</span><br />
property allNotifications : &quot;</span> <span class="sy0">&amp;</span> dictToString<span class="br0">&#40;</span>allNotifications<span class="br0">&#41;</span> <span class="sy0">&amp;</span> <span class="st0">&quot;<br />
property enabledNotifications : &quot;</span> <span class="sy0">&amp;</span> dictToString<span class="br0">&#40;</span>enabledNotifications<span class="br0">&#41;</span> <span class="sy0">&amp;</span> <span class="st0">&quot;<br />
property iconApplication : <span class="es0">\&quot;</span>&quot;</span> <span class="sy0">&amp;</span> iconApplication <span class="sy0">&amp;</span> <span class="st0">&quot;<span class="es0">\&quot;</span><br />
<br />
tell application <span class="es0">\&quot;</span>&quot;</span> <span class="sy0">&amp;</span> growlHelperAppName <span class="sy0">&amp;</span> <span class="st0">&quot;<span class="es0">\&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; register as application growlAppName all notifications allNotifications default notifications enabledNotifications icon of application iconApplication<br />
&nbsp; &nbsp; &nbsp; &nbsp; notify with name <span class="es0">\&quot;</span>&quot;</span> <span class="sy0">&amp;</span> thisNotificationName <span class="sy0">&amp;</span> <span class="st0">&quot;<span class="es0">\&quot;</span> title <span class="es0">\&quot;</span>&quot;</span> <span class="sy0">&amp;</span> thisNotificationTitle <span class="sy0">&amp;</span> <span class="st0">&quot;<span class="es0">\&quot;</span> application name growlAppName description <span class="es0">\&quot;</span>&quot;</span> <span class="sy0">&amp;</span> thisNotificationDescription <span class="sy0">&amp;</span> <span class="st0">&quot;<span class="es0">\&quot;</span><br />
end tell<br />
&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">set</span> shellScript <span class="kw3">to</span> <span class="st0">&quot;osascript -e &quot;</span> <span class="sy0">&amp;</span> <span class="kw1">quoted form</span> <span class="kw3">of</span> osascript <span class="sy0">&amp;</span> <span class="st0">&quot; &amp;&gt; /dev/null &amp;&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">ignoring</span> <span class="kw1">application</span> responses<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">do shell script</span> shellScript<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">end</span> <span class="kw3">ignoring</span><br />
<span class="kw3">end</span> notifyWithGrowl</div></div>

<p>This method doesn&#8217;t choke on Growl-free systems, uses standard (though obscured) AppleScript syntax, and works for the Growly. It&#8217;s quite a lot of code, though, and isn&#8217;t very pretty.</p>

<h2>Method five (good): AppleScript literal syntax</h2>

<p>Finally—hats off to <a href="http://www.shirt-pocket.com/blog/index.php/shadedgrey/2006/06/11/">Dave Nanian</a> for this method—AppleScript has an obscure <a href="http://www.manyetas.com/creed/AppleScriptEventSyntax.html">literal syntax</a> that can be used instead of standard syntax. In brief, literal syntax is a way of describing statements in guillemet-enclosed <code>events</code> and <code>classes</code>. This is what the above code looks like in literal syntax…</p>

<div class="codesnip-container" ><div class="applescript codesnip" style="font-family:monospace;"><span class="kw3">property</span> growlAppName : <span class="st0">&quot;Dan&#8217;s Scripts&quot;</span><br />
<span class="kw3">property</span> allNotifications : <span class="br0">&#123;</span><span class="st0">&quot;General&quot;</span>, <span class="st0">&quot;Error&quot;</span><span class="br0">&#125;</span><br />
<span class="kw3">property</span> enabledNotifications : <span class="br0">&#123;</span><span class="st0">&quot;General&quot;</span>, <span class="st0">&quot;Error&quot;</span><span class="br0">&#125;</span><br />
<span class="kw3">property</span> iconApplication : <span class="st0">&quot;OmniFocus.app&quot;</span><br />
<br />
<span class="kw3">tell</span> <span class="kw1">application</span> <span class="st0">&quot;Finder&quot;</span> <span class="kw3">to</span> <span class="kw3">tell</span> <span class="br0">&#40;</span><span class="kw1">application</span> <span class="kw1">file</span> <span class="kw1">id</span> <span class="st0">&quot;GRRR&quot;</span><span class="br0">&#41;</span> <span class="kw3">to</span> <span class="kw3">set</span> growlHelperAppName <span class="kw3">to</span> <span class="kw1">name</span><br />
<br />
<span class="kw3">on</span> notifyWithGrowl<span class="br0">&#40;</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">tell</span> <span class="kw3">my</span> <span class="kw1">application</span> growlHelperAppName<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; «event register» <span class="kw3">given</span> «class appl»:growlAppName, «class anot»:allNotifications, «class dnot»:enabledNotifications, «class iapp»:iconApplication<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; «event notifygr» <span class="kw3">given</span> «class <span class="kw1">name</span>»:<span class="st0">&quot;General&quot;</span>, «class titl»:<span class="st0">&quot;Notes processed&quot;</span>, «class appl»:growlAppName, «class desc»:<span class="st0">&quot;strReport&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">end</span> <span class="kw3">tell</span><br />
<span class="kw3">end</span> notifyWithGrowl</div></div>

<p>N.B. While literal syntax doesn&#8217;t <em>require</em> encapsulating the app name in a string variable, you should do this for two reasons. First, if the application name is used, the interpreter will try to find GrowlHelperApp, thus choking on Growl-free systems. Also, Script Editor will try to convert the code to normal syntax, which you don&#8217;t want if you&#8217;ve gone to the trouble of crafting this version. Note also Nanian&#8217;s warning to use <code>tell my application</code>, not <code>tell application</code>.</p>

<p>This method won&#8217;t choke Growl-free systems as long as you don&#8217;t run the code; make sure you include a check to see if Growl is installed before running this code.</p>

<h2>All tedious things must come to an end</h2>

<p>Giving Apple the benefit of the doubt, I&#8217;ll make two assumptions:</p>

<ol>
<li><p>It&#8217;s generally important to have access to the scripting dictionaries of applications referenced in your script.</p></li>
<li><p>Growl is an edge case in that it&#8217;s simultaneously useful to include in a script but superfluous to the script&#8217;s execution.</p></li>
</ol>

<p>But it&#8217;s a problem that people spend so much time coming up with workarounds for such a seemingly straightforward problem. If you have any other methods for dealing with the &#8220;Growl not installed&#8221; scenario, I&#8217;d love to hear them.</p>

<p>You can download a paste-and-go version of the code (which includes both functioning methods) <a href="https://github.com/dbyler/misc-scripts/raw/master/Generic%20Growl%20Code.scpt">here</a>, or click <a href="applescript://com.apple.scripteditor?action=new&amp;script=property%20growlHelperAppName%20%3A%20%22%22%0Dproperty%20growlAppName%20%3A%20%22Dan%27s%20Scripts%22%0Dproperty%20allNotifications%20%3A%20%7B%22General%22%2C%20%22Error%22%7D%0Dproperty%20enabledNotifications%20%3A%20%7B%22General%22%2C%20%22Error%22%7D%0Dproperty%20iconApplication%20%3A%20%22OmniFocus.app%22%0D%0D%28%2A%20Begin%20notification%20code%20%2A%29%0Don%20notify%28alertName%2C%20alertTitle%2C%20alertText%29%0D%09--Call%20this%20to%20show%20a%20normal%20notification%0D%09my%20notifyMain%28alertName%2C%20alertTitle%2C%20alertText%2C%20false%29%0Dend%20notify%0D%0Don%20notifyWithSticky%28alertName%2C%20alertTitle%2C%20alertText%29%0D%09--Show%20a%20sticky%20Growl%20notification%0D%09my%20notifyMain%28alertName%2C%20alertTitle%2C%20alertText%2C%20true%29%0Dend%20notifyWithSticky%0D%0Don%20IsGrowlRunning%28%29%0D%09tell%20application%20%22System%20Events%22%20to%20set%20GrowlRunning%20to%20%28count%20of%20%28every%20process%20where%20creator%20type%20is%20%22GRRR%22%29%29%20%3E%200%0D%09return%20GrowlRunning%0Dend%20IsGrowlRunning%0D%0Don%20dictToString%28dict%29%20--needed%20to%20encapsulate%20dictionaries%20in%20osascript%0D%09set%20dictString%20to%20%22%7B%22%0D%09repeat%20with%20i%20in%20dict%0D%09%09if%20%28length%20of%20dictString%20%3E%201%29%20then%20set%20dictString%20to%20dictString%20%26%20%22%2C%20%22%0D%09%09set%20dictString%20to%20dictString%20%26%20%22%5C%22%22%20%26%20i%20%26%20%22%5C%22%22%0D%09end%20repeat%0D%09set%20dictString%20to%20dictString%20%26%20%22%7D%22%0D%09return%20dictString%0Dend%20dictToString%0D%0Don%20notifyWithGrowl%28growlHelperAppName%2C%20alertName%2C%20alertTitle%2C%20alertText%2C%20useSticky%29%0D%09tell%20my%20application%20growlHelperAppName%0D%09%09%C2%ABevent%20register%C2%BB%20given%20%C2%ABclass%20appl%C2%BB%3AgrowlAppName%2C%20%C2%ABclass%20anot%C2%BB%3AallNotifications%2C%20%C2%ABclass%20dnot%C2%BB%3AenabledNotifications%2C%20%C2%ABclass%20iapp%C2%BB%3AiconApplication%0D%09%09%C2%ABevent%20notifygr%C2%BB%20given%20%C2%ABclass%20name%C2%BB%3AalertName%2C%20%C2%ABclass%20titl%C2%BB%3AalertTitle%2C%20%C2%ABclass%20appl%C2%BB%3AgrowlAppName%2C%20%C2%ABclass%20desc%C2%BB%3AalertText%0D%09end%20tell%0Dend%20notifyWithGrowl%0D%0Don%20NotifyWithoutGrowl%28alertText%29%0D%09tell%20application%20%22OmniFocus%22%20to%20display%20dialog%20alertText%20with%20icon%201%20buttons%20%7B%22OK%22%7D%20default%20button%20%22OK%22%0Dend%20NotifyWithoutGrowl%0D%0Don%20notifyMain%28alertName%2C%20alertTitle%2C%20alertText%2C%20useSticky%29%0D%09set%20GrowlRunning%20to%20my%20IsGrowlRunning%28%29%20--check%20if%20Growl%20is%20running...%0D%09if%20not%20GrowlRunning%20then%20--if%20Growl%20isn%27t%20running...%0D%09%09set%20GrowlPath%20to%20%22%22%20--check%20to%20see%20if%20Growl%20is%20installed...%0D%09%09try%0D%09%09%09tell%20application%20%22Finder%22%20to%20tell%20%28application%20file%20id%20%22GRRR%22%29%20to%20set%20strGrowlPath%20to%20POSIX%20path%20of%20%28its%20container%20as%20alias%29%20%26%20name%0D%09%09end%20try%0D%09%09if%20GrowlPath%20is%20not%20%22%22%20then%20--...try%20to%20launch%20if%20so...%0D%09%09%09do%20shell%20script%20%22open%20%22%20%26%20strGrowlPath%20%26%20%22%20%3E%20%2Fdev%2Fnull%202%3E%261%20%26%22%0D%09%09%09delay%200.5%0D%09%09%09set%20GrowlRunning%20to%20my%20IsGrowlRunning%28%29%0D%09%09end%20if%0D%09end%20if%0D%09if%20GrowlRunning%20then%0D%09%09tell%20application%20%22Finder%22%20to%20tell%20%28application%20file%20id%20%22GRRR%22%29%20to%20set%20growlHelperAppName%20to%20name%0D%09%09notifyWithGrowl%28growlHelperAppName%2C%20alertName%2C%20alertTitle%2C%20alertText%2C%20useSticky%29%0D%09else%0D%09%09NotifyWithoutGrowl%28alertText%29%0D%09end%20if%0Dend%20notifyMain%0D%28%2A%20end%20notification%20code%20%2A%29%0D">here</a> to open it in your script editor of choice<a name="11Sep073-a"></a><sup><a href="#11Sep073-b">3</a></sup>.</p>

<p>&nbsp;
&nbsp;</p>

<hr />

<ol>
<li><p><a name="11Sep071-b"></a>Much of this is gleaned from discussion and examples posted at the OmniGroup and DEVONtechnologies forums. I think the current version is most similar to one from Rob Trew.<a href="#11Sep071-a">&#8617;</a> </p></li>
<li><p><a name="11Sep072-b"></a>In theory, you should be able to proceed without explicitly seeing if Growl is running/trying to launch if not, because calling <code>tell application "x"</code> will cause it to launch if it&#8217;s not already running. However, there was a time that Growl would crash frequently (I once measured one Growl crash every 7-8 activations), so checking for a successful launch was one way to ensure consistent behavior. Growl has gotten very stable, so this shouldn&#8217;t be a problem, but it&#8217;s cheap and fast to run the check so I keep it in.<a href="#11Sep072-a">&#8617;</a> </p></li>
<li><p><a name="11Sep073-b"></a>Hat tip to Don Southard&#8217;s handy <a href="http://www.dirtdon.com/?p=1212">AppleScript-encoding service</a>, which created the &#8220;open&#8221; link. <a href="#11Sep073-a">&#8617;</a> </p></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://bylr.net/3/2011/09/applescript-and-growl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Airfoil volume scripts</title>
		<link>http://bylr.net/3/2011/07/airfoil-volume-scripts/</link>
		<comments>http://bylr.net/3/2011/07/airfoil-volume-scripts/#comments</comments>
		<pubDate>Tue, 12 Jul 2011 22:16:20 +0000</pubDate>
		<dc:creator>Dan Byler</dc:creator>
				<category><![CDATA[applescript]]></category>
		<category><![CDATA[airfoil]]></category>
		<category><![CDATA[music]]></category>

		<guid isPermaLink="false">http://bylr.net/3/?p=291</guid>
		<description><![CDATA[Here&#8217;s a quick &#38; dirty script to change the volume of all attached Airfoil speakers. Rather than incrementing by a set amount, this uses a multiplier to keep the perceived change constant. It&#8217;s nicer on the ears, and gives you more nuanced control when the stereo is set to a higher volume. property volume_multiplier : [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a quick &amp; dirty script to change the volume of all attached <a href="http://www.rogueamoeba.com/airfoil/">Airfoil</a> speakers. Rather than incrementing by a set amount, this uses a multiplier to keep the <em>perceived</em> change constant. It&#8217;s nicer on the ears, and gives you more nuanced control when the stereo is set to a higher volume.</p>

<pre><code>property volume_multiplier : 0.8

tell application "Airfoil"
    set all_speakers to (get every speaker)
    repeat with this_speaker in all_speakers
        set curr_volume to get volume of this_speaker
        set (volume of this_speaker) to (curr_volume * volume_multiplier)
        if (volume of this_speaker) is 0 then set (volume of this_speaker) to 0.1
    end repeat
end tell
</code></pre>

<p>I keep two copies of this script (&#8220;Airfoil Volume Down&#8221; and &#8220;Airfoil Volume Up&#8221;) bound to ⇧F10 and ⇧F11, respectively, to match the volume keys on my keyboard.</p>

<p>If I ever update them, I&#8217;ll do so over on <a href="https://github.com/dbyler/misc-scripts">Github</a>.</p>

<p>Download: <a href="https://raw.github.com/dbyler/misc-scripts/master/Airfoil%20Volume%20Down.scpt">Airfoil Volume Down</a> and <a href="https://raw.github.com/dbyler/misc-scripts/master/Airfoil%20Volume%20Up.scpt">Airfoil Volume Up</a></p>
]]></content:encoded>
			<wfw:commentRss>http://bylr.net/3/2011/07/airfoil-volume-scripts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>All OmniFocus scripts updated for a &#8220;Start-based&#8221; workflow</title>
		<link>http://bylr.net/3/2011/07/all-omnifocus-scripts-updated-for-a-start-based-workflow/</link>
		<comments>http://bylr.net/3/2011/07/all-omnifocus-scripts-updated-for-a-start-based-workflow/#comments</comments>
		<pubDate>Mon, 11 Jul 2011 17:36:04 +0000</pubDate>
		<dc:creator>Dan Byler</dc:creator>
				<category><![CDATA[OmniFocus]]></category>
		<category><![CDATA[applescript]]></category>
		<category><![CDATA[productivity]]></category>

		<guid isPermaLink="false">http://bylr.net/3/?p=287</guid>
		<description><![CDATA[Like many OmniFocus users, I used to plan my days using Due dates. Planning to pick up supplies a the hardware store today? Set Due Date==Today. Need to call a friend back to catch up? Set Due Date==Today. This behavior makes sense, on one level level: just sort everything by Due date and you can [...]]]></description>
			<content:encoded><![CDATA[<p>Like many OmniFocus users, I used to plan my days using Due dates. Planning to pick up supplies a the hardware store today? Set Due Date==Today. Need to call a friend back to catch up? Set Due Date==Today. </p>

<p>This behavior makes sense, on one level level: just sort everything by Due date and you can see when things are planned. But every time a date isn&#8217;t met, it has to be pushed back, creating the need for <a href="http://bylr.net/3/2009/02/omnifocus-snooze-script/">most</a> of <a href="http://bylr.net/3/2008/02/omnifocus-defer-script/">my</a> <a href="http://bylr.net/3/2010/01/today-and-tomorrow-omnifocus-scripts/">date-related</a> <a href="http://bylr.net/3/2010/06/omnifocus-script-schedule-selected-items-for-this-weekend/">scripts</a>. </p>

<p><strong>Worse, indiscriminate use of Due dates dilutes their value and undermines any task-planning system.</strong></p>

<p>Need to pay a credit card bill today? It&#8217;s lost in the mess of other things that are artificially &#8220;due&#8221; today, and that red Due badge is no longer a respected indication that something <em>needs to happen today</em>.<a name="11Jul111-a"></a><sup><a href="#11Jul111-b">1</a></sup> </p>

<p>But there&#8217;s a better way.<a name="11Jul112-a"></a><sup><a href="#11Jul112-b">2</a></sup>  Just use Start Dates to plan what you <em>think you should do</em>, and reserve Due Dates for things that <em>actually have to get done</em>. (To keep this straight, I use a &#8220;Due&#8221; perspective to show what&#8217;s actually due, and a &#8220;Do&#8221; perspective to show what I&#8217;m planning to do.<a name="11Jul113-a"></a><sup><a href="#11Jul113-b">3</a></sup>)</p>

<p>The benefits of this approach are enormous. Things that actually need to happen don&#8217;t get lost in the shuffle, and (using <a href="http://bylr.net/3/2011/07/plan-your-day-better-with-omnifocus-time-estimates/">time estimates</a>) you can work with more realistic expectations of what can/should happen in a a day.</p>

<p>But switching to this workflow also required re-tooling my scripts, many of which focused on Due dates.</p>

<p>So, as of today, <strong>all my OmniFocus scripts default to a Start-based workflow.</strong> Here are some of the major changes:</p>

<ul>
<li><p><a href="http://bylr.net/3/2010/01/today-and-tomorrow-omnifocus-scripts/">Today</a>, <a href="http://bylr.net/3/2010/01/today-and-tomorrow-omnifocus-scripts/">Tomorrow</a>, and <a href="http://bylr.net/3/2010/06/omnifocus-script-schedule-selected-items-for-this-weekend/">This Weekend</a> all set the <em>Start date</em> of selected tasks by default.</p></li>
<li><p>In addition to pushing back due dates of tasks, <a href="http://bylr.net/3/2008/02/omnifocus-defer-script/">Defer</a> now has the option to act on un-timed tasks by pushing their start date back by the given number of days. (This option is on by default.)</p></li>
<li><p>All scripts now work when launched from the OmniFocus toolbar. </p></li>
<li><p>Scripts no longer fail when an OmniFocus grouping header is selected.</p></li>
<li><p>All scripts reorganized for performance and clarity.</p></li>
</ul>

<p>You can continue these scripts with a Due-based workflow, of course: this is a matter of changing a single setting in each script.<a name="11Jul114-a"></a><sup><a href="#11Jul114-b">4</a></sup> But if you&#8217;re successful with a Due-based workflow, you have much more discipline than me.</p>

<p>Download the lot of them <a href="https://github.com/dbyler/omnifocus-scripts/zipball/master">here</a>. (And as always, let me know if you have any problems with them.)</p>

<p>&nbsp;</p>

<p>&nbsp;</p>

<hr />

<ol>
<li><p><a name="11Jul111-b"></a>Lest anyone complain of the cost of OmniFocus: I&#8217;m sure I&#8217;ve paid more money to my credit card company in day-of-due-date payment penalties than I have to the OmniGroup. <a href="#11Jul111-a">&#8617;</a> </p></li>
<li><p><a name="11Jul112-b"></a>Thanks to David Sparks and Benjamin Brooks for the insights that led to this realization. I mentioned this in a little more detail <a href="http://bylr.net/3/2011/07/plan-your-day-better-with-omnifocus-time-estimates/">here</a>. <a href="#11Jul112-a">&#8617;</a> </p></li>
<li><p><a name="11Jul113-b"></a>Here are the settings for my Do perspective: <br /><br /><img style="display:block; margin-left:auto; margin-right:auto;" src="http://bylr.net/3/wp-content/uploads/2011/07/Do-Perspective.jpg" alt="Do Perspective.jpg" title="Do Perspective.jpg" border="0" width="529" height="408" /><br />&#8230; and here are the settings for my &#8220;Due&#8221; perspective: <br /><br /><img style="display:block; margin-left:auto; margin-right:auto;" src="http://bylr.net/3/wp-content/uploads/2011/07/Due-Perspective.jpg" alt="Due Perspective.jpg" title="Due Perspective.jpg" border="0" width="530" height="413" /><br /> Both live in my toolbar for easy access.<a href="#11Jul113-a">&#8617;</a> </p></li>
<li><p><a name="11Jul114-b"></a>For example, in the Defer script, there is a line: &#8220;property snoozeUnscheduledItems : true. Simply open the script in AppleScript Editor and change &#8220;true&#8221; to &#8220;false&#8221; to switch this setting. If you have any problems, feel free to email me. <a href="#11Jul114-a">&#8617;</a> </p></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://bylr.net/3/2011/07/all-omnifocus-scripts-updated-for-a-start-based-workflow/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>OmniFocus script: Get total time of selected items</title>
		<link>http://bylr.net/3/2011/07/omnifocus-script-get-total-time-of-selected-items/</link>
		<comments>http://bylr.net/3/2011/07/omnifocus-script-get-total-time-of-selected-items/#comments</comments>
		<pubDate>Wed, 06 Jul 2011 20:03:33 +0000</pubDate>
		<dc:creator>Dan Byler</dc:creator>
				<category><![CDATA[OmniFocus]]></category>
		<category><![CDATA[applescript]]></category>
		<category><![CDATA[productivity]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://bylr.net/3/?p=267</guid>
		<description><![CDATA[Update: If you downloaded the script before 18 July 2011, there was a bug that could cause an additional hour to be added to the time. That issue is fixed in the current version. Here&#8217;s a script to sum the total time of selected items in OmniFocus. Just select some items, fire it off and [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update: If you downloaded the script before 18 July 2011, there was a bug that could cause an additional hour to be added to the time. That issue is fixed in the current version.</strong></p>

<p><img style="display:block; margin-left:auto; margin-right:auto;" src="http://bylr.net/3/wp-content/uploads/2011/07/Total-Time.png" alt="Total Time.png" title="Total Time.png" border="0" width="300" height="61" /></p>

<p>Here&#8217;s a script to sum the total time of selected items in OmniFocus. Just select some items, fire it off and see how overcommitted you are.</p>

<p><a href="http://bylr.net/files/omnifocus/Total%20Time.zip">Download it here.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://bylr.net/3/2011/07/omnifocus-script-get-total-time-of-selected-items/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Archive messages with a single keystroke in Mail.app</title>
		<link>http://bylr.net/3/2011/03/archive-messages-with-a-single-keystroke-in-mail-app/</link>
		<comments>http://bylr.net/3/2011/03/archive-messages-with-a-single-keystroke-in-mail-app/#comments</comments>
		<pubDate>Mon, 21 Mar 2011 00:56:07 +0000</pubDate>
		<dc:creator>Dan Byler</dc:creator>
				<category><![CDATA[applescript]]></category>
		<category><![CDATA[productivity]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[mail]]></category>

		<guid isPermaLink="false">http://bylr.net/3/?p=253</guid>
		<description><![CDATA[Aug 2011 Lion update: the script works but is quite slow in Lion (it&#8217;s zippy in Snow Leopard). I&#8217;m looking for a workaround, but this appears to be a Mail.app bug. TL;DR version: Archive Mail messages with a single keystroke: Download this script and Fastscripts (free for up to 10 hotkeys) Move the script to [...]]]></description>
			<content:encoded><![CDATA[<blockquote>
  <p><em>Aug 2011 Lion update: the script works but is quite slow in Lion (it&#8217;s zippy in Snow Leopard). I&#8217;m looking for a workaround, but this appears to be a Mail.app bug.</em></p>
</blockquote>

<p><strong>TL;DR version:</strong> Archive Mail messages with a single keystroke:</p>

<ol>
<li>Download <a href="http://bylr.net/files/misc/Archive%20Selected%20Messages.scpt">this script</a> and <a href="http://www.red-sweater.com/fastscripts/">Fastscripts</a> (free for up to 10 hotkeys)</li>
<li>Move the script to ~/Library/Scripts/Applications/Mail/</li>
<li>Set your hotkey in Fastscripts (Using a letter key is possible but not recommended. Try another character like `\/=- or an F-Key.)</li>
</ol>

<p>The script will then move selected message(s) to a folder named &#8220;Archive&#8221;.</p>

<p><strong>More information:</strong></p>

<p>Existing shortcuts to file messages in Mail.app get you down to two or three keystrokes, but that just isn&#8217;t good enough for someone who has tasted the sweet, sweet bliss of single-keystroke archiving in Postbox or Gmail.</p>

<p>In my original reply to <a href="http://superuser.com/questions/179627/any-way-to-file-an-email-with-a-single-keystroke-in-mail-app">this superuser thread</a>, I suggested using an AppleScript to move selected messages to an archive, and triggering the script using a single-key shortcut using Fastscripts. That script is simple and straightforward, but it has a major shortcoming: it leaves you hanging with no next message selected, so you have to manually select your next message. Not ideal.</p>

<p>My new script archives messages with a bit more smarts. Here&#8217;s what it does:</p>

<ul>
<li><p>If a mailbox is in the foreground, the script moves selected messages to the folder named &#8220;Archive&#8221; and selects the next available message. Boom.</p></li>
<li><p>But you don&#8217;t want to accidentally archive messages whenever you hit your archive key. If the frontmost window isn&#8217;t a mailbox, the script will ignore the archiving functions and (optionally) type some text wherever you are. This is useful if you use a single key to trigger the script; without this function, you would never be able to type that key into a mail message because it&#8217;s intercepted by FastScripts before getting to the Compose window.</p></li>
</ul>

<p>For interested scripters, here were some challenges:</p>

<ul>
<li><p><strong>Select next message:</strong> The solutions I found online select the next message by sequential Message ID, which usually means that it only works if your mailbox is sorted by Date Received. Using <em>visible messages</em> gets messages in the order in which they&#8217;re displayed. Watch out, though: if message threading is turned on, the top-level thread item is not selectable. See my workaround in the script.</p></li>
<li><p><strong>Enter the keystroke that was captured:</strong> Merely telling System Events type the character that triggered the script will trigger the script again, resulting in a virtual infinite loop. I used a paste routine to work around this.</p></li>
</ul>

<p>That&#8217;s it&#8230; happy archiving!</p>

<p><em>22 Mar 2011 update: fixed bug that caused selection to be lost when only the topmost message in a mailbox is selected.</em></p>

<p><a href="http://bylr.net/files/misc/Archive%20Selected%20Messages.scpt"><img style="display:block; margin-left:auto; margin-right:auto;" src="http://bylr.net/3/wp-content/uploads/2011/03/applescripticon.gif" alt="applescripticon.gif" title="applescripticon.gif" border="0" width="60" height="49" />
<center>Download: Archive Selected Messages</center></a></p>
]]></content:encoded>
			<wfw:commentRss>http://bylr.net/3/2011/03/archive-messages-with-a-single-keystroke-in-mail-app/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>OmniFocus script: Schedule selected items for this weekend</title>
		<link>http://bylr.net/3/2010/06/omnifocus-script-schedule-selected-items-for-this-weekend/</link>
		<comments>http://bylr.net/3/2010/06/omnifocus-script-schedule-selected-items-for-this-weekend/#comments</comments>
		<pubDate>Tue, 15 Jun 2010 15:39:03 +0000</pubDate>
		<dc:creator>Dan Byler</dc:creator>
				<category><![CDATA[OmniFocus]]></category>
		<category><![CDATA[applescript]]></category>

		<guid isPermaLink="false">http://bylr.net/3/?p=184</guid>
		<description><![CDATA[Here is an AppleScript that schedules the selected OmniFocus tasks for the coming weekend. If a weekend (as defined by you) is in progress, items will be scheduled for the current weekend. In concept, the script really lets you to set start/due dates based on a relative weekly schedule. Simple modifications include: Changing your &#8220;weekend&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>Here is an AppleScript that schedules the selected OmniFocus tasks for the coming weekend. If a weekend (as defined by you) is in progress, items will be scheduled for the current weekend.</p>

<p>In concept, the script really lets you to set start/due dates based on a relative weekly schedule. Simple modifications include:</p>

<ul>
<li>Changing your &#8220;weekend&#8221; to a different day/time range is as simple as modifying the settings at the top of the script. You could easily make a copy for &#8220;this week&#8221;, &#8220;next week&#8221;, &#8220;next Friday&#8221;, &#8220;next Thursday from 4:00-6:00&#8243;, etc.</li>
<li>Un-commenting one line will bump it forward a week (think: &#8220;next weekend&#8221;).</li>
</ul>

<p><strong>Download it <a href="http://bylr.net/files/omnifocus/">here</a></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://bylr.net/3/2010/06/omnifocus-script-schedule-selected-items-for-this-weekend/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>OmniFocus script: Clear start and due dates of selected item(s)</title>
		<link>http://bylr.net/3/2010/06/omnifocus-script-clear-start-and-due-dates-of-selected-items/</link>
		<comments>http://bylr.net/3/2010/06/omnifocus-script-clear-start-and-due-dates-of-selected-items/#comments</comments>
		<pubDate>Tue, 15 Jun 2010 15:26:34 +0000</pubDate>
		<dc:creator>Dan Byler</dc:creator>
				<category><![CDATA[OmniFocus]]></category>
		<category><![CDATA[applescript]]></category>
		<category><![CDATA[productivity]]></category>

		<guid isPermaLink="false">http://bylr.net/3/?p=182</guid>
		<description><![CDATA[For OmniFocus users: here&#8217;s a script to clear the start and due dates of all selected tasks. Download it here Update: for those interested, here is a version that lets you change the context as well. I don&#8217;t personally use this version so please let me know if you have any issues with it.]]></description>
			<content:encoded><![CDATA[<p>For OmniFocus users: here&#8217;s a script to clear the start and due dates of all selected tasks.</p>

<p><strong>Download it <a href="http://bylr.net/files/omnifocus/">here</a></strong></p>

<p><em>Update: for those interested, <a href="http://bylr.net/files/omnifocus/Clear%20Dates%20alt.scpt">here</a> is a version that lets you change the context as well. I don&#8217;t personally use this version so please let me know if you have any issues with it.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://bylr.net/3/2010/06/omnifocus-script-clear-start-and-due-dates-of-selected-items/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Mail.app script: Find selected messages in Fastmail</title>
		<link>http://bylr.net/3/2010/06/find-selected-mail-messages-in-fastmail/</link>
		<comments>http://bylr.net/3/2010/06/find-selected-mail-messages-in-fastmail/#comments</comments>
		<pubDate>Wed, 09 Jun 2010 01:22:33 +0000</pubDate>
		<dc:creator>Dan Byler</dc:creator>
				<category><![CDATA[applescript]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[mail]]></category>

		<guid isPermaLink="false">http://bylr.net/3/?p=180</guid>
		<description><![CDATA[For Fastmail users who also use Mail.app, here&#8217;s a script that searches for the selected messages (in Mail.app) in the Fastmail web interface. Why would you need such a thing? One reason is that Fastmail lets users specify an infinite number of aliases which they can give to an infinite number of websites (and subsequently [...]]]></description>
			<content:encoded><![CDATA[<p>For <a href="http://fastmail.fm" title="Fastmail">Fastmail</a> users who also use Mail.app, here&#8217;s a script that searches for the selected messages (in Mail.app) in the Fastmail web interface.</p>

<p>Why would you need such a thing? One reason is that Fastmail lets users specify an infinite number of aliases which they can give to an infinite number of websites (and subsequently block, if an infinite amount of spamming ensues). Mail.app doesn&#8217;t offer a good way to change your reply address, but replying from the Fastmail web interface does the trick nicely. (Thunderbird users can use the <a href="https://addons.mozilla.org/en-US/thunderbird/addon/594">Virtual Identity plugin</a> for this as well.)</p>

<p>Here&#8217;s the script:</p>

<pre><code>--Searches for the messages selected in Mail.app using the Fastmail web interface
--By Dan Byler (http://bylr.net)

tell application "Mail"
    try
        set selected_messages to selection
        set remaining to count of selected_messages
        set the_url to "https://www.fastmail.fm/mail/?MLS=MS-*;MSS=!MB-*;SMB-CS="
        repeat with the_message in selected_messages
            set remaining to remaining - 1
            set message_id to the message id of the_message
            set the_url to the_url &amp; "msgid%3A%22" &amp; message_id &amp; "%22"
            if remaining &gt; 0 then set the_url to the_url &amp; "%20OR%20"
        end repeat
        set the_url to the_url &amp; ";SMB-SearchAll=on;MSignal=*P-1"
        open location the_url
    end try
end tell
</code></pre>

<p>Or download it <a href="http://bylr.net/files/misc/Find%20selected%20messages%20in%20Fastmail.zip">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://bylr.net/3/2010/06/find-selected-mail-messages-in-fastmail/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>NetNewsWire RSS feed-to-DEVONthink archive script updated</title>
		<link>http://bylr.net/3/2010/05/netnewswire-rss-feed-to-devonthink-archive-script-updated/</link>
		<comments>http://bylr.net/3/2010/05/netnewswire-rss-feed-to-devonthink-archive-script-updated/#comments</comments>
		<pubDate>Wed, 26 May 2010 21:55:03 +0000</pubDate>
		<dc:creator>Dan Byler</dc:creator>
				<category><![CDATA[applescript]]></category>
		<category><![CDATA[DEVONthink]]></category>
		<category><![CDATA[NetNewsWire]]></category>

		<guid isPermaLink="false">http://bylr.net/3/?p=168</guid>
		<description><![CDATA[A while ago I posted this script, which selectively archives RSS feeds/items in NetNewsWire to DEVONthink Pro Office. This long-overdue update includes two changes: adds the option to archive all items in a specific date range fixes an issue when a news item&#8217;s description is not available Grab it here.]]></description>
			<content:encoded><![CDATA[<p>A while ago I posted <a href="http://bylr.net/3/2008/06/archive-newsfeeds-in-devonthink-pro-via-netnewswire/">this script</a>, which selectively archives RSS feeds/items in NetNewsWire to DEVONthink Pro Office.</p>

<p>This long-overdue update includes two changes:</p>

<ul>
<li>adds the option to archive all items in a specific date range</li>
<li>fixes an issue when a news item&#8217;s description is not available</li>
</ul>

<p>Grab it <a href="http://bylr.net/files/devonthink/Archive%20Feed%20to%20DEVONthink%20Pro%200.2.zip">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://bylr.net/3/2010/05/netnewswire-rss-feed-to-devonthink-archive-script-updated/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Today and Tomorrow (OmniFocus scripts)</title>
		<link>http://bylr.net/3/2010/01/today-and-tomorrow-omnifocus-scripts/</link>
		<comments>http://bylr.net/3/2010/01/today-and-tomorrow-omnifocus-scripts/#comments</comments>
		<pubDate>Sat, 09 Jan 2010 05:05:20 +0000</pubDate>
		<dc:creator>Dan Byler</dc:creator>
				<category><![CDATA[OmniFocus]]></category>
		<category><![CDATA[applescript]]></category>
		<category><![CDATA[productivity]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://bylr.net/3/?p=106</guid>
		<description><![CDATA[11 July 2011: as described here, I&#8217;ve switched to a Start-based workflow and updated my scripts to reflect this change. By default, these scripts now set the start dates of selected items, not due dates—though you can still switch to &#8220;Due mode&#8221;. This post has been updated to reflect these changes. I&#8217;ve added two more [...]]]></description>
			<content:encoded><![CDATA[<p><em>11 July 2011: as described <a href="http://bylr.net/3/2011/07/all-omnifocus-scripts-updated-for-a-start-based-workflow/">here</a>, I&#8217;ve switched to a Start-based workflow and updated my scripts to reflect this change. By default, these scripts now set the <strong>start dates</strong> of selected items, not due dates—though you can still switch to &#8220;Due mode&#8221;. This post has been updated to reflect these changes.</em></p>

<p>I&#8217;ve added two more scripts to my OmniFocus repertoire: <strong>Today</strong> and <strong>Tomorrow</strong>.</p>

<p>As one might expect, Today sets the &#8220;Action Date&#8221; of selected item(s) to the current date, and Tomorrow sets the action date to the next date. (By default, the Action date is the Start date, but you can switch to use the Due date if you prefer.)</p>

<p>Why might you need this? A few days of ignoring OmniFocus is enough to make any date-sorted view overwhelming. My <a href="http://bylr.net/3/2008/02/omnifocus-defer-script/">Defer script</a> is one method to deal with these items: defer them by a day, a week, etc. But sometimes you just need to set these items to today. Or tomorrow.</p>

<p>As with Defer, these scripts work with any number of selected tasks. </p>

<p>If you use the default &#8220;Start&#8221; mode:</p>

<ul>
<li>The Start date of each selected item is set to the current day

<ul>
<li>If an item has a previously assigned Start date, its original time is maintained. Otherwise, the start time is set to 6am (configurable in the script)</li>
</ul></li>
</ul>

<p>If you use &#8220;Due&#8221; mode:</p>

<ul>
<li>The Due date of each selected item is set to the current day

<ul>
<li>If an item has a previously assigned Due date, its original due time is maintained. Otherwise, the due time is set to 5pm (configurable in the script)</li>
</ul></li>
<li>If an item has a Start date, it is moved forward by the same number of days as the due date has to move (in order to respect parameters of repeating actions)</li>
</ul>

<p><strong>Putting it all together</strong></p>

<p>I&#8217;ve set my keyboard shortcuts for Defer, Snooze, Today, Tomorrow, and This Weekend to ctrl-d, ctrl-z, ctrl-t, ctrl-y, and ctrl-w, respectively (using FastScripts), so shuffling tasks couldn&#8217;t be easier. Use cases:</p>

<p>Catching up after holiday: Select all overdue tasks, hit ctrl-t to bring them current. Then snooze or defer the ones you won&#8217;t get to today.</p>

<p>Planning today&#8217;s tasks: Select your tasks and ctrl-t them into the day&#8217;s queue. Planning tomorrow? Use ctrl-y instead.</p>

<p><strong>Download them <a href="http://bylr.net/files/omnifocus/">here</a></strong></p>

<p>&nbsp;</p>

<p>&nbsp;</p>

<hr />

<p>Thanks to Seth Landsman for his role in inspiring my Today script. <a href="http://www.landspeople.net/~seth/blog/?p=135">His version</a> is very similar but doesn&#8217;t quite match the defer logic I need.</p>

<p>Usage note: some items inherit due dates from their parent task or project, but don&#8217;t actually have due dates themselves. This script ignores those items.</p>
]]></content:encoded>
			<wfw:commentRss>http://bylr.net/3/2010/01/today-and-tomorrow-omnifocus-scripts/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>OmniFocus snooze script</title>
		<link>http://bylr.net/3/2009/02/omnifocus-snooze-script/</link>
		<comments>http://bylr.net/3/2009/02/omnifocus-snooze-script/#comments</comments>
		<pubDate>Thu, 26 Feb 2009 23:48:31 +0000</pubDate>
		<dc:creator>Dan Byler</dc:creator>
				<category><![CDATA[OmniFocus]]></category>
		<category><![CDATA[applescript]]></category>
		<category><![CDATA[productivity]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[gtd]]></category>

		<guid isPermaLink="false">http://bylr.net/3/?p=98</guid>
		<description><![CDATA[Last Updated: 2010-06-15 Here&#8217;s an AppleScript that &#8220;snoozes&#8221; selected OmniFocus items by setting their start date to a future* value. These items will then be unavailable (and out of sight in views showing &#8220;available&#8221; items) until the snoozed start date. Usage: Run the script with one or more items selected in OmniFocus Choose how long [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Last Updated: 2010-06-15</strong></p>

<p>Here&#8217;s an AppleScript that &#8220;snoozes&#8221; selected OmniFocus items by setting their start date to a future* value. These items will then be unavailable (and out of sight in views showing &#8220;available&#8221; items) until the snoozed start date.</p>

<p>Usage:</p>

<ol>
<li><p>Run the script with one or more items selected in OmniFocus</p></li>
<li><p>Choose how long you would like to snooze the items (in # of days)</p></li>
</ol>

<p>The script will then set the start date of selected items to the current date + the number of days selected in step 2. For example, snoozing with the default value of 1 day will set the tasks to begin at 12:00 AM tomorrow.</p>

<p>Finally, if you have Growl installed, the script will display a Growl confirmation.</p>

<p>I <em>highly</em> recommend initiating the script from a third-party launcher such as FastScripts or Quicksilver. This will prevent delays within the OmniFocus application due to Growl bugs.)</p>

<p>Download it <a href="http://bylr.net/files/omnifocus/">here</a>.</p>

<hr />

<p>&#42; This doesn&#8217;t have to be a future value. Choosing 0 as the snooze value will set the start date to midnight <em>today</em>; choosing -1 will set the start date to midnight yesterday.</p>
]]></content:encoded>
			<wfw:commentRss>http://bylr.net/3/2009/02/omnifocus-snooze-script/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>NetNewsWire script: Subscribe to full-text feed of current subscription</title>
		<link>http://bylr.net/3/2009/02/netnewswire-script-subscribe-to-full-text-feed-of-current-subscription/</link>
		<comments>http://bylr.net/3/2009/02/netnewswire-script-subscribe-to-full-text-feed-of-current-subscription/#comments</comments>
		<pubDate>Fri, 20 Feb 2009 18:31:59 +0000</pubDate>
		<dc:creator>Dan Byler</dc:creator>
				<category><![CDATA[applescript]]></category>
		<category><![CDATA[NetNewsWire]]></category>

		<guid isPermaLink="false">http://bylr.net/3/?p=89</guid>
		<description><![CDATA[Update Dec 2010: it looks like FullTextRSS is down. I&#8217;ll leave this up, but be forewarned: it probably won&#8217;t work. FiveFilters and WizardRSS provide similar services, so you may want to look there. Here&#8217;s a script that attempts to subscribe to a full-text feed of the current subscription in NetNewsWire. It does this using EchoDittoLabs&#8217; [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update Dec 2010: it looks like FullTextRSS is down. I&#8217;ll leave this up, but be forewarned: it probably won&#8217;t work. <a href="http://fivefilters.org/">FiveFilters</a> and <a href="http://www.wizardrss.com">WizardRSS</a> provide similar services, so you may want to look there.</strong></p>

<p>Here&#8217;s a script that attempts to subscribe to a full-text feed of the current subscription in NetNewsWire. It does this using EchoDittoLabs&#8217; excellent <a href="http://echodittolabs.org/fulltextrss">FullTextRSS</a> service. </p>

<p>To use, select a headline or subscription title in NetNewsWire and run the script. The full-text feed will appear in your top-level items.</p>

<p>Thanks to <a href="http://harvey.nu/applescript_url_encode_routine.html">harvey.nu</a> for the URL encoding routine. The script worked without the routine but it seemed safer to include it.</p>

<p>[Updated 2/22 with change suggested by Pascal.]</p>

<div class="codesnip-container" ><div class="applescript codesnip" style="font-family:monospace;"><span class="coMULTI">(* <br />
Fulltextrss.scpt v 0.1b<br />
<br />
Attempts to subscribe to the current subscription via<br />
EchoDittoLabs&#8217; FullTextRSS service (echodittolabs.org/fulltextrss)<br />
<br />
Contains no error checking; use at your own risk<br />
<br />
Dan Byler dbyler@gmail.com<br />
*)</span><br />
<br />
<span class="kw3">property</span> fulltextpre : <span class="st0">&quot;http://labs.echoditto.com/projects/fulltextrss/?url=&quot;</span><br />
<br />
<span class="kw3">tell</span> <span class="kw1">application</span> <span class="st0">&quot;NetNewsWire&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">if</span> <span class="kw1">exists</span> selectedHeadline <span class="kw3">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">set</span> this_headline <span class="kw3">to</span> selectedHeadline<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">set</span> stdfeed <span class="kw3">to</span> RSS URL <span class="kw3">of</span> subscription <span class="kw3">of</span> selectedHeadline<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">else</span> <span class="kw3">if</span> <span class="kw1">exists</span> selectedSubscription <span class="kw3">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">set</span> stdfeed <span class="kw3">to</span> RSS URL <span class="kw3">of</span> selectedSubscription<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">end</span> <span class="kw3">if</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">try</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">set</span> theTextEnc <span class="kw3">to</span> <span class="kw3">my</span> urlencode<span class="br0">&#40;</span>stdfeed<span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">set</span> fulltextfeed <span class="kw3">to</span> fulltextpre <span class="sy0">&amp;</span> theTextEnc<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">set</span> theresult <span class="kw3">to</span> subscribe <span class="kw3">to</span> fulltextfeed<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">on</span> <span class="kw3">error</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">display dialog</span> <span class="st0">&quot;Oops—something went wrong.&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">return</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">end</span> <span class="kw3">try</span><br />
<span class="kw3">end</span> <span class="kw3">tell</span><br />
<br />
<span class="co1">&#8211; urlencode routine taken from http://harvey.nu/applescript_url_encode_routine.html</span><br />
<span class="kw3">on</span> urlencode<span class="br0">&#40;</span>stdfeed<span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">set</span> theTextEnc <span class="kw3">to</span> <span class="st0">&quot;&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">repeat</span> <span class="kw3">with</span> eachChar <span class="kw3">in</span> characters <span class="kw3">of</span> stdfeed<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">set</span> useChar <span class="kw3">to</span> eachChar<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">set</span> eachCharNum <span class="kw3">to</span> ASCII <span class="kw1">number</span> <span class="kw3">of</span> eachChar<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">if</span> eachCharNum <span class="sy0">=</span> 32 <span class="kw3">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">set</span> useChar <span class="kw3">to</span> <span class="st0">&quot;+&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">else</span> <span class="kw3">if</span> <span class="br0">&#40;</span>eachCharNum ≠ 42<span class="br0">&#41;</span> <span class="kw2">and</span> <span class="br0">&#40;</span>eachCharNum ≠ 95<span class="br0">&#41;</span> <span class="kw2">and</span> <span class="br0">&#40;</span>eachCharNum <span class="sy0">&lt;</span> 45 <span class="kw2">or</span> eachCharNum &gt; 46<span class="br0">&#41;</span> <span class="kw2">and</span> <span class="br0">&#40;</span>eachCharNum <span class="sy0">&lt;</span> 48 <span class="kw2">or</span> eachCharNum &gt; 57<span class="br0">&#41;</span> <span class="kw2">and</span> <span class="br0">&#40;</span>eachCharNum <span class="sy0">&lt;</span> 65 <span class="kw2">or</span> eachCharNum &gt; 90<span class="br0">&#41;</span> <span class="kw2">and</span> <span class="br0">&#40;</span>eachCharNum <span class="sy0">&lt;</span> 97 <span class="kw2">or</span> eachCharNum &gt; 122<span class="br0">&#41;</span> <span class="kw3">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">set</span> firstDig <span class="kw3">to</span> round <span class="br0">&#40;</span>eachCharNum <span class="sy0">/</span> 16<span class="br0">&#41;</span> rounding down<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">set</span> secondDig <span class="kw3">to</span> eachCharNum <span class="kw2">mod</span> 16<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">if</span> firstDig &gt; 9 <span class="kw3">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">set</span> aNum <span class="kw3">to</span> firstDig <span class="sy0">+</span> 55<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">set</span> firstDig <span class="kw3">to</span> ASCII character aNum<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">end</span> <span class="kw3">if</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">if</span> secondDig &gt; 9 <span class="kw3">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">set</span> aNum <span class="kw3">to</span> secondDig <span class="sy0">+</span> 55<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">set</span> secondDig <span class="kw3">to</span> ASCII character aNum<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">end</span> <span class="kw3">if</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">set</span> numHex <span class="kw3">to</span> <span class="br0">&#40;</span><span class="st0">&quot;%&quot;</span> <span class="sy0">&amp;</span> <span class="br0">&#40;</span>firstDig <span class="kw2">as</span> <span class="kw1">string</span><span class="br0">&#41;</span> <span class="sy0">&amp;</span> <span class="br0">&#40;</span>secondDig <span class="kw2">as</span> <span class="kw1">string</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="kw2">as</span> <span class="kw1">string</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">set</span> useChar <span class="kw3">to</span> numHex<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">end</span> <span class="kw3">if</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">set</span> theTextEnc <span class="kw3">to</span> theTextEnc <span class="sy0">&amp;</span> useChar <span class="kw2">as</span> <span class="kw1">string</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">end</span> <span class="kw3">repeat</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">return</span> theTextEnc<br />
<span class="kw3">end</span> urlencode</div></div>

<p>Download a copy <a href="http://bylr.net/stuff/Subscribe%20to%20FullTextRSS%20feed.scpt.zip">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://bylr.net/3/2009/02/netnewswire-script-subscribe-to-full-text-feed-of-current-subscription/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>OmniFocus defer script updated</title>
		<link>http://bylr.net/3/2009/02/omnifocus-defer-script-updated/</link>
		<comments>http://bylr.net/3/2009/02/omnifocus-defer-script-updated/#comments</comments>
		<pubDate>Thu, 19 Feb 2009 22:13:34 +0000</pubDate>
		<dc:creator>Dan Byler</dc:creator>
				<category><![CDATA[OmniFocus]]></category>
		<category><![CDATA[applescript]]></category>
		<category><![CDATA[productivity]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[gtd]]></category>

		<guid isPermaLink="false">http://bylr.net/3/?p=75</guid>
		<description><![CDATA[Updated 6/15/10: minor edit to improve efficiency The updated Defer script for OmniFocus is ready. Changes include: Bug fixes to make the script more reliable, particularly when deferring multiple items. For most of these I&#8217;m indebted to Curt Clifton, who made the most critical bug fixes on the OmniFocus forum. (If you use OmniFocus, his [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Updated 6/15/10: minor edit to improve efficiency</strong></p>

<p>The updated <a href="http://bylr.net/3/2008/02/omnifocus-defer-script/">Defer script</a> for OmniFocus is ready. Changes include:</p>

<ul>
<li><p>Bug fixes to make the script more reliable, particularly when deferring multiple items.</p>

<ul>
<li>For most of these I&#8217;m indebted to Curt Clifton, who made the most critical bug fixes on the OmniFocus <a href="http://forums.omnigroup.com/showthread.php?t=7057">forum</a>. (If you use OmniFocus, his scripts and tools are invaluable; be sure visit <a href="http://www.rose-hulman.edu/~clifton/software.html">his site</a>.)</li>
</ul></li>
<li><p>The default action now defers both start and due dates.</p></li>
<li><p>Notifications code has been rewritten to make the script friendly for machines without <a href="http://growl.info/">Growl</a> installed.</p>

<ul>
<li>While testing, I discovered that GrowlHelperApp crashes on nearly 10% of notification calls. To work around this, the script now checks to see if GrowlHelperApp is running; if not, the script launches it. If Growl is not installed or can&#8217;t launch, the script displays a generic notification of the defer results.</li>
</ul></li>
</ul>

<p>If you experience delays with the script, it&#8217;s almost certainly an issue with Growl, not OmniFocus. This is much less of an issue if you launch the script via a third-party utility like <a href="http://www.red-sweater.com/fastscripts/index.html">FastScripts</a>, because any Growl-related delays will be absorbed by the script launcher, not OmniFocus. If you primarily invoke the Defer script from your OmniFocus toolbar, you can always disable alerts to speed things up. To do this, simply open the script in Script Editor and change property showAlert to false.</p>

<p><strong>Download it <a href="http://bylr.net/files/omnifocus/">here</a>.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://bylr.net/3/2009/02/omnifocus-defer-script-updated/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Archive newsfeeds in DEVONthink Pro via NetNewsWire</title>
		<link>http://bylr.net/3/2008/06/archive-newsfeeds-in-devonthink-pro-via-netnewswire/</link>
		<comments>http://bylr.net/3/2008/06/archive-newsfeeds-in-devonthink-pro-via-netnewswire/#comments</comments>
		<pubDate>Mon, 30 Jun 2008 22:47:45 +0000</pubDate>
		<dc:creator>Dan Byler</dc:creator>
				<category><![CDATA[applescript]]></category>
		<category><![CDATA[DEVONthink]]></category>
		<category><![CDATA[information management]]></category>
		<category><![CDATA[NetNewsWire]]></category>

		<guid isPermaLink="false">http://bylr.net/3/2008/06/archive-newsfeeds-in-devonthink-pro-via-netnewswire/</guid>
		<description><![CDATA[Newsfeeds provide an invaluable service: direct access to content of specific interest. NetNewsWire has long been my preferred newsreader, and the recent addition of synchronized online access makes it, for me, the clear best-in-class news client. Yet although NetNewsWire does a fine job aggregating news feeds, it&#8217;s a poor long-term information management solution. Enter DEVONthink [...]]]></description>
			<content:encoded><![CDATA[<p>Newsfeeds provide an invaluable service: direct access to content of specific interest. <a href="http://www.newsgator.com/INDIVIDUALS/NETNEWSWIRE/">NetNewsWire</a> has long been my preferred newsreader, and the recent addition of synchronized <a href="http://www.newsgator.com/Individuals/NewsGatorOnline/Default.aspx">online access</a> makes it, for me, the clear best-in-class news client. Yet although NetNewsWire does a fine job aggregating news feeds, it&#8217;s a poor long-term information management solution.</p>

<p></p><p>Enter <a href="http://www.devon-technologies.com/products/devonthink/index.html">DEVONthink Pro</a>, a <a href="http://www.macworld.com/article/48047/2005/11/devonthinkpro1.html">highly reviewed</a> <a href="http://www.macresearch.org/devonthink_pro">research tool</a>/<a href="http://www.stevenberlinjohnson.com/movabletype/archives/000230.html">information manager</a>.</p>
<p>The NetNewsWire &gt; DEVONthink bridge is a logical one, so it&#8217;s no surprise that DEVONthink Pro comes with preloaded scripts to archive information directly from NetNewsWire. (Sorry, DEVONthink Personal doesn&#8217;t include scripting support.) But the feature I really needed – the ability to archive entire RSS feeds into DEVONthink – is not included in these scripts.</p>
<p>To fill this gap, I wrote a script to archive entire newsfeeds (or subsets thereof) to DEVONthink Pro.</p>
<p>This script saves items from your selected feed (or folder of feeds) to DEVONthink Pro as web archives, with the following options:</p>
<ul>
<li>
<p>From the selected feed, folder, or smart folder, save:</p>
<ul>
<li>
<p>All items</p>
</li>
<li>
<p>Flagged items</p>
</li>
<li>
<p>Unread items</p>
</li>
<li>
<p>Read items</p>
</li>
<li>Date range (archive all items within a specified date range)</li>
</ul>
</li>
<li>
<p>Archive options:</p>
<ul>
<li>
<p><strong>Feed</strong> saves just the content of the news item (typically the best option if the site provides full-text feeds)</p>
</li>
<li>
<p><strong>Site</strong> saves the content of the item&#8217;s target website (this should be the whole article – particularly useful if the newsfeed is truncated)</p>
</li>
<li>
<p><strong>Site/Print</strong> goes to the item&#8217;s target website and looks for a link that includes the string &#8220;Print&#8221;. If one exists, it saves the print-ready page to DEVONthink. If none exists, reverts to &#8220;Site&#8221; behavior.</p>
</li>
</ul>
</li>
<li>
<p>Perform post-archive actions: mark read, unflag, or do nothing. This action occurs after DEVONthink has archived the article, so you can see archive progress in action and ensure you don&#8217;t double-archive an article</p>
</li>
<li>
<p>Optional: introduce a random time delay between archiving articles if using &#8220;Site&#8221; or &#8220;Site/Print&#8221;. (Useful if the site you&#8217;re reading from has countermeasures to prevent content scraping. Read: if they&#8217;re trying to keep you from saving their content for later use.)</p>
</li>
</ul>
<p>My personal workflows for this script:</p>
<ul>
<li>
<p>Flag items of interest from all newsfeeds. Then run this script periodically to import all flagged items into DEVONthink. <em>Archive target: Flagged items (feed); Post-archive action: Unflag.</em></p>
</li>
<li>
<p>Save full-text content of a magazine I subscribe to but don&#8217;t want to keep hard copies of. Run this script every week, when the magazine&#8217;s RSS feed is updated. <em>Archive target: unread items (Site/Print); Post-archive action: Mark as read.</em></p>
</li>
</ul>
<p>Get the script <a href="http://bylr.net/files/devonthink/Archive%20Feed%20to%20DEVONthink%20Pro%200.2.zip">here</a>.</p>
<p><strong><em>Update 2008-08-12:</em></strong><em> </em> <em>Added an additional Growl-free script to the download for users who don&#8217;t have <a href="http://growl.info/">Growl</a> installed. The only difference is that the lines referencing GrowlHelperApp are commented out. Same download link applies.</em></p>
<p><em><span style="font-style: normal;"><strong><em>Update 2010-05-26:</em></strong><em> </em> <em>Fixed a problem encountered when news items don&#8217;t have a description. Added an option to archive items from a specific date range. The download link has been updated.﻿</em></span></em></p>
]]></content:encoded>
			<wfw:commentRss>http://bylr.net/3/2008/06/archive-newsfeeds-in-devonthink-pro-via-netnewswire/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/


Served from: bylr.net @ 2012-02-04 15:53:37 -->
