<?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>Brett Terpstraosx - Brett Terpstra</title>
	<atom:link href="http://brettterpstra.com/tag/osx/feed/" rel="self" type="application/rss+xml" />
	<link>http://brettterpstra.com</link>
	<description>Elegant solutions to complex problems.</description>
	<lastBuildDate>Fri, 03 Feb 2012 03:11:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Connecting nvALT and Address Book</title>
		<link>http://brettterpstra.com/connecting-nvalt-and-address-book/</link>
		<comments>http://brettterpstra.com/connecting-nvalt-and-address-book/#comments</comments>
		<pubDate>Fri, 03 Feb 2012 03:11:46 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[applescript]]></category>
		<category><![CDATA[nvalt]]></category>
		<category><![CDATA[osx]]></category>

		<guid isPermaLink="false">http://brettterpstra.com/?p=3615</guid>
		<description><![CDATA[<p>Here’s a quick, simple AppleScript to help you hook Notational Velocity/nvALT into Address Book. I sometimes want to attach a note or list of links to an entry in my address book, but I don’t like using the notes field. I tend to keep all of my notes1 in nvALT, and I prefer not to scatter them too far. All&#8230;</p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/connecting-nvalt-and-address-book/">Connecting nvALT and Address Book</a></p>]]></description>
			<content:encoded><![CDATA[<p><img style=' float: right; padding: 4px; margin: 0 0 2px 7px;'  src="http://cdn2.brettterpstra.com/wp-content/uploads/2012/02/Johnny-Appleseed.jpg?9d7bd4" alt="" title="Johnny Appleseed" width="300" height="199" class="alignright size-full wp-image-3616 colorbox-3615" />Here’s a quick, simple AppleScript to help you hook <a href="http://notational.net/">Notational Velocity</a>/<a href="http://brettterpstra.com/project/nvalt/">nvALT</a> into Address Book. I sometimes want to attach a note or list of links to an entry in my address book, but I don’t like using the notes field. I tend to keep <em>all</em> of my notes<sup id="fnref:diff"><a href="#fn:diff" rel="footnote">1</a></sup> in nvALT, and I prefer not to scatter them too far. All I needed was a way to quickly create and link an nvALT note to each address…</p>

<p>As of recent versions, Notational Velocity and nvALT have a URL handler for nv:// (or nvalt://). Using the <code>/find/</code> parameter allows you to initiate a search in NV from a link, e.g. <code>nv://find/abnote%3AJohnny Appleseed</code>. If you use a unique prefix and full name, you can pinpoint a single note without having to create a file or locate the note’s ID. The first time you click the link, it will open a search in NV, and pressing Return will create the note and begin editing. Once the note is there, it will locate it instantly the next time you click the link.</p>

<p>I’m using the prefix “abnote:” on my notes. This AppleScript will create the URL entry automatically from the selected entries’ first and last names, and you can edit the prefix in the script to be anything you like. Just save it as “Add NV Note.scpt” in <code>~/Library/Scripts/Applications/Address Book</code> and it will show up in your script menu<sup id="fnref:menu"><a href="#fn:menu" rel="footnote">2</a></sup> when you’re in Address Book. You can run it on a bunch of entries (it’s not optimized to run on an entire large address book, though), or one at a time as you need it.</p>

<p>I wrote this on Lion. I honestly have no idea if it works on anything earlier. It might<sup id="fnref:might"><a href="#fn:might" rel="footnote">3</a></sup>.</p>

<h2>The script</h2>


<div class="wp_syntax"><div class="code"><pre class="applescript"><span class="kw3">tell</span> <span class="kw1">application</span> <span class="st0">&quot;Address Book&quot;</span>
	<span class="kw3">set</span> thePeople <span class="kw3">to</span> <span class="kw2">the</span> <span class="kw1">selection</span>
	<span class="kw3">repeat</span> <span class="kw3">with</span> thisPerson <span class="kw3">in</span> thePeople
		<span class="kw3">set</span> theName <span class="kw3">to</span> <span class="kw1">name</span> <span class="kw3">of</span> thisPerson <span class="kw2">as</span> <span class="kw1">string</span>
		<span class="kw1">make</span> <span class="kw1">new</span> url at <span class="kw3">end</span> <span class="kw3">of</span> urls <span class="kw3">of</span> thisPerson <span class="kw3">with</span> <span class="kw1">properties</span> <span class="br0">&#123;</span>label:<span class="st0">&quot;NV Note&quot;</span>, value:<span class="st0">&quot;nv://find/abnote%3A&quot;</span> <span class="sy0">&amp;</span> theName<span class="br0">&#125;</span>
	<span class="kw3">end</span> <span class="kw3">repeat</span>
	<span class="kw1">save</span>
<span class="kw3">end</span> <span class="kw3">tell</span></pre></div></div>


<div class="footnotes">
<hr />
<ol>

<li id="fn:diff">
<p>Notes, for me, are different from <a href="http://brettterpstra.com/logging-with-day-one-geek-style/">log entries</a>. I actually <em>like</em> keeping those separate most of the time. <a href="#fnref:diff" rev="footnote">↩</a></p>
</li>

<li id="fn:menu">
<p>Enabled in AppleScript Editor, Preferences-&gt;General-&gt;Show Script menu in menubar. Or better, use <a href="http://www.red-sweater.com/fastscripts/">FastScripts</a>. <a href="#fnref:menu" rev="footnote">↩</a></p>
</li>

<li id="fn:might">
<p>It might not. <a href="#fnref:might" rev="footnote">↩</a></p>
</li>

</ol>
</div>
<p>Related posts:<ol>
<li><a href='http://brettterpstra.com/address-book-search-and-skype-from-the-command-line/' rel='bookmark' title='Address Book search and Skype from the command line'>Address Book search and Skype from the command line</a></li>
<li><a href='http://brettterpstra.com/nvalt-2-1-in-the-wild/' rel='bookmark' title='nvALT 2.1 in the wild'>nvALT 2.1 in the wild</a></li>
<li><a href='http://brettterpstra.com/ios-app-review-reading-list/' rel='bookmark' title='iOS App Review: Reading List'>iOS App Review: Reading List</a></li>
</ol></p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/connecting-nvalt-and-address-book/">Connecting nvALT and Address Book</a></p>]]></content:encoded>
			<wfw:commentRss>http://brettterpstra.com/connecting-nvalt-and-address-book/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>App Review: CodeRunner</title>
		<link>http://brettterpstra.com/app-review-coderunner/</link>
		<comments>http://brettterpstra.com/app-review-coderunner/#comments</comments>
		<pubDate>Sat, 29 Oct 2011 00:16:48 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Reviews]]></category>
		<category><![CDATA[appreview]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[osx]]></category>

		<guid isPermaLink="false">http://brettterpstra.com/app-review-coderunner/</guid>
		<description><![CDATA[<p>One for the coders: I discovered CodeRunner by Nikolai Krill a few months back, and it’s proven to be very, very useful in the kind of work that I do. It allows you to test blocks of code and see the results quickly and easily. It has syntax highlighting and autocompletion, as well as the ability to handle a wide&#8230;</p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/app-review-coderunner/">App Review: CodeRunner</a></p>]]></description>
			<content:encoded><![CDATA[<p><img style=' float: right; padding: 4px; margin: 0 0 2px 7px;'  src="http://cdn2.brettterpstra.com/wp-content/uploads/2011/10/coderunnerscreenshot.jpg?9d7bd4" alt="CodeRunner Screenshot" height="279" width="300" class="alignright shadow colorbox-3024"></p>

<p>One for the coders: I discovered <a href="http://itunes.apple.com/us/app/coderunner/id433335799?mt=12">CodeRunner</a> by Nikolai Krill a few months back, and it’s proven to be very, very useful in the kind of work that I do. It allows you to test blocks of code and see the results quickly and easily. It has syntax highlighting and autocompletion, as well as the ability to handle a wide variety of languages.</p>

<p>CodeRunner handles AppleScript, C, C++, Java, JavaScript (Node.js), Objective-C, Perl, PHP, Python, Ruby and shell scripts. You can add your own languages, compilers/processors and syntaxes, too. The autocomplete libraries for each language are quite good (and very handy), and there are a good number of themes available for syntax highlighting (including my favorite, Twilight). It has auto-pairing and commands for wrapping code in a variety of paired characters, as well as a great set of code-editing tools. You can even pick between indenting with spaces or tabs and set the tab/space width, making it easy to match the code indentation to the settings of the main app you’re coding in.</p>

<p>CodeRunner can also handle code that requires input at runtime, providing a field for passing parameters and input to your functions as needed. In short, it does just about everything I could ask a code-testing application to do.</p>

<p>There are free apps for testing code, but very few that can handle multiple languages and none that I know of which can handle everything that CodeRunner does. If you code in more than one language, CodeRunner is worth every bit of its $4.99 price. <a href="http://itunes.apple.com/us/app/coderunner/id433335799?mt=12">Go get it.</a></p>

<p>Nikolai also has a regular expression testing app in the Mac App Store called <a href="http://itunes.apple.com/us/app/patterns-the-regex-app/id429449079?mt=12">Patterns</a>. I highly recommend it as well. The only issue I have with Patterns is that it doesn’t handle highlighting sub-matches, but for 90% of what I need it to do, it’s excellent.</p>
<p>Related posts:<ol>
<li><a href='http://brettterpstra.com/app-review-livereload/' rel='bookmark' title='App Review: LiveReload'>App Review: LiveReload</a></li>
<li><a href='http://brettterpstra.com/ios-app-review-reading-list/' rel='bookmark' title='iOS App Review: Reading List'>iOS App Review: Reading List</a></li>
<li><a href='http://brettterpstra.com/ios-review-listary/' rel='bookmark' title='iOS app review: Listary'>iOS app review: Listary</a></li>
</ol></p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/app-review-coderunner/">App Review: CodeRunner</a></p>]]></content:encoded>
			<wfw:commentRss>http://brettterpstra.com/app-review-coderunner/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic (Feed is rejected)
Page Caching using disk: enhanced
Database Caching 9/38 queries in 0.116 seconds using xcache
Object Caching 1102/1132 objects using xcache
Content Delivery Network via cdn2.brettterpstra.com

Served from: brettterpstra.com @ 2012-02-04 08:45:48 -->
