Of smart folders, Automator and Ruby
Posted by Daniel Fri, 10 Aug 2007 00:15:00 GMT
&tI was working on organizing my computer because I'll be switching machines soon, and it was clearly time for some automation. I built a few smart folders, a couple of burn folders, and some Automator scripts. I was disappointed to see that Automator's shell scripts don't include Ruby out of the box. Easily enough fixed though. Here's what you do: Open /System/Library/Automator/, find the Run Shell Script.action file (it's really a package) control click and select "Show Package Contents" then make your way to /Contents/Resources/Shells.plist and open it with your favorite text editor. Then add <key>/usr/bin/ruby</key>
<dict>
<key>args</key>
<array>
<string>-e</string>
<string>%</string>
<string>--</string>
</array>
<key>script</key>
<array>
<string>$STDIN.each { |arg| puts arg }</string>
<string>ARGV.each { |arg| puts arg }</string>
</array>
</dict>
You can of course create these entries by using the plist editor. When you restart Automator you should be able to choose /usr/bin/ruby from the run shell action. The blocks are just a starting point... then it's up to you...
