Being a Mac user means you have incredible flexibility with how you use your computer. Sometimes, that flexibility causes you issues as well. But armed with AppleScript, hopefully you can overcome.
I recently purchased a Henge dock, having had to wait quite a while for them to manufacture units that fit my white Macbook. It was a bit of a pain to set up, but I’ve been really pleased with how it cleaned up my desk. Instead of a mass of cables coming out the side of my Macbook sitting on a laptop stand, all the cables are hanging off the desk in a tidy twist-tied tangle.

Out of sight, out of mind, right?
On to the problem this caused. Now the audio jack is tucked away and the desktop speakers are plugged in to that 24/7. But what if I want to put on the old headphones? Luckily, the new Yeti microphone I purchased comes with a headphone jack. This makes sense for conversations and podcast recordings. Using this jack for your audio output is easily accessed in the Sound System Preferences pane.

One last issue: I don’t want to open Systems Preferences every time I switch between the two. No problem, I’m a Mac user. Surely AppleScript + FastScripts can solve this niggling, first world problem.
And a Google search brings a nice solution on the first try, courtesy of none other than Jesse Gardner (aka @plasticmind). Jesse had the same need and came up with a nice script that switches between two different audio outputs when invoked. A small tweak to include the proper name for my Yeti output + a key combination in FastScripts and I can now switch between the two on the fly.
Convoluted? Yes. Satisfying? Hell, yes.
At least, that’s my opinion. Sadly, I somehow missed Shawn Blanc’s apple script for importing bookmarks from Safari to Yojimbo in Oct. 2009. I was probably messing around with Evernote or some such skullduggery. Anyways, after Shawn linked to his post the other day, I’ve been using the script — and loving it!
However, there was one other item I wished the script would do: allow me to edit the title before the bookmark was created in Yojimbo. Sometimes the entire page title is simply too long:
Front-end Maintainability with Sass and Style Guides | Engine Yard Ruby on Rails Blog
Or sometimes it’s a mess:
Quote: You know what we’ve found? Magical things h… - (37signals)
I preferred to have the option to edit the title first. Thanks to Shawn’s nicely commented and organized script, it was an easy update. Here’s the summary of changes I made to Shawn’s script:
1 - Added a dialogue to display the dialogue and allow for a change:

2 - Updated the portion where Shawn allows the user to add tags. I simply updated the variable name:

3 - Lastly, tell Yojimbo to use the title answer variable rather than the title taken from Safari at the beginning of the script:

That’s it. If the user likes the title as is, they simply have to hit Enter and move on.
Red Sweater Software - Scripts ⇾
Daniel Jalkut shares his collection of favorite Apple scripts.
These are a few of my favorite scripts - they make daily activities less frustrating and more productive.
These all look good, but a couple of them scratch itches I didn’t even know existed. Example: how perfect is the Convert-to-MP3 script for Tumblr users?
One thing I neglected to add to my post yesterday on counting characters was that there is most likely various different ways to achieve what I did with Applescript and Automator. That’s another sometimes positive, sometimes maddening aspect of OS X — there are so many different ways to fiddle.
Along with that fact, I should have added the caveat that there was no doubt a more elegant possible use of Applescript to achieve my desired final result. And there is — reader Jay from The Practice of Code sent me a version that is so much nicer and cleaner than mine. His does not make use of the clipboard, as you can see here:

This was originally how I wanted the script to work. I didn’t want to use the clipboard, but hunting through the library in Applescript did not yield the simple “input as text” I needed. If interested, grab the code here.
Thanks Jay for sharing your knowledge. And thanks to many others who passed on their suggestions. All were good, but Jay’s was the best.
When a client sends in an completed ad to the Fusion mailbox, they include the accompanying text that sits beside the ad graphic. Because we allow a max of 80 characters, care has to be taken to ensure that there is no more than 80 characters included. It sounds obvious, but from time to time, a customer forgets the limit.
And so there are many times when I’ve eyeballed the text and thought, “That looks a little large.” At this point, I have no desire to squint at the screen and count characters. Normally I would copy and paste the text into another app, such as MarsEdit or WriteRoom. Apps such as these have the ability to give you a character count, which is great when you are writing and already using the app.
But it was enough of an inconvenience to me to have to open one of these apps to paste the text into. When I’m in the middle of an email session, those apps are never open. What I needed was a way to simply select any block of text, hit a key combo, and get a message with the text stats I desired.
Ah, the joy of being a Mac user …
System Services
Applescript is definitely a little weird and quirky, but it’s also flexible. A quick search on the Net found the following script by Rob Griffiths:
set myWords to count words of (the clipboard)
set myParas to count paragraphs of (the clipboard)
display dialog “Characters: ” & myCount & ”
Words: ” & myWords & ”
Paragraphs: ” & myParas
This would be best to create as a system wide service, accessible via a keyboard shortcut. I created one right away in Automator and it worked okay. But I first had to copy the text to the clipboard since the script accesses the text from there. Typing CMD + C is not a big deal, but it still felt awkward and unneccesary.
To get around this, I had to add the following Apple code to Automator:
tell application “System Events” to keystroke “c” using command down
return input
end run
This would not work within the same script that calculates the text statistics — it had to be added separately. Here’s how the service looks in its entirety.

And this is the result:

This is why I love being a Mac user. Solving your own problems is often possible, and usually fun.