Scripts Part 7: Contextual Menus with Automator

Recently, for some odd reason, there has been a spate of solutions to the problem of creating new files in the Finder via a contextual menu. One involves a contextual menu plugin called NuFile. Another involves installing Big Cats Scripts and linking it to an Applescript. But honestly — and I'm surprised someone else didn't think of this first — when faced with simple contextual menu tasks, these days my first thought is to look to Automator.

And by golly, that's just what I did. Here are a few Automator workflows that do, more or less what the afore-linked methods do. To me, the advantage of the Automator approach is that you don't need to install anything. It's all baked in. Which means you don't ever need to update anything either. Nice. Simple. And, yeah, kind of the whole point of Automator.

So here you go. Maybe someone will find this useful, if for nothing other than as an exercise in creating contextual menu functionality with Automator. Or skinning a cat multiple ways. Or something. To use this, download the .zip file, unzip it and place it in:

~/Library/Workflows/Applications/Finder

NewTextFile Workflow

It should become active immediately.

Also, here are a couple variants. One will create a text file, and then open it in TextWrangler (if you have TextWrangler, and if you don't, go get it now); the other creates a Word document, and opens it in Word. I'm far to lazy to completely duplicate the functionality of NuFile. But if you examine these workflows, you can at least see now how that would be possible (in fact, fairly easy) to accomplish.

NewTextFile Workflow Variants

I actually think it would be great if Apple made it drop dead simple to create true contextual menus for the Finder. Fortunately, Automator gets us pretty close.

Oh, yeah, and since this is technically script writing, and since I haven't posted to that series in some time, we're gonna go ahead and call this a Script Sharing post. Deal with it.

Right. Good night.

UPDATE: Revised March 31, 2007, 3:00 PM

Stephan Cleaves has added yet another implementation of this idea. He's using a combination of Automator and AppleScript. I certainly think his implementation is better than mine in a few ways. Certainly more full-featured. It will prompt for a file name, for instance, and takes pains not to overwrite a preexisting file with the same name. Nice. But we're taking very different approaches to the same idea (his version places a file in the front-most Finder window, my version places it in the right-clicked folder), and he was confused by my approach. After speaking to him via comments on his blog, I realized that some clarification as to how my workflow is actually constructed might be in order.

Basically, my workflow takes the folder selected in the Finder as input and assigns that input to the variable "$@". That variable and the for loop in my workflow are automatically generated by Automator when you select “as arguments” from the “Pass input:” field in the “Do Shell Script” action. It’s how you get the context (the selected folder) passed to the script. Apparently Automator takes “$@” as the variable for “the folder you just selected” whenever there’s no input from a previous action. This was something I learned while fiddling around with all of this, and it's really my favorite part. The coolest thing for me here, really, was figuring out how to pass the context — i.e. the right-clicked folder — to an Automator "Do Shell Script" action. This opens up worlds of potential.

Finally, as I said, the for loop in the action is auto-generated by Automator. The workflow will work almost as well with the simple script:

touch “$@/NewText.txt”

Using the for loop, however, allows you to create a new text file in multiple folders by selecting said folders and running the workflow.

It's really kind of amazing how many ways there are to do this. Wow. Fun stuff.

Broken Downloadable Installers

In the past it's always been possible to save a copy of updates downloaded via Mac OS X's Software Update application.


Software Update: Keep it Handy
(click image for larger view)

Recently, however, certain Final Cut Studio updates will only install via the Software Update mechanism. You can download the updater, but it won't install. For instance, the version 5.1.4 update will download several packages to my hard drive.


Downloaded Packages: Completely Useless in this Case
(click image for larger view)

And I can launch the Final Cut package installer, and it will open in the Installer application. But the splash screen gives me my first hint that something is not right.


Installer: Uh-Oh
(click image for larger view)

I can even navigate to the "Select Destination" screen of the installer, but here I am told that this update can only be installed via Software Update.


Installer: New and the Opposite of Improved
(click image for larger view)

To add insult to injury, even though I've already downloaded the installers, Software Update, once quit, needs to download them all over again. Lame. Painful. Awful. Installing this 39 MB update on my 25+ Macs will kill my network. Guaranteed.


Software Update: But... I Just Downloaded It...
(click image for larger view)

The ability to download software updates for later install — or reinstall — is a really wonderful function of Mac's Software Update mechanism, particularly from a systems standpoint. It's sad and more than a little scary to see it not working on certain, specific pieces of software. Here's hoping this trend does not continue.

Beating a Dead Horse

As everyone is well aware, Adobe recently released a beta of Photoshop CS3, complete with new icons. The new application icon is so stripped down and plain I had initially assumed it was a placeholder for something permanent in the final version — that this was merely a stopgap icon for the beta release. This is, it turns out, not the case. This is it. Put a fork in it. It's done.

Not only is this the final icon for Photoshop CS3, but Adobe has redesigned the entire CS3 application suite around the same concept. People all over the Mac web are weighing in on the matter, and they're generally sitting in one of two camps: They either love it or they hate it. Here are some links to the ongoing commentary:
John Nack
Veerle
Jason Santa Maria
Dave Shea

Personally, I'm on the fence. No, that's not actually completely accurate. Personally, I can see both sides, and in the end I think that the icon redesign sort of breaks even. I think we basically lose as much as we gain between form and functionality with these new icons. And I think that there is another approach that would have worked better than the one taken by Adobe on CS3.

The new CS3 suite icons are all based on the same idea. A colored square with a two-letter identifier that mimics the periodic table of elements. It's a nice concept in a way, especially considering its entire purpose seems to be to unite a vast and sprawling suite of applications. And I think on this level it works. Applications from the Adobe suite will be immediately recognizable as such in the Dock, and telling each application apart shouldn't be too terribly difficult. I even kind of like the sparse, minimal appearance of these new icons.


The Adobe CS3 Icon Set: Confused Yet?
(click image for larger view)

My first problem, though, is that they're not particularly iconic. They're basically text. Or, the thing that's used to identify each application is text. Conceptually, this bothers me a little. The Adobe suite of applications is, for all intents and purposes, visual in nature. It's made for processing imagery moreso than text. These are not text applications, but image editing applications. They're made for visual people working on visual projects. So using text as an identifier seems a strange — maybe even an inappropriate — approach. I can see it for something like the Microsoft Office suite, which does indeed use text-based icons. But for image editing apps it just seems wrong to not use something image-based.

My other complaint, from a practical standpoint, is that text is a much clumsier, more difficult way to identify an application than symbolism. It requires hard looking, reading, something more than a mere glance. Icons are, at their hearts, symbols, and symbols are intuitively easier to grasp than text. Which is the whole reason icons tend to be made from images rather than text in the first place. It's the reason almost everything on a GUI-based interface is a picture rather than (or in addition to) text. Can you imagine a folder on your Desktop that was a big square with the letters "Fo" on it? Imagine an entire OS described this way. I'd guess it'd get a bit trickier to navigate. (Actually, you don't have to imagine it. Just open up the Terminal. It's called the UNIX command-line. And we all know how popular that is with the design crowd.)


Adobe CS3 Apps in the Dock: Imagine an Entire OS Like This
(image stolen from Dave Shea)
(click image for larger view)

It seems to me that there is a better approach for Adobe — one that could unify the suite, while at the same time keeping in step with a more purely visual approach. We can see traces of it in the one exception to the rule with the new suite icons: Acrobat. Acrobat's icon uses the same sparse approach as the other applications — an application identifier on a colored square — but instead of using text as an identifier, it uses the well-known Acrobat icon image — that weird little loopy-loop we all know so well, and that we immediately associate with Acrobat — in the center of the colored square. Veerle (who likes the new icons) had this to say about it:

You might wonder why Acrobat Reader hasn't "Ar" as icon or "Pd" or something, just to take the same line with the rest of the products. The curvy triangle is so well known that it's obvious they kept using it for the icon. I think if the other applications had a similar icon over the years, they would have done the same. Since there are none they decided to use a two-letter mnemonic 'nickname' system as their primary identifier.

And therein lies both the problem and the solution. I think the best approach Adobe could take — both from a conceptual and a practical standpoint — would be to actually create memorable, iconic symbols for each of their applications. Thus far they have not done so, and choosing instead to represent their apps with plain two-letter text identifiers just seems a little cheap, lazy and ineffectual. Why doesn't Photoshop have such a memorable symbol associated with its product line after all these years? Or Illustrator? By now they really should. Maybe it's time to start working on these.

Acrobat Icon: Why Doesn't Photoshop Have a Symbol?
(click image for larger view)

Past Adobe icons were visual in nature, but suffered from a lack of readability in the Dock. They were pretty, but they looked too similar and their imagery made no sense whatsoever — form over function. But this new set will suffer from the same sort of unreadability. They're less visual, less image-based, but still very similar. And they'll now require yo u to read them and decipher their two-letter code. Still, they'll be somewhat easier to discern from one another (since the letters at least correspond to something in the real world, i.e. the application name, whereas the previous icons used images that were completely arbitrary and nonsensical) and a bit more unified as a group, though arguably less attractive — function over form. It's a tradeoff. But one that, again, we break even on with the new icon set. This new icon set offers no functional or aesthetic advantages over its older counterpart. Or what advantages it may offer are offset by disadvantages it spawns. Creating real symbols that speak somehow to the nature of the application — like they've done in some respects with Acrobat — for the rest of the suite would solve the problems of both form and function: Icons created from these symbols would be both more beautiful and more functional. You would think a big, giant, design-based software company would get this. But so far, they seem to have missed the boat.

I don't hate the new icons. I actually think they look kind of cool in a minimal sort of way. But they're just not particularly visually interesting, nor will they add much functionality over their predecessors. So I can't say I'm overly enamored with them either. For a major change to a major application suite — one that has a lot of folks up in arms — I have to say, I'm feeling quite... neutral on the matter. And that's a little disappointing in and of itself. I wish I were feeling excited.

Photoshop CS3 Does Video

Everyone's talking about Adobe's Photoshop CS3 Beta release. In a day and age when paid betas are all the rage among smaller developers, a big developer releasing a free (though time-limited) beta of a flagship program is exciting in and of itself. But this beta has legs. It's good stuff. I'll go over some of the more significant features that everyone's buzzing about. But I also want to spend a little time talking about some things that no one in the mainstream press seems particularly interested in, 'cause, you know, I'm funny like that. And 'cause there are some real gems, from my particular perspective.

The Installer
I wanted to briefly mention the installer for Photoshop CS3, because it's pretty nice, particularly in contrast to the Acrobat Reader installer. No, it's not an Apple Installer, but it does offer a great deal of control (and some features not available from Apple Installers), and from a systems perspective, this is wonderful. Most notably, the Photoshop CS3 installer (called Setup.app) contains an uninstaller. Awesome! Yes, it may be hard to believe, but there have been times I actually wanted to completely uninstall Photoshop, and I couldn't. Now I can.


Adobe Photoshop CS3 Beta: Uninstall or Reinstall
(click image for larger view)

The uninstaller even gives you the option to delete application preferences. Wow. That's pretty thorough.


Adobe Photoshop CS3 Beta: Uninstalling Components
(click image for larger view)

Secondly, the installer allows you to choose which Photoshop components get installed, or to reinstall or uninstall specific components of the suite. Don't use Camera RAW? Don't use Bridge? Fine. Don't install 'em. Change your mind? Fine. Go reinstall 'em.


Adobe Photoshop CS3 Beta: Reinstalling Components
(click image for larger view)

I can't believe I'm saying this, but Adobe has really gotten this installer right. If I can't have drag-'n'-drop or package installers, then this is what I want. The only problem is, I'm pretty sure it won't work with Apple Remote Desktop (but then it never did anyway). Otherwise, I'm pleased as punch.

One other thing to note about the beta installation: Adobe requires you to produce a valid Photoshop CS2, Creative Suite 2, Production Studio, Adobe Web Bundle, or Adobe Video Bundle serial number to use the beta for longer than the 2-day trial period. Supply this serial number and you'll be given a new serial number for the beta. The new serial number can be used to activate the software until the beta expires, ostensibly some time around the official release date. The software gets activated online via a connection to Adobe, and it keeps tabs on how many machines you've installed the beta on. The limit is two computers. I installed it on two machines, but then, after installing it on the third I received this alert when trying to activate the software:


Adobe Photoshop CS3 Beta: Too Many Activations
(click image for larger view)

This seems relatively fair to me. The only thing I find somewhat irksome is that we have a 20-seat volume license. So, to my way of thinking, our serial number should be good for 20 installs of the beta. Apparently Adobe feels differently. I also wish I could deactivate machines remotely, via this interface (like you can with iTunes music, for instance). But no, unfortunately I'll have to go over to the machines in question, log in and deactivate them locally. Oh well.

The Icon
The first thing I noticed after installing the Photoshop Beta was the strange, minimal application icon. I kind of like it, but it seems somewhat inappropriate to me that Photoshop — an image editing application that's always had pretty fancy icons — has such a plain one. I'm assuming that this is just the icon they'll use for the beta, and that a more sophisticated icon will come with the shipping version.


Adobe Photoshop CS3 Beta: Minimal Beta Icon
(click image for larger view)

The Hot New Features
One item of significance — in fact, according to the scuttlebutt, it's a big reason the beta was released — is that this is the first version of Photoshop to run natively on Apple's latest Intel hardware. Amazingly, this comes off as a footnote in most of the reviews, overshadowed by the fact that this also happens to be the first major revision of the photo-editing powerhouse to actually be packed with exciting, new and useful features. In fact, after trying it out, it's the first time I've been impressed with an Adobe release other than Lightroom in years. And it's Photoshop, man. Frickin' Photoshop!

One of the most discussed aspects of Photoshop CS3 is the interface, and it's certainly worth a mention here. It's been quite extensive ly overhauled, and yet still feels completely familiar. Everything is right where you'd expect it, but there are numerous productivity enhancements throughout the app. Little touches, really, like a toolbar that is one tool wide, giving you more room for viewing your image. Palettes are more logically (and attractively) presented and unified, instead of floating around all over the place. This seems to be the trend with a number of apps, and if AfterEffects 7 and Lightroom are any indication, Adobe is following it. This is a good thing. I truly hate moving windows and palettes around. And with today's big screens, there should be little need to.


Adobe Photoshop CS3 Beta: Nice Interface Refinements
(click image for larger view)

My one big beef is that there still seems to be no key command to switch between open documents. Almost every other application on the Mac nowadays uses "command- `" to switch between open docs. Yet Photoshop CS3 still not only fails to adhere to this standard, but apparently lacks the ability to switch between open docs with the keyboard at all. This seems like a strange oversight for such a significant interface overhaul. I also wish Adobe would use standard Apple key-commands for things like hiding the app ("command-h" on the Mac, generally) but at least the ability exists to do this from the keyboard, and it's configurable.

Finally, the Refine Edge tool is quite the talk of the town. And for good reason. Anyone who's ever tried to select a color range and then tried to tweak the selection has longed for this tool, which basically allows you to interactively refine the edges of your selections. And it's finally here!


Adobe Photoshop CS3 Beta: Refine Edge
(click image for larger view)

Video (Yes, Video!)
But there's another fantastic new addition to Photoshop CS3, and it's one no one's mentioned, maybe because no one's quite as weird as me: Animation. For years I've wished Photoshop — with it's powerful layering capabilities, selection tools and brushes — could be used as a 2D animation tool. I always wanted to be able to import and draw on video in Photoshop. You could always fake this with ImageReady, which came with basic Quicktime import/export functions and a pretty useful Animation palette, and which I've demoed in my class numerous times. But it was clunky and confusing. ImageReady was not well equipped to deal with large numbers of relatively large images — it became painfully slow — and it lacked WACOM touch-sensitivity and the full range of brushes found in Photoshop. Plus, it was just plain inconvenient to use ImageReady when Photoshop was sitting right there. Well, my wait is finally over. Photoshop CS3 now includes the very same Animation palette formerly found only in ImageReady. It's there, and it works exactly as it did in ImageReady. Only now we get all that Photoshop goodness and the familiar interface we all know and love (or at least are accustomed to). Hooray!


Adobe Photoshop CS3 Beta: Holy Shit! Animation!
(click image for larger view)

There are a few new video-specific features too, though you might not know it from the coverage. There's a "Video and Film" Workspace, for one, which highlights all video-related menubar items and brings forth video-related palettes, including the Animation palette.


Adobe Photoshop CS3 Beta: Video and Film Workspace Highlights
(click image for larger view)

And now, since Photoshop CS3 does video, it only seems appropriate that it should have the ability to preview that video to a monitor, which in fact it now does.


Adobe Photoshop CS3 Beta: Video Preview
(click image for larger view)

All these new video capabilities were a huge surprise to me. And a hugely pleasant one. There was a time when I got pretty excited about new Adobe releases, but it was a long time ago. It's great to see Adobe, once again, release a really compelling version of Photoshop. I'm amazed at how much thought and care they've given "the little things," from the interface to the installer to, of all things, video. And yet they've still managed to keep all the good bits. This version has something for everyone. I, for one, am truly impressed.

UPDATE:
Looks like I was wrong. The new Photoshop CS3 icon featured in the beta is here to stay. Not only that, lots of people are buzzing about it. Personally, my favorite comment on the "issue" so far (I haven't had time to read them all — Help! I'm on dialup!) is one from John Nack:

[Not dismissing your opinion at all, but isn't it nice that in this world, at the end of 2006, it's computer iconography that constitutes our nightmares? We are very lucky to have literacy, intelligence, and leisure enough to give a damn about this stuff. -

-J.]

Totally agree. Still, I've decided to add my voice to the already huge compendium of opinion on the matter.