I use TextEdit for writing my TUAW posts, and it's always running. Recently, I found a neat service that works wonders for TextEdit and (I'm sure) a bunch of other text editors. It's free for the downloading from Ron Fleckner in Melbourne, Australia. What you'll get is a ZIP file that expands into a little, 86KB application file called Change Case.
Once installed, select some words or sentences, go to Services, and you'll get a screen like the one above. It's pretty self explanatory; ALL CAPS, All lowercase, and Toggle Case do just what they say. Word Capitals capitalizes each word in a sentence, and camelCase (which you might know as InterCap) is mostly used for brand names. It turns something like " My Program" into "MyProgram." While it's true that a few of these options are available in TextEdit under the Edit-> Transformations menu (namely: Make Upper Case, Make Lower Case and Capitalize), the Services menu is easier to get to, and Change Case does more.
I had a bit of trouble with it, which was probably all my fault. I've been emailing Ron, who has given me a great deal of insight as to what's happening. The first thing that may be a bit confusing is Ron's graphic, which looks like this:
The hierarchical menu that's shown only appears if you are running OS X 10.5 (Leopard). Apple did away with this useful feature in OS X 10.6, so Snow Leopard users will see the first picture in this post. Some other things were also broken. Under Snow Leopard, you won't find the old "New TextEdit Window Containing Selection" or "Open Selected File in TextEdit." That's in spite of the fact that TextEdit's info.plist file, where applications advertise Services to the Finder and System, have the correct entries (go figure).
Ron's page says to install the Change Case app in the root /System/Library folder, but as it turns out, that really isn't necessary. Finder will look for Services files anywhere. It is a good idea to follow his advice, though, if only to keep your Services in one place and make it easier to find. When you move it, you might get the usual 'type in your password" screen, or sometimes this comes up:
I had some trouble getting it to work on my MacBook Pro, but following these instructions worked perfectly on my iMac, so I'm pretty sure that the screw-ups were all mine. Just in case they weren't, though, here's what happened on the MacBook Pro (and how I solved the problems). The first time that I moved the file to the root /System/Library folder and logged out and back in, I found the entire folder to be empty. All the Services were gone. This was easily solved by copying the contents of the folder from my iMac onto a flash drive and copying it back to the MacBook Pro. Just to be on the safe side, you might want to copy the folder to your desktop and archive it into a ZIP file, which will give you easy recourse if this happens to you.
I deleted Change Case but didn't empty the trash, so there was at least one extra copy of it (and maybe more, since I went through installation a few times) still on my system. After logging out and back in, I went to the Services menu, which simply said "Building." I waited for a little while, and nothing ever showed up as Services (in any program). According to Ron, this was probably caused by the fact that I had more than one copy of Change Case on the MacBook Pro; the multiple copies were confusing the Finder. So, I found every instance of Change Case, made sure they were deleted, and I emptied the trash. Next, I downloaded a fresh copy of Change Case, unzipped it, moved it to the /System/Library folder, logged out and back in, enabled it via the Keyboard Preference Pane, and it worked like a champ.
Again, this probably won't happen to you. Change Case is only a few lines of code, and according to Ron, it doesn't mess with anything important in the System or Finder, but it's better to be safe than sorry.
Those familiar with Xcode or AppleScript will probably find it useful to roll their own services. If you do, Ron recommends leaving the new Services in the place where Xcode puts them, which is in a folder called "build" (in the projects folder). That way, any new version will overwrite the old one, and you won't have to worry about removing it.