<?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>anoved.net &#187; pinboard</title>
	<atom:link href="http://anoved.net/tag/pinboard/feed/" rel="self" type="application/rss+xml" />
	<link>http://anoved.net</link>
	<description></description>
	<lastBuildDate>Sun, 13 May 2012 18:44:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>XML Parsing in AppleScript</title>
		<link>http://anoved.net/2010/02/xml-parsing-in-applescript/</link>
		<comments>http://anoved.net/2010/02/xml-parsing-in-applescript/#comments</comments>
		<pubDate>Sat, 20 Feb 2010 22:51:52 +0000</pubDate>
		<dc:creator>Jim</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[applescript]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[pinboard]]></category>

		<guid isPermaLink="false">http://anoved.net/?p=1613</guid>
		<description><![CDATA[I recently wrote a script that posts bookmarks from Yojimbo to Pinboard. Now that I have a nice system for posting links, I find that I&#8217;d like even more integration. For instance, I&#8217;d like to be able to keep Yojimbo in sync by downloading any links I post to Pinboard via other interfaces. The Pinboard/Delicious API [...]]]></description>
			<content:encoded><![CDATA[<p>I recently wrote a script that <a href="http://anoved.net/2010/02/safari-netnewswire-yojimbo-and-pinboard/#post-bookmark-to-yojimbo">posts bookmarks from Yojimbo to Pinboard</a>. Now that I have a nice system for posting links, I find that I&#8217;d like even more integration. For instance, I&#8217;d like to be able to keep Yojimbo in sync by downloading any links I post to Pinboard via other interfaces.</p>
<p>The Pinboard/Delicious <a href="http://delicious.com/help/api">API</a> provides a variety of methods for retrieving link information, but there isn&#8217;t a straightforward way to parse the results in AppleScript. In my posting script, I just search the response for <code>code="done"</code>. This is sufficient to tell if the <a href="http://delicious.com/help/api#posts_add">add</a> method succeeded, but methods that return more detailed information need more rigorous handling.</p>
<p>Incidentally, AppleScript supports direct interaction with <a href="http://en.wikipedia.org/wiki/SOAP">SOAP</a> or <a href="http://en.wikipedia.org/wiki/XML-RPC">XML-RPC</a> web services; <a href="http://developer.apple.com/mac/library/documentation/AppleScript/Conceptual/soapXMLRPC/chapter1/soapXMLRPC_intro.html">see the documentation here</a>. However, the Pinboard API uses a different architecture, <a href="http://en.wikipedia.org/wiki/Representational_State_Transfer#RESTful_web_services">REST</a> (<a href="http://www.peej.co.uk/articles/restfully-delicious.html">sort of</a>).</p>
<p>Essentially, a query is represented as a URL, with parameters, and the XML results are returned by the server like the content of any other web page. (I use <code>do shell script</code> and <a href="http://en.wikipedia.org/wiki/CURL">curl</a> to make the request and get the raw results; I don&#8217;t know if there is a better AppleScript idiom for general HTTP transactions. URL Access Scripting is dusty and requires writing temporary files.) The task is to extract the relevant bookmark information from the response.</p>
<p><a href="http://anoved.net/media/2010/02/systemevents.png"><img class="alignnone size-medium wp-image-1621" title="systemevents" src="http://anoved.net/media/2010/02/systemevents-300x247.png" alt="" width="300" height="247" /></a></p>
<p>As it turns out, the System Events scripting dictionary includes an XML suite, pictured above. Some experiments based on the examples given in <a href="http://macscripter.net/viewtopic.php?id=26458">this discussion at MacScripter</a> confirm that it can be used to parse data returned by the Pinboard API. So, all the pieces necessary to implement a more sophisticated AppleScript bookmark syncing system are available.</p>
]]></content:encoded>
			<wfw:commentRss>http://anoved.net/2010/02/xml-parsing-in-applescript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Safari, NetNewsWire, Yojimbo, and Pinboard</title>
		<link>http://anoved.net/2010/02/safari-netnewswire-yojimbo-and-pinboard/</link>
		<comments>http://anoved.net/2010/02/safari-netnewswire-yojimbo-and-pinboard/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 22:59:23 +0000</pubDate>
		<dc:creator>Jim</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[applescript]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[netnewswire]]></category>
		<category><![CDATA[pinboard]]></category>
		<category><![CDATA[safari]]></category>
		<category><![CDATA[yojimbo]]></category>

		<guid isPermaLink="false">http://anoved.net/?p=1576</guid>
		<description><![CDATA[Bookmark Page in Yojimbo This is a script for Safari. It&#8217;s a variation on my Bookmark in Yojimbo script. The original &#8220;Bookmark &#38; Edit&#8221; option has been replaced with &#8220;Bookmark &#38; Post to Pinboard&#8221;. I rarely want to edit a bookmark or its properties, but soon I might start sharing some links on Pinboard. Bookmark News [...]]]></description>
			<content:encoded><![CDATA[<h3><a name="bookmark-page-in-yojimbo"></a>Bookmark Page in Yojimbo</h3>
<p>This is a script for <a href="http://www.apple.com/safari/">Safari</a>. It&#8217;s a variation on my <a href="http://anoved.net/software/bookmark-in-yojimbo/">Bookmark in Yojimbo</a> script. The original &#8220;Bookmark &amp; Edit&#8221; option has been replaced with &#8220;Bookmark &amp; Post to Pinboard&#8221;. I rarely want to edit a bookmark or its properties, but soon I might start <a href="http://pinboard.in/u:anoved">sharing some links</a> on <a href="http://pinboard.in/">Pinboard</a>.</p>
<p><a href="http://anoved.net/media/2010/02/Bookmark-Page-in-Yojimbo.png"><img class="alignnone size-medium wp-image-1577" title="Bookmark Page in Yojimbo" src="http://anoved.net/media/2010/02/Bookmark-Page-in-Yojimbo-300x141.png" alt="" width="300" height="141" /></a></p>
<h3><a name="bookmark-news-in-yojimbo"></a>Bookmark News in Yojimbo</h3>
<p>This is a script for <a href="http://www.newsgator.com/INDIVIDUALS/NETNEWSWIRE/">NetNewsWire</a>, a free <a href="http://anoved.net/2008/01/introduction-to-news-feeds/">feed reader</a> for Mac OS X. It works just like the above script for Safari. It saves a bookmark to the current news item, and provides an option to spread the news by posting the bookmark to Pinboard. This is what I&#8217;m going to do instead of <a href="http://googlereader.blogspot.com/2006/03/reader-learns-to-share.html">sharing items in Google Reader</a>.</p>
<p><a href="http://anoved.net/media/2010/02/Bookmark-News-in-Yojimbo.png"><img class="alignnone size-medium wp-image-1578" title="Bookmark News in Yojimbo" src="http://anoved.net/media/2010/02/Bookmark-News-in-Yojimbo-300x141.png" alt="" width="300" height="141" /></a></p>
<h3><a name="post-bookmark-to-yojimbo"></a>Post Bookmark to Pinboard</h3>
<p>This is a script for <a href="http://barebones.com/products/yojimbo/">Yojimbo</a>, the program I use to save bookmarks and other bits of information. It posts the selected bookmark items to <a href="http://pinboard.in/">Pinboard</a>. This script is invoked [and thus required] by the &#8220;Bookmark &amp; Post to Pinboard&#8221; option in both scripts listed above.</p>
<p><a href="http://anoved.net/media/2010/02/Post-Bookmark-to-Pinboard.png"><img class="size-medium wp-image-1579 alignnone" title="Post Bookmark to Pinboard" src="http://anoved.net/media/2010/02/Post-Bookmark-to-Pinboard-300x185.png" alt="" width="300" height="185" /></a></p>
<p>Before posting a bookmark, the script prompts you to enter a description. The initial value of the description is based on the Yojimbo item comments. If you click &#8220;Post&#8221;, the bookmark will be posted with the given description but the Yojimbo item comments will not be changed; &#8220;Post &amp; Update Comments&#8221; will change the item comments to match the entered description.</p>
<p>To help you keep track of what you&#8217;ve shared, items posted to Pinboard are added to a &#8220;Pinboard&#8221; <a href="http://www.barebones.com/products/yojimbo/tour-collections.html">collection</a>, which will be created if it doesn&#8217;t already exist. As an example, here&#8217;s what my collection looks like at the moment:</p>
<p><a href="http://anoved.net/media/2010/02/Yojimbo-Pinboard-List.png"><img class="alignnone size-medium wp-image-1580" title="Yojimbo Pinboard List" src="http://anoved.net/media/2010/02/Yojimbo-Pinboard-List-300x134.png" alt="" width="300" height="134" /></a></p>
<p>And here&#8217;s how it looks on Pinboard:</p>
<p><a href="http://pinboard.in/u:anoved"><img class="alignnone size-medium wp-image-1581" title="Pinboard-list" src="http://anoved.net/media/2010/02/Pinboard-list-300x243.png" alt="" width="300" height="243" /></a></p>
<h3>Limitations</h3>
<p>These scripts don&#8217;t deal with tags, labels, stars, or other features offered by Yojimbo or Pinboard. These scripts aren&#8217;t likely to be very useful if you&#8217;re not me. I don&#8217;t know exactly what happens if you post the same bookmark to Pinboard twice; I think it&#8217;s updated automatically.</p>
<p>There are bugs.</p>
<h3>Download</h3>
<p><a href="http://anoved.net/files/Pinboard-Scripts.zip">Download all three scripts here</a> (24 KB)</p>
<h3>Configuration</h3>
<p>Some assembly is required. I recommend installing the scripts in the following locations (create the directories if they don&#8217;t already exist). <a href="http://anoved.net/2007/09/script-runners/">Run</a> them with <a href="http://www.red-sweater.com/fastscripts/">FastScripts</a> or the regular script menu.</p>
<pre>~/Library/Scripts/Applications/Safari/Bookmark Page in Yojimbo.scpt
~/Library/Scripts/Applications/NetNewsWire/Bookmark News in Yojimbo.scpt
~/Library/Scripts/Applications/Yojimbo/Post Bookmark to Pinboard.scpt</pre>
<p>Edit the <code>_pinboard_script_path</code> property at the top of both &#8220;Bookmark in Yojimbo&#8221; scripts to identify the full path to your copy of the Pinboard script. In my case, this reads:</p>
<pre>property _pinboard_script_path : "/Users/anoved/Library/Scripts/Applications/Yojimbo/Post Bookmark to Pinboard.scpt"</pre>
<p>Lastly, edit the <code>_API_username</code> and <code>_API_password</code> properties at the top of the Pinboard script to reflect your Pinboard login information. Since the Pinboard API is <a href="http://pinboard.in/blog/38/">essentially a clone</a> of the <a href="http://delicious.com/">Delicious</a> API, it should be straightforward to modify this script to work with Delicious &#8211; but unfortunately I haven&#8217;t quite got it working. Don&#8217;t hold your breath for an update, but please do share any fixes or improvements.</p>
<h3>Acknowledgements</h3>
<p>The code to post to Pinboard is derived from <a href="http://futuremacblog.blogspot.com/2008/03/improved-netnewswire-to-delicious.html">this NetNewsWire to Delicious script</a> by Larry and Andrew. My sketchy URL encoding code is lifted from <a href="http://www.macosxautomation.com/applescript/sbrt/sbrt-08.html">this example</a> at Mac OS X Automation.</p>
]]></content:encoded>
			<wfw:commentRss>http://anoved.net/2010/02/safari-netnewswire-yojimbo-and-pinboard/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

