Bottom Line: This AppleScript grabs a URL from Chrome or Safari and shortens it with Bit.ly.

Sometimes I think Chrome is running slow because of all the extensions I have installed. Yesterday, I found this AppleScript which shortens a URL from Quicksilver, so I decided to tweak it a bit to grab the URL from the currently active browser (instead of taking it just from Quicksilver). Now I have it set as a hotkey trigger in Quicksilver (with the scope set to only web browsers), so I can just hit that hotkey and it presents a bitly-shortened URL back to Quicksilver. If you’d rather it return the URL to the clipboard (or both), there is a spot you can uncomment to enable that function as well.

Now that it’s running smoothly, I can go ahead and uninstall the link shortener extensions I had installed in Chrome and Safari, which may help them run slightly smoother. To get it set up, you’ll need to input your bitly username and API key toward the beginning of the script. Assuming you have an account, you can get these from https://bitly.com/a/your_api_key/.

On another note, I’m giving a shot to hosting my code snippets at GitHub Gists (instead of Pastebin, which I’ve been using to this point). One disadvantage is that there doesn’t seem to be an easy way to limit the height of a long script. If anybody has a suggestion that doesn’t require a WordPress plugin (since my nvALT / Markdown preview won’t work with that), let me know. Please and thank you.