<?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>Vanderbrew &#187; yojimbo</title>
	<atom:link href="http://vanderbrew.com/blog/tag/yojimbo/feed/" rel="self" type="application/rss+xml" />
	<link>http://vanderbrew.com/blog</link>
	<description>The shared bits</description>
	<lastBuildDate>Sun, 04 Apr 2010 17:04:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Add To Yojimbo with AppleScript</title>
		<link>http://vanderbrew.com/blog/2010/02/18/add-to-yojimbo-with-applescript/</link>
		<comments>http://vanderbrew.com/blog/2010/02/18/add-to-yojimbo-with-applescript/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 06:17:20 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[applescript]]></category>
		<category><![CDATA[mail]]></category>
		<category><![CDATA[netnewswire]]></category>
		<category><![CDATA[productivity]]></category>
		<category><![CDATA[safari]]></category>
		<category><![CDATA[yojimbo]]></category>

		<guid isPermaLink="false">http://vanderbrew.com/blog/?p=278</guid>
		<description><![CDATA[I&#8217;ve started using Yojimbo more as an Anything Bucket and I wanted an easy way to get stuff into it. I found several AppleScripts and they were all good, but they were for individual applications. I try to minimize how much I have to think about routine stuff &#8211; I&#8217;d much rather have code that [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve started using Yojimbo more as an <a href="http://shawnblanc.net/2009/09/yojimbo-and-anything-buckets/">Anything Bucket</a> and I wanted an easy way to get stuff into it. I found several AppleScripts and they were all good, but they were for individual applications. I try to minimize how much I have to think about routine stuff &#8211; I&#8217;d much rather have code that just &#8220;does the right thing&#8221; so I set out to meld the scripts into a single one.</p>
<p>I&#8217;m quite happy with the results. I&#8217;ve got a single shortcut setup (⌘⌥Y) in <a href="http://www.red-sweater.com/fastscripts/">FastScripts</a> and I can use it in any of the apps that I need to capture from (Mail, Safari, NetNewsWire).</p>
<p><a href="/blog/wp-content/uploads/2010/02/Add%20To%20Yojimbo.scpt.zip">Direct download link</a></p>
<div class="codecolorer-container applescript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:600px;height:300px;"><div class="applescript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #808080; font-style: italic;">(*<br />
<br />
Add To Yojimbo Script<br />
<br />
Matt Vanderpol <br />
1.0 - 2010-02-18<br />
<br />
Collects tag info and creates a new web archive or note in Yojimbo. Can cancel from tag<br />
collection screen to cancel action.<br />
<br />
Currently works from:<br />
&nbsp; NetNewsWire - creates web archive<br />
&nbsp; Mail - creates note<br />
&nbsp; Safari - creates web archive<br />
&nbsp; <br />
Notifies via growsl on success or failure.<br />
<br />
Based on work by:<br />
&nbsp; &nbsp; John Gruber (Create Yojimbo Bookmark From NetNewsWire - http://daringfireball.net/misc/2007/05/nnw-to-yojimbo-bookmark)<br />
&nbsp; &nbsp; Jom Correia (Create Yojimbo Note From Apple Mail - http://www.listsearch.com/Yojimbo/Thread/index.lasso?342#2169)<br />
&nbsp; &nbsp; Jim DeVona (Bookmark in Yojimbo - http://anoved.net/software/bookmark-in-yojimbo/)<br />
&nbsp; &nbsp; <br />
<br />
*)</span><br />
<br />
<span style="color: #ff0033; font-weight: bold;">global</span> gScript, gApplication<br />
<br />
<span style="color: #808080; font-style: italic;">-- From: http://daringfireball.net/2009/01/applescripts_targetting_safari_or_webkit</span><br />
<span style="color: #ff0033; font-weight: bold;">on</span> GetCurrentApp<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;System Events&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> _app <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">item</span> <span style="color: #000000;">1</span> <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #000000;">&#40;</span><span style="color: #ff0033;">every</span> process <span style="color: #ff0033;">whose</span> frontmost <span style="color: #ff0033; font-weight: bold;">is</span> <span style="color: #0066ff;">true</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">return</span> <span style="color: #0066ff;">name</span> <span style="color: #ff0033; font-weight: bold;">of</span> _app<br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span><br />
<span style="color: #ff0033; font-weight: bold;">end</span> GetCurrentApp<br />
<br />
<span style="color: #ff0033; font-weight: bold;">on</span> GetTags<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">-- prompt for tags</span><br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> _tags <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">&#123;</span><span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> _dlog2 <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">display dialog</span> <span style="color: #009900;">&quot;Set tags (if any) for web archive:&quot;</span> <span style="color: #0066ff;">default answer</span> ¬<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&quot;&quot;</span> default button <span style="color: #000000;">2</span> cancel button <span style="color: #000000;">1</span><br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> _action2 <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #ff0033;">the</span> button returned <span style="color: #ff0033; font-weight: bold;">of</span> _dlog2<br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">if</span> _action2 <span style="color: #000000;">=</span> <span style="color: #009900;">&quot;&quot;</span> <span style="color: #ff0033;">or</span> _action2 <span style="color: #000000;">=</span> <span style="color: #009900;">&quot;Cancel&quot;</span> <span style="color: #ff0033; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;GrowlHelperApp&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; notify <span style="color: #ff0033; font-weight: bold;">with</span> <span style="color: #0066ff;">name</span> ¬<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&quot;Failure Notification&quot;</span> title ¬<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&quot;Cancel Add&quot;</span> description <span style="color: #009900;">&quot;User cancelled adding item to Yojimbo&quot;</span> <span style="color: #0066ff;">application</span> <span style="color: #0066ff;">name</span> gScript<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">error</span> <span style="color: #0066ff;">number</span> <span style="color: #000000;">-</span><span style="color: #000000;">128</span><br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">else</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> _answer <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">text</span> returned <span style="color: #ff0033; font-weight: bold;">of</span> _dlog2<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">if</span> _answer <span style="color: #ff0033; font-weight: bold;">is</span> <span style="color: #ff0033;">not</span> <span style="color: #009900;">&quot;&quot;</span> <span style="color: #ff0033; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> AppleScript<span style="">'</span>s <span style="color: #0066ff;">text</span> <span style="color: #0066ff;">item</span> <span style="color: #0066ff;">delimiters</span> <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;, &quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> _tags <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">text</span> <span style="color: #0066ff;">items</span> <span style="color: #ff0033; font-weight: bold;">of</span> _answer<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">if</span><br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">if</span><br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">return</span> _tags<br />
<span style="color: #ff0033; font-weight: bold;">end</span> GetTags<br />
<br />
<span style="color: #ff0033; font-weight: bold;">on</span> GenerateMessageText<span style="color: #000000;">&#40;</span>m<span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;Mail&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> _sender <span style="color: #ff0033; font-weight: bold;">to</span> sender <span style="color: #ff0033; font-weight: bold;">of</span> m<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> _subject <span style="color: #ff0033; font-weight: bold;">to</span> subject <span style="color: #ff0033; font-weight: bold;">of</span> m<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> _date <span style="color: #ff0033; font-weight: bold;">to</span> date received <span style="color: #ff0033; font-weight: bold;">of</span> m <span style="color: #ff0033;">as</span> <span style="color: #0066ff;">string</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> _contents <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">content</span> <span style="color: #ff0033; font-weight: bold;">of</span> m<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> _messageString <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;From:&quot;</span> <span style="color: #000000;">&amp;</span> <span style="color: #0066ff;">tab</span> <span style="color: #000000;">&amp;</span> _sender <span style="color: #000000;">&amp;</span> <span style="color: #ff0033; font-weight: bold;">return</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> _messageString <span style="color: #ff0033; font-weight: bold;">to</span> _messageString <span style="color: #000000;">&amp;</span> <span style="color: #009900;">&quot;Subject:&quot;</span> <span style="color: #000000;">&amp;</span> <span style="color: #0066ff;">tab</span> <span style="color: #000000;">&amp;</span> _subject <span style="color: #000000;">&amp;</span> <span style="color: #ff0033; font-weight: bold;">return</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> _messageString <span style="color: #ff0033; font-weight: bold;">to</span> _messageString <span style="color: #000000;">&amp;</span> <span style="color: #009900;">&quot;Date:&quot;</span> <span style="color: #000000;">&amp;</span> <span style="color: #0066ff;">tab</span> <span style="color: #000000;">&amp;</span> _date <span style="color: #000000;">&amp;</span> <span style="color: #ff0033; font-weight: bold;">return</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> _messageString <span style="color: #ff0033; font-weight: bold;">to</span> _messageString <span style="color: #000000;">&amp;</span> <span style="color: #ff0033; font-weight: bold;">return</span> <span style="color: #000000;">&amp;</span> <span style="color: #ff0033; font-weight: bold;">return</span> <span style="color: #000000;">&amp;</span> _contents<br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span><br />
<span style="color: #ff0033; font-weight: bold;">end</span> GenerateMessageText<br />
<br />
<span style="color: #ff0033; font-weight: bold;">on</span> AddWebArchive<span style="color: #000000;">&#40;</span>h_URL, _tags, _title<span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;Yojimbo&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> _new_item <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">&#40;</span><span style="color: #0066ff;">make</span> <span style="color: #0066ff;">new</span> web archive <span style="color: #0066ff;">item</span> <span style="color: #ff0033; font-weight: bold;">with</span> <span style="color: #0066ff;">contents</span> h_URL<span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; add tags _tags <span style="color: #ff0033; font-weight: bold;">to</span> _new_item<br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;GrowlHelperApp&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; notify <span style="color: #ff0033; font-weight: bold;">with</span> <span style="color: #0066ff;">name</span> ¬<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&quot;Success Notification&quot;</span> title ¬<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&quot;Import Success&quot;</span> description <span style="color: #009900;">&quot;Successfully imported <span style="color: #000000; font-weight: bold;">\&quot;</span>&quot;</span> <span style="color: #000000;">&amp;</span> _title <span style="color: #000000;">&amp;</span> ¬<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&quot;<span style="color: #000000; font-weight: bold;">\&quot;</span> to Yojimbo&quot;</span> <span style="color: #0066ff;">application</span> <span style="color: #0066ff;">name</span> gScript<br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span><br />
<span style="color: #ff0033; font-weight: bold;">end</span> AddWebArchive<br />
<br />
<span style="color: #ff0033; font-weight: bold;">on</span> AddNote<span style="color: #000000;">&#40;</span>_contents, _name, _tags<span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">-- create the new note</span><br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;Yojimbo&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> _new_item <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">&#40;</span><span style="color: #0066ff;">make</span> <span style="color: #0066ff;">new</span> note <span style="color: #0066ff;">item</span> <span style="color: #ff0033; font-weight: bold;">with</span> <span style="color: #0066ff;">properties</span> <span style="color: #000000;">&#123;</span><span style="color: #0066ff;">contents</span>:_contents, <span style="color: #0066ff;">name</span>:_name<span style="color: #000000;">&#125;</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; add tags _tags <span style="color: #ff0033; font-weight: bold;">to</span> _new_item<br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;GrowlHelperApp&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; notify <span style="color: #ff0033; font-weight: bold;">with</span> <span style="color: #0066ff;">name</span> ¬<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&quot;Success Notification&quot;</span> title ¬<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&quot;Note Created&quot;</span> description ¬<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&quot;&quot;</span> <span style="color: #000000;">&amp;</span> _name <span style="color: #000000;">&amp;</span> <span style="color: #009900;">&quot;&quot;</span> <span style="color: #0066ff;">application</span> <span style="color: #0066ff;">name</span> gScript<br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span><br />
<span style="color: #ff0033; font-weight: bold;">end</span> AddNote<br />
<br />
<span style="color: #ff0033; font-weight: bold;">on</span> <span style="color: #0066ff;">run</span><br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> gApplication <span style="color: #ff0033; font-weight: bold;">to</span> GetCurrentApp<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> gScript <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;Add To Yojimbo Script&quot;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;GrowlHelperApp&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> <span style="color: #ff0033;">the</span> allNotificationsList <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">&#123;</span><span style="color: #009900;">&quot;Success Notification&quot;</span>, <span style="color: #009900;">&quot;Failure Notification&quot;</span><span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> <span style="color: #ff0033;">the</span> enabledNotificationsList <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">&#123;</span><span style="color: #009900;">&quot;Success Notification&quot;</span>, <span style="color: #009900;">&quot;Failure Notification&quot;</span><span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; register <span style="color: #ff0033;">as</span> <span style="color: #0066ff;">application</span> ¬<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; gScript all notifications allNotificationsList ¬<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; default notifications enabledNotificationsList ¬<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; icon <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #0066ff;">application</span> gApplication<br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">if</span> gApplication <span style="color: #ff0033; font-weight: bold;">is</span> <span style="color: #009900;">&quot;NetNewsWire&quot;</span> <span style="color: #ff0033; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> _tags <span style="color: #ff0033; font-weight: bold;">to</span> GetTags<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;NetNewsWire&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">try</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #ff0033;">index</span> <span style="color: #ff0033; font-weight: bold;">of</span> selected <span style="color: #0066ff;">tab</span> <span style="color: #ff0033; font-weight: bold;">is</span> <span style="color: #ff0033;">not</span> <span style="color: #000000;">0</span><span style="color: #000000;">&#41;</span> <span style="color: #ff0033; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> _tabNum <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #ff0033;">index</span> <span style="color: #ff0033; font-weight: bold;">of</span> selected <span style="color: #0066ff;">tab</span> <span style="color: #000000;">+</span> <span style="color: #000000;">1</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> _tabURLs <span style="color: #ff0033; font-weight: bold;">to</span> URLs <span style="color: #ff0033; font-weight: bold;">of</span> tabs<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> h_URL <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">&#40;</span><span style="color: #ff0033; font-weight: bold;">get</span> <span style="color: #0066ff;">item</span> _tabNum <span style="color: #ff0033; font-weight: bold;">of</span> _tabURLs<span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> _tabTitles <span style="color: #ff0033; font-weight: bold;">to</span> titles <span style="color: #ff0033; font-weight: bold;">of</span> tabs<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> _newItemTitle <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">&#40;</span><span style="color: #ff0033; font-weight: bold;">get</span> <span style="color: #0066ff;">item</span> _tabNum <span style="color: #ff0033; font-weight: bold;">of</span> _tabTitles<span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">my</span> AddWebArchive<span style="color: #000000;">&#40;</span>h_URL, _tags, _newItemTitle<span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">else</span> <span style="color: #ff0033; font-weight: bold;">if</span> <span style="color: #0066ff;">exists</span> selectedHeadline <span style="color: #ff0033; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> h_URL <span style="color: #ff0033; font-weight: bold;">to</span> URL <span style="color: #ff0033; font-weight: bold;">of</span> selectedHeadline<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> _newItemTitle <span style="color: #ff0033; font-weight: bold;">to</span> title <span style="color: #ff0033; font-weight: bold;">of</span> selectedHeadline<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">my</span> AddWebArchive<span style="color: #000000;">&#40;</span>h_URL, _tags, _newItemTitle<span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">else</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">error</span> <span style="color: #009900;">&quot;No headline is selected.&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">if</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">on</span> <span style="color: #ff0033; font-weight: bold;">error</span> error_message <span style="color: #0066ff;">number</span> error_number<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;GrowlHelperApp&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; notify <span style="color: #ff0033; font-weight: bold;">with</span> <span style="color: #0066ff;">name</span> ¬<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&quot;Failure Notification&quot;</span> title ¬<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&quot;Import Failure&quot;</span> description <span style="color: #009900;">&quot;Failed to import <span style="color: #000000; font-weight: bold;">\&quot;</span>&quot;</span> <span style="color: #000000;">&amp;</span> newItemTitle <span style="color: #000000;">&amp;</span> ¬<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&quot;<span style="color: #000000; font-weight: bold;">\&quot;</span> to Yojimbo. &nbsp;Error: &quot;</span> <span style="color: #000000;">&amp;</span> error_message <span style="color: #0066ff;">application</span> <span style="color: #0066ff;">name</span> gScript<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">try</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span><br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">else</span> <span style="color: #ff0033; font-weight: bold;">if</span> gApplication <span style="color: #ff0033; font-weight: bold;">is</span> <span style="color: #009900;">&quot;Mail&quot;</span> <span style="color: #ff0033; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> _tags <span style="color: #ff0033; font-weight: bold;">to</span> GetTags<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;Mail&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">tell</span> message viewer <span style="color: #000000;">1</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> _messageList <span style="color: #ff0033; font-weight: bold;">to</span> selected messages<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> _name <span style="color: #ff0033; font-weight: bold;">to</span> subject <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #0066ff;">item</span> <span style="color: #000000;">1</span> <span style="color: #ff0033; font-weight: bold;">of</span> _messageList<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> _contents <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">repeat</span> <span style="color: #ff0033; font-weight: bold;">with</span> m <span style="color: #ff0033; font-weight: bold;">in</span> _messageList<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> _contents <span style="color: #ff0033; font-weight: bold;">to</span> _contents <span style="color: #000000;">&amp;</span> <span style="color: #ff0033; font-weight: bold;">my</span> GenerateMessageText<span style="color: #000000;">&#40;</span>m<span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">repeat</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">my</span> AddNote<span style="color: #000000;">&#40;</span>_contents, _name, _tags<span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span><br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">else</span> <span style="color: #ff0033; font-weight: bold;">if</span> gApplication <span style="color: #ff0033; font-weight: bold;">is</span> <span style="color: #009900;">&quot;Safari&quot;</span> <span style="color: #ff0033; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> _tags <span style="color: #ff0033; font-weight: bold;">to</span> GetTags<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;Safari&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">-- identify the page to create web archive for, if any&nbsp; </span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">try</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> h_URL <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #ff0033;">the</span> URL <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #0066ff;">document</span> <span style="color: #000000;">1</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">set</span> _pageTitle <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #ff0033;">the</span> <span style="color: #0066ff;">name</span> <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #0066ff;">document</span> <span style="color: #000000;">1</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">on</span> <span style="color: #ff0033; font-weight: bold;">error</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">return</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">try</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">my</span> AddWebArchive<span style="color: #000000;">&#40;</span>h_URL, _tags, _pageTitle<span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span><br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">else</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;GrowlHelperApp&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; notify <span style="color: #ff0033; font-weight: bold;">with</span> <span style="color: #0066ff;">name</span> ¬<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&quot;Failure Notification&quot;</span> title ¬<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&quot;Unknown Application&quot;</span> description <span style="color: #009900;">&quot;Don't know how to add to Yojimbo from &quot;</span> <span style="color: #000000;">&amp;</span> gApplication ¬<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066ff;">application</span> <span style="color: #0066ff;">name</span> gScript<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span><br />
&nbsp; &nbsp; <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">if</span><br />
&nbsp; &nbsp; <br />
<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #0066ff;">run</span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://vanderbrew.com/blog/2010/02/18/add-to-yojimbo-with-applescript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

