<?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>Noel Schutt &#187; OS X</title>
	<atom:link href="http://schutt.org/blog/tag/os-x/feed/" rel="self" type="application/rss+xml" />
	<link>http://schutt.org/blog</link>
	<description></description>
	<lastBuildDate>Tue, 22 May 2012 14:08:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>OS X&#8217;s Services menu</title>
		<link>http://schutt.org/blog/2009/11/services-menu/</link>
		<comments>http://schutt.org/blog/2009/11/services-menu/#comments</comments>
		<pubDate>Thu, 05 Nov 2009 02:12:00 +0000</pubDate>
		<dc:creator>Noel</dc:creator>
				<category><![CDATA[computers]]></category>
		<category><![CDATA[AppleScript]]></category>
		<category><![CDATA[Automator]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[OS X]]></category>
		<category><![CDATA[OS X Services]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://schutt.org/blog/?p=453</guid>
		<description><![CDATA[The Apple Services menu is a timesaving feature that has been improved in Snow Leopard. Services were occasionally useful in OS X 10.5, now with 10.6 they are a great feature. Before Snow Leopard, Services weren&#8217;t contextual. To run a service called Task, you&#8217;d click on Name of active program in the menu bar > [...]]]></description>
			<content:encoded><![CDATA[<p>The Apple <a href="http://www.apple.com/macosx/what-is-macosx/scripting.html" title="services menu">Services menu</a> is a timesaving feature that has been improved in Snow Leopard. Services were occasionally useful in OS X 10.5, now with 10.6 they are a great feature. Before Snow Leopard, Services weren&#8217;t contextual. To run a service called <em>Task</em>, you&#8217;d click on <em>Name of active program in the menu bar</em> > <em>Services</em> > <em>Name of program that does task</em> > <em>Task</em>. Because this is so many clicks, and because a lot of services that don&#8217;t apply to the current context were listed (grayed out), it was often faster to do a task manually. Snow Leopard fixes this; only the services that you can actually use show up in a list directly under Services. This makes it much easier to find the service you need. In many programs, the applicable services will show up in the right-click menu. I&#8217;m now constantly using the Services menu.</p>
<p>Since I am writing (using <a href="http://en.wikipedia.org/wiki/LaTeX">LaTeX</a>) and doing literature searches, I spend a lot of time with <a href="http://bibdesk.sourceforge.net/">BibDesk</a>, <a href="http://www.uoregon.edu/~koch/texshop/">TeXShop</a>, and a web browser. When I need to add a paper to my bibliography I can just select its BibTeX entry from an online database, then right-click (control-click) and select the <em>Add to Bibliography</em> service. Before, I&#8217;d save the BibTeX reference as a text file, open it with BibDesk, move the citation to my current bibliography file, and delete the temp file. Or if the database doesn&#8217;t include citation files, I&#8217;d manually enter it. Now I just use the <em>Add to Bibliography</em> service, saving time and typos.</p>
<p>Apple <a href="http://www.macosxautomation.com/automator/" title="Automator">Automator</a> makes Services more useful by providing an easy way to create your own. When you create an a new Automator Workflow you have the option for it to be a Service. I used this to create a Service to automatically open a new web browser tab with a <a href="http://scholar.google.com/">Google Scholar</a> search. I just select some text, right click, then select <em>Search with Google Scholar</em>, and it opens my search in Safari. This saves time copying and pasting into a new window.</p>
<p>Automator and <a href="http://www.macosxautomation.com/applescript/">AppleScript</a> don&#8217;t have all the features needed for fancier scripts, but they provide a way to call fancier scripts or other programs. My Google Scholar Service has to escape the search terms so that they can be sent in the search URL. Automator won&#8217;t do text processing directly, and there doesn&#8217;t seem to be a good way to do this in AppleScript. My solution was to write the escape script in Python. This ran slower than I thought it should, so I rewrote it in Perl, and it was faster. Much faster. I used <code>time</code> on the command line to test the speed difference. Perl averaged 2 to 5 times as fast. It looks like the difference was in how long it takes to load the necessary libraries. When first running the script, Perl was five times as fast as Python. Later runs decreased the gap to around two times. Without this optimization, this Service wouldn&#8217;t have been fast enough, but the optimized version is a time saver.</p>
<p>That&#8217;s how I use Apple Services. Here are two example services I made. To install a Service, just place a Workflow in <code>~/Library/Services/</code>. [<span class="update">Update 2010-01-07:</span> When installing your first Service you may have to open the Service in Automator and use File > Save As...  before OS X recognizes your <code>~/Library/Services/</code> folder. From then on you can just move Services to this folder to install them.]</p>
<ul>
<li><a href="http://schutt.org/files/GoogleBooks.workflow.zip">Search with Google Books Service</a> (5.0 kB)</li>
<li><a href="http://schutt.org/files/GoogleScholar.workflow.zip">Search with Google Scholar Service</a> (5.1 kB)</li>
<li><a href="http://schutt.org/files/GoogleMaps.workflow.zip">Search with Google Maps Service</a> (5.0 kB)</li>
<li><a href="http://schutt.org/files/Wikipedia.workflow.zip">Search with Wikipedia Service</a> (4.5 kB)</li>
<li><a href="http://schutt.org/files/OpenWithTextEdit.workflow.zip">Open with TextEdit Service</a> (185 kB)</li>
<li><a href="http://schutt.org/files/OpenWithMacVim.workflow.zip">Open with MacVim Service</a> (117 kB)</li>
</ul>
<p>Note: These services seem to run much faster if you relaunch Safari and Finder after copying them to <code>~/Library/Services/</code>.</p>
<p>Related: My post on <a href="http://schutt.org/blog/2009/08/osx-pdf-services/" title="Customizing Mac OS X PDF Services">Customizing Mac OS X PDF Services</a></p>
<p><span class="update">Update 2010-03-06:</span> I added <em>Search with Google Maps</em>, <em>Open with TextEdit</em>, and <em>Open with MacVim</em> services.</p>
<p><span class="update">Update 2011-10-13:</span> I added the <em>Search with Google Books</em> service.</p>
]]></content:encoded>
			<wfw:commentRss>http://schutt.org/blog/2009/11/services-menu/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Snow Leopard first impressions</title>
		<link>http://schutt.org/blog/2009/08/snow-leopard/</link>
		<comments>http://schutt.org/blog/2009/08/snow-leopard/#comments</comments>
		<pubDate>Mon, 31 Aug 2009 15:17:32 +0000</pubDate>
		<dc:creator>Noel</dc:creator>
				<category><![CDATA[computers]]></category>
		<category><![CDATA[10.6]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[byte]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[OS X]]></category>
		<category><![CDATA[remote install]]></category>
		<category><![CDATA[Snow Leopard]]></category>
		<category><![CDATA[VPN]]></category>

		<guid isPermaLink="false">http://schutt.org/blog/?p=369</guid>
		<description><![CDATA[I just upgraded to Mac OS X 10.6 Snow Leopard. Since my SuperDrive is dead, I was going to install from a second Mac booted into FireWire drive sharing mode. The install disk refuses to run in this mode. I used OS X disk sharing, but had to first run a couple commands: defaults write [...]]]></description>
			<content:encoded><![CDATA[<p>I just upgraded to Mac OS X 10.6 Snow Leopard. Since my SuperDrive is dead, I was going to install from a second Mac booted into FireWire drive sharing mode. The install disk refuses to run in this mode. I used OS X disk sharing, but had to first run a couple commands:</p>
<p><code>defaults write com.apple.NetworkBrowser EnableODiskBrowsing -bool true<br />
defaults write com.apple.NetworkBrowser ODSSupported -bool true</code></p>
<p>then restart Finder, and enable sharing on the machine I was installing to. It doesn&#8217;t make any sense that I would have to enable sharing on the MacBook being upgraded. It took longer to find these commands than it took to do the actual remote install.</p>
<p>So far, most of the reviews posted last week by major review sites seem reasonably accurate. Unfortunately, they fail to mention a major flaw in 10.6. Finder no longer displays file sizes in proper bytes and megabytes, but in the strange new format that is inexplicably gaining popularity. Instead of using the natural base-2 prefix convention, 10.6 uses base-10 prefixes. Fortunately, the command line programs still report the proper sizes. Now Finder reports my user directory is 5 GB larger than when I check using <code>du -sh ~/</code>. I have looked all over for a fix to this problem, but still haven&#8217;t found one. I need to find something like:</p>
<blockquote><p><code>defaults write GB.retard.setting.for.lusers -OFF</code><br />&#8211;comment by &ldquo;<a href="http://blog.macsales.com/1852-snow-leopard-changes-they-way-we-look-at-gigabytes-and-megabytes-and-kilobytes-as-well#comment-1226" title="a comment">Drunkus Rex</a>&rdquo;</p></blockquote>
<p>Arrg! Text edit is doing strange text replacements now&#8230; It keeps changing &lsquo;-sh&rsquo; to &lsquo;-ti&rsquo;. I already disabled some of the other replacements, but keep finding more that I don&#8217;t want. Now I have to find what is causing this one&#8230;</p>
<p>The new XCode only supports iPhone OS 3.0 or newer. This unnecessarily limits the customer base for our applications we hope to release in the next few weeks.</p>
<p>I am enjoying the built-in VPN. I finally ditched the awful Cisco VPN client. The 10.6 support for Cisco VPNs seems to work well.</p>
<p>Closing tabs after viewing video fullscreen in Safari finally works. Under 10.5, hitting cmd-W would try to close the whole window. Now it only closes the active tab.</p>
]]></content:encoded>
			<wfw:commentRss>http://schutt.org/blog/2009/08/snow-leopard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Customizing Mac OS X PDF Services</title>
		<link>http://schutt.org/blog/2009/08/osx-pdf-services/</link>
		<comments>http://schutt.org/blog/2009/08/osx-pdf-services/#comments</comments>
		<pubDate>Tue, 18 Aug 2009 22:46:06 +0000</pubDate>
		<dc:creator>Noel</dc:creator>
				<category><![CDATA[technology]]></category>
		<category><![CDATA[computers]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[OS X]]></category>

		<guid isPermaLink="false">http://schutt.org/blog/?p=360</guid>
		<description><![CDATA[One useful feature of OS X is the built in PDF handling. It is always easy to export a file as a PDF, and to do some basic editing of PDF files. A post on Mac OS X Hints today got me looking at some customizations. The hint is that creating an alias in the [...]]]></description>
			<content:encoded><![CDATA[<p>One useful feature of OS X is the built in PDF handling. It is always easy to export a file as a PDF, and to do some basic editing of PDF files. A <a href="http://www.macosxhints.com/article.php?story=20090817002247614" title="Add a Save to PDF directory to your Print options">post</a> on Mac OS X Hints today got me looking at some customizations. The hint is that creating an alias in the proper directory adds an item to the PDF menu. This can be done through Finder, or through the command line:</p>
<p><code>cd ~/Libary/PDF\ Services<br />
ln -s ~/path/ "descriptive_alias"</code></p>
<p>You may have to create the directory <code>~/Libary/PDF Services</code>. Some people recommend using the directory <code>/Libary/PDF Services</code>, but this is bad style unless you <em>really</em> want the change to be universal. Even if you are the only user on the computer, it is safer to use the <code>Library</code> folder under your user account.</p>
<p>When looking in the <code>/Libary/PDF Services</code> directory, I noticed that the contents are just Automator workflows. This means it is easy for non-programmers to customize the behavior. One option that I somehow hadn&#8217;t noticed before today is <code>Save PDF to Web Receipts Folder.pdfworkflow</code>. With online billing this is incredibly useful. I typically use the &#8220;Save PDF as&#8221; option, saving the PDF in this year&#8217;s receipts directory, with the date as a prefix. This makes receipts for monthly bills easy to find. I looked at &#8220;Save PDF to Web Receipts Folder&#8221; to see how easy it would be to alter to my preferred style. Instead of being an Automator workflow, this is actually a Python script and a few property lists. Great! Python is my favorite language. I copied the files to <code>~/Libary/PDF Services</code> and edited them. The Python script is in a file named <code>tool</code>. This script is well written, making it easy to modify. Here are the basic changes:</p>
<ul>
<li>Because I want to use timestamps, I added <code>import time</code> after the other import statements.</li>
<li>I changed the <code>destDirectory</code> to my preferred directory. The script already creates the destination directory if it doesn&#8217;t exist, so altering the directory by date is easy, I added <code>destDirectory = os.path.join(destDirectory, time.strftime("%Y"))</code> to automatically append the subdirectory for the year.</li>
<li>The file uses the title of the webpage as the filename. To add the date as a prefix, add the line <code>title = "%s-%s" % (time.strftime( "%Y%m%d"), title)</code> to the build path section. You can easily customize the date format.</li>
<li>I  prefer lowercase filenames, so I added <code>filename = filename.lower()</code> to the <code>safeFilename</code> function.</li>
<li>If a file with this name already exists, the script appends a number to the name. I prefer different character than the default, so I changed it.</li>
</ul>
<p>The final step was to I update the property list files so that the PDF menu shows the name I gave the command, instead of the original name from Apple.</p>
<p>I now have an even quicker way to save my receipts. Because the program is automatically generating the filenames using my preferences, I don&#8217;t have to change the name every time, and can avoid some typos and incorrect dates.</p>
]]></content:encoded>
			<wfw:commentRss>http://schutt.org/blog/2009/08/osx-pdf-services/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

