<?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>Art Of Geek &#187; Automator</title>
	<atom:link href="http://artofgeek.com/tag/automator/feed/" rel="self" type="application/rss+xml" />
	<link>http://artofgeek.com</link>
	<description>Technology from the geek perspective.</description>
	<lastBuildDate>Thu, 18 Mar 2010 18:48:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
		<item>
		<title>Toggle display of hidden files in Finder with keyboard shortcut [Update 2]</title>
		<link>http://artofgeek.com/2009/09/16/toggle-display-of-hidden-files-in-finder-with-keyboard-shortcut/</link>
		<comments>http://artofgeek.com/2009/09/16/toggle-display-of-hidden-files-in-finder-with-keyboard-shortcut/#comments</comments>
		<pubDate>Thu, 17 Sep 2009 00:23:43 +0000</pubDate>
		<dc:creator>madgunde</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Automator]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[bsd]]></category>
		<category><![CDATA[Finder]]></category>
		<category><![CDATA[hint]]></category>
		<category><![CDATA[keyboard shortcut]]></category>
		<category><![CDATA[Services]]></category>
		<category><![CDATA[Snow Leopard]]></category>
		<category><![CDATA[Terminal]]></category>
		<category><![CDATA[tip]]></category>

		<guid isPermaLink="false">http://artofgeek.com/?p=460</guid>
		<description><![CDATA[<p>[Update 2] Still in early Mac OS X 10.6 Snow Leopard discovery mode, I&#8217;ve started revisiting MacOSXHints.com much more regularly to find out what handy undocumented or at least not widely known tricks the new OS has up it&#8217;s sleeve. Today I came across this fantastic tip about how you can toggle the display of [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-medium wp-image-483" title="Toggle Hidden Files" src="http://artofgeek.com/wp-content/uploads/2009/09/Toggle-Hidden-Files-300x141.png" alt="Toggle Hidden Files" width="300" height="141" /><a href="http://artofgeek.com/2009/09/16/toggle-display-of-hidden-files-in-finder-with-keyboard-shortcut/#update_2">[Update 2]</a> Still in early Mac OS X 10.6 Snow Leopard discovery mode, I&#8217;ve started revisiting <a href="http://www.macosxhints.com/">MacOSXHints.com</a> much more regularly to find out what handy undocumented or at least not widely known tricks the new OS has up it&#8217;s sleeve. Today I came across <a href="http://www.macosxhints.com/article.php?story=20090915152215383">this fantastic tip</a> about how you can toggle the display of hidden files in any standard open/save dialog box just by hitting &#8220;Shift+Command+. (period)&#8221;. My first reaction of course was, &#8220;wow, what a great idea!&#8221;, followed quickly by, &#8220;about freaking time!&#8221; and ultimately, &#8220;wtf?, why didn&#8217;t they implement this in the Finder?!?&#8221;.</p>
<p>Well as the old saying goes, give a man a fish and he can feed himself for a day, teach a man to fish and he can get rich selling fish to other suckers (or something of the sort). So it is that Apple has given us the tools in Snow Leopard to fend for ourselves.<span id="more-460"></span> Once again, Automator, Services, a custom keyboard shortcut and the good old bash Terminal are all we need to get the job done. Read on for the step by step instructions on how to make &#8220;Shift+Command+. (period)&#8221; toggle the display of hidden files in Finder.</p>
<div id="attachment_439" class="wp-caption alignright" style="width: 310px"><a href="http://artofgeek.com/wp-content/uploads/2009/09/Automator-Service-Selection.png" target="_blank"><img class="size-medium wp-image-439 " title="Automator Service Selection" src="http://artofgeek.com/wp-content/uploads/2009/09/Automator-Service-Selection-300x278.png" alt="Choosing a template for your Automator workflow (click to enlarge)" width="300" height="278" /></a><p class="wp-caption-text">Choosing a template for your Automator workflow</p></div>
<ol>
<li>Open Automator (in your Applications folder) and choose Service from the list of templates provided and click the Choose button.</li>
<li>In the left hand column under Library, select Utilities.</li>
<li>In the second column, drag &#8220;Run Shell Script&#8221; to the right hand pane.</li>
<li>At the top of the right hand pane where you dragged the Run Shell Script action, click on the right-hand popup menu and change &#8220;any application&#8221; to &#8220;Finder&#8221;. This sets the service so it only appears and can be activated by the keyboard shortcut when Finder is the active application.</li>
<li>Then click on the popup menu next to &#8220;Service receives&#8221; and choose &#8220;no input&#8221;. It&#8217;s important you do this step after step 4 because if you do the reverse, Finder won&#8217;t be available as an option in the right hand menu.</li>
<li>Copy and paste the following text into the empty text area of the Run Shell Script action:</li>
<blockquote><p><code><span style="color: #0000ff;">osascript -e 'tell application "Finder" to quit'<br />
SHOWHIDDEN=`defaults read com.apple.finder AppleShowAllFiles`<br />
if [ $SHOWHIDDEN -eq 1 ]; then<br />
defaults write com.apple.finder AppleShowAllFiles -bool FALSE<br />
else<br />
defaults write com.apple.finder AppleShowAllFiles -bool TRUE<br />
fi<br />
osascript -e 'tell application "Finder" to activate'<br />
</span></code></p></blockquote>
<div id="attachment_504" class="wp-caption alignright" style="width: 310px"><a href="http://artofgeek.com/wp-content/uploads/2009/09/Toggle-Hidden-Files-Automator-Action.png" target="_blank"><img class="size-medium wp-image-504 " title="Toggle Hidden Files Automator Action" src="http://artofgeek.com/wp-content/uploads/2009/09/Toggle-Hidden-Files-Automator-Action-300x230.png" alt="Completed Automator action, ready to save (click to enlarge)" width="300" height="230" /></a><p class="wp-caption-text">Completed Automator action, ready to save (click to enlarge)</p></div>
<li>Choose File&#8211;&gt;Save, and give the new service a meaningful name like &#8220;Toggle Hidden Files&#8221; that will appear in the Services menu. Once you&#8217;ve done that, you can go to the Services menu (located in the current application menu, next to the Apple menu) and your newly created service should appear there. You can even run it, it&#8217;s already fuctional, just lacking a keyboard shortcut.</li>
<li>Open System Preferences&#8211;&gt;Keyboard&#8211;&gt;Keyboard Shortcuts and select Services in the left column.</li>
<div id="attachment_467" class="wp-caption alignright" style="width: 310px"><a href="http://artofgeek.com/wp-content/uploads/2009/09/Toggle-Hidden-Files-Keyboard-Shortcut.png" target="_blank"><img class="size-medium wp-image-467 " title="Toggle Hidden Files Keyboard Shortcut" src="http://artofgeek.com/wp-content/uploads/2009/09/Toggle-Hidden-Files-Keyboard-Shortcut-300x271.png" alt="Setting the keyboard shortcut (click to enlarge)" width="300" height="271" /></a><p class="wp-caption-text">Setting the keyboard shortcut (click to enlarge)</p></div>
<li>Scroll down to the bottom and under the General category, you should see your newly created service listed there. Select it, then Double-click close to the right side of the selected line to reveal a field where you can enter a custom keyboard shortcut. Enter &#8220;Shift+Command+.&#8221; (might as well keep it consistent with the shortcut used in open/save dialog boxes), and then quit System Preferences.</li>
</ol>
<p>That&#8217;s all there is to it. The really nice thing is built-in keyboard shortcuts override custom ones, so pressing  &#8220;Shift+Command+. (period)&#8221; in an open/save dialog will not execute this service.<br />
<div id="attachment_515" class="wp-caption alignright" style="width: 310px"><a href="http://artofgeek.com/wp-content/uploads/2009/09/Finder-Busy-Error.png"><img src="http://artofgeek.com/wp-content/uploads/2009/09/Finder-Busy-Error-300x143.png" alt="Finder Busy Error (click to enlarge)" title="Finder Busy Error" width="300" height="143" class="size-medium wp-image-515" /></a><p class="wp-caption-text">Finder Busy Error (click to enlarge)</p></div><br />
<div id="attachment_516" class="wp-caption alignright" style="width: 310px"><a href="http://artofgeek.com/wp-content/uploads/2009/09/Service-Execution-Error.png"><img src="http://artofgeek.com/wp-content/uploads/2009/09/Service-Execution-Error-300x139.png" alt="Service Execution Error (click to enlarge)" title="Service Execution Error" width="300" height="139" class="size-medium wp-image-516" /></a><p class="wp-caption-text">Service Execution Error (click to enlarge)</p></div>The way the script works is to toggle the state of a hidden Finder preference and restart the Finder so the changes take effect. So you will see Finder disappear momentarily when executing this service.</p>
<p>Since the Finder will be restarted cleanly (using an AppleScript call to request it to quit), any tasks it is currently executing such as  a copy operation, emptying the trash, etc. will prevent Finder from quitting and pop up the two error messages displayed on the right, without any modification to Finder&#8217;s preference plist file. If this happens, simply click &#8220;OK&#8221; to clear the two messages, wait for the Finder operation to complete (or cancel it) and try again.</p>
<p>I&#8217;ll reiterate how dumb it is that we have to implement this ourselves, but this oversight seems completely insignificant when we consider that instead of implementing a single keyboard shortcut that less than 1% of users will ever use, Apple have given all users a powerful and easy to use set of tools to add a keyboard shortcut for almost anything they could ever want to accomplish with one. Now go fish! <img src='http://artofgeek.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><a name="update_1"></a></p>
<hr /><a name="update_1"></a><strong><em>Update 1 &#8211; 9/17/2009, 11:20 pm:</em></strong> I&#8217;ve made a slight modification to the instructions, adding step 4 which makes the service (and keyboard shortcut) only active when Finder is the frontmost app. This greatly reduces the chances that the keyboard shortcut will interfere with one already assigned to an application, but also keeps the Services menu less cluttered when not in Finder. This also makes it impossible to accidentally activate the service unintentionally unless Finder is the active app. Seeing as you&#8217;d only really want/need to use this trick while using Finder, this made the most sense, but of course you&#8217;re welcome to leave this step out if you think you might want to toggle this while running any app.</p>
<p>I also added two extra lines at the end of the shells script to improve usabiliy. Previously, after the action was executed, Finder would in most cases not end up being the frontmost application anymore since upon quitting Finder, the next application that is running would now become frontmost. The added two lines simply add a quarter second pause so Finder has a chance to relaunch before running the open command which brings Finder back to the front if it isn&#8217;t already.</p>
<p><a name="update_2"></a></p>
<hr /><a name="update_2"></a><strong><em>Update 2 &#8211; 10/2/2009, 11:57 am:</em></strong> Special thanks to commenter &#8220;GlowingApple&#8221; for a suggested improvement to use the osascript command to politely quit the Finder rather than the killall command. The benefit is now Finder will throw up an error if it&#8217;s in the middle of doing something rather than simply imploding taking your copy or empty trash command with it. <img src='http://artofgeek.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>I also changed the execution order a little bit so that the Finder is quit first before the plist modification takes place. That way if the Finder can&#8217;t be quit because it&#8217;s busy, no change will take place. This will prevent the state of hidden file display from unexpectedly changing between reboots or logouts if you unsuccessfully executed the service and Finder couldn&#8217;t be quit. </p>
]]></content:encoded>
			<wfw:commentRss>http://artofgeek.com/2009/09/16/toggle-display-of-hidden-files-in-finder-with-keyboard-shortcut/feed/</wfw:commentRss>
		<slash:comments>66</slash:comments>
		</item>
		<item>
		<title>Lock your Mac&#8217;s screen like in Windows, Snow Leopard edition</title>
		<link>http://artofgeek.com/2009/09/08/lock-your-macs-screen-like-in-windows-snow-leopard-edition/</link>
		<comments>http://artofgeek.com/2009/09/08/lock-your-macs-screen-like-in-windows-snow-leopard-edition/#comments</comments>
		<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate>
		<dc:creator>madgunde</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Automator]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[bsd]]></category>
		<category><![CDATA[hint]]></category>
		<category><![CDATA[keyboard shortcut]]></category>
		<category><![CDATA[login window]]></category>
		<category><![CDATA[Services]]></category>
		<category><![CDATA[Snow Leopard]]></category>
		<category><![CDATA[Terminal]]></category>
		<category><![CDATA[tip]]></category>

		<guid isPermaLink="false">http://artofgeek.com/?p=438</guid>
		<description><![CDATA[<p>Wow. Didn&#8217;t take long for Snow Leopard to render my previous hint on how to lock your Mac&#8217;s screen utterly obsolete.</p>
<p>This is one of the things I love most about Mac OS X: Apple just keeps adding features that often eliminate the need for third party solutions to simple problems. In this particular case, we&#8217;re [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-446" title="Snow-Leopard-and-Friends" src="http://artofgeek.com/wp-content/uploads/2009/09/Snow-Leopard-and-Friends.png" alt="Snow-Leopard-and-Friends" width="300" height="233" />Wow. Didn&#8217;t take long for Snow Leopard to render <a href="http://artofgeek.com/2009/06/23/lock-your-macs-screen-like-in-windows/">my previous hint</a> on how to lock your Mac&#8217;s screen utterly obsolete.</p>
<p>This is one of the things I love most about Mac OS X: Apple just keeps adding features that often eliminate the need for third party solutions to simple problems. In this particular case, we&#8217;re going to use a combination of Automator, a terminal command, Snow Leopard&#8217;s new improved Services and a system-wide keyboard shortcut to enable a hotkey that will suspend the currently logged in user session and display the Login Window as though you had chosen the &#8220;Login Window…&#8221; option from the Fast User Switching menu extra.<span id="more-438"></span></p>
<p>I know, enough with the chatter, get on with the tutorial!  Just follow these steps and you&#8217;ll be locking your Mac running Mac OS X 10.6 Snow Leopard like it&#8217;s running Windows XP! Wait, did I just write that? <em>Shudder.</em> Sorry, I think I just threw up a little bit in my mouth. Here&#8217;s the tutorial:</p>
<div id="attachment_439" class="wp-caption alignright" style="width: 310px"><a href="http://artofgeek.com/wp-content/uploads/2009/09/Automator-Service-Selection.png" target="_blank"><img class="size-medium wp-image-439 " title="Automator Service Selection" src="http://artofgeek.com/wp-content/uploads/2009/09/Automator-Service-Selection-300x278.png" alt="Choosing a template for your Automator workflow (click to enlarge)" width="300" height="278" /></a><p class="wp-caption-text">Choosing a template for your Automator workflow</p></div>
<ol>
<li>Open Automator (in your Applications folder) and choose Service from the list of templates provided and click the Choose button.</li>
<li>In the left hand column under Library, select Utilities.</li>
<li>In the second column, drag &#8220;Run Shell Script&#8221; to the right hand pane.</li>
<li>At the top of the right hand pane where you dragged the Run Shell Script action, click on the menu next to &#8220;Service receives&#8221; and choose &#8220;no input&#8221;.</li>
<li>Copy and paste the following Terminal command into the empty text area of the Run Shell Script action:<br />
<blockquote><p><code><span style="color: #0000ff;">/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend</span></code></p></blockquote>
<p>The entire command should be entered on a single line and note there is a space after &#8220;/Menu\&#8221;.</li>
<div id="attachment_441" class="wp-caption alignright" style="width: 310px"><a href="http://artofgeek.com/wp-content/uploads/2009/09/Automator-Action.png" target="_blank"><img class="size-medium wp-image-441 " title="Automator Action" src="http://artofgeek.com/wp-content/uploads/2009/09/Automator-Action-300x199.png" alt="Completed Automator action, ready to save (click to enlarge)" width="300" height="199" /></a><p class="wp-caption-text">Completed Automator action, ready to save (click to enlarge)</p></div>
<li>Choose File&#8211;&gt;Save, and give the new service a meaningful name like &#8220;Lock Computer&#8221; that will appear in the Services menu. Once you&#8217;ve done that, you can go to the Services menu (located in the current application menu, next to the Apple menu) and your newly created service should appear there.</li>
<li>Next open System Preferences &#8211;&gt; Keyboard &#8211;&gt; Keyboard Shortcuts and select Services in the left column.</li>
<div id="attachment_443" class="wp-caption alignright" style="width: 310px"><a href="http://artofgeek.com/wp-content/uploads/2009/09/Setting-the-keyboard-shortcut.png" target="_blank"><img class="size-medium wp-image-443 " title="Setting the keyboard shortcut" src="http://artofgeek.com/wp-content/uploads/2009/09/Setting-the-keyboard-shortcut-300x271.png" alt="Setting the keyboard shortcut (click to enlarge)" width="300" height="271" /></a><p class="wp-caption-text">Setting the keyboard shortcut (click to enlarge)</p></div>
<li>Scroll down to the bottom and under the General category, you should see your newly created service listed there. Select it, then Double-click close to the right side of the selected line to reveal a field where you can enter a custom keyboard shortcut. Enter an easy to remember but unique keyboard shortcut (I decided to go with ctrl+option+command+L), and then quit System Preferences.</li>
</ol>
<p>That&#8217;s it! Go ahead and test your keyboard shortcut!</p>
<p>Welcome back! As you should have just seen, pressing the assigned keyboard shortcut fast user switches to the login screen leaving all your programs running in the background waiting for you to log back in again. If you&#8217;re more mouse inclined, you can of course also lock your screen by choosing your Automator action from the Services menu. All accomplished with the awesome customization tools included with Mac OS X 10.6 Snow Leopard!</p>
]]></content:encoded>
			<wfw:commentRss>http://artofgeek.com/2009/09/08/lock-your-macs-screen-like-in-windows-snow-leopard-edition/feed/</wfw:commentRss>
		<slash:comments>102</slash:comments>
		</item>
	</channel>
</rss>
