RSS

Discover news, guides, and products for your business


  • Recommend:
  • 0 Comments
  • Print

Shorten URLs With an Automator Service

Twitter and other online services have made shortening URLs a regular chore; such URLs are handy not only on social networks, but anytime you need to share links (especially long ones). There are plenty of ways to shorten URLs, some of them built into social networking apps. But if you'd like to have a shortening tool available almost anywhere, MacOSXHints users renaultssoftware and yesiamnhoj found a way to build a service in Automator that lets you shorten any URL in any app with one click:

Open up Automator and make a new service. In the top bar, set Service Receives to URLs and In to Any Application. Drag over the Run AppleScript action (from the Utilities section) and paste the following code into its entry window, replacing anything that was already there:

on run {input, parameters}

return (do shell script "/usr/bin/curl 'http://qgf.in/api.php?url=" & (item 1 of the input) & "'")

end run

Below that, drag the Copy to Clipboard action. Save the Service as Shorten URL or whatever else you want.

That done, you should be able to Control-click on any URL in any program and select Shorten URL from the Services submenu; the shortened URL should then be available in your clipboard, ready for pasting into Twitter, e-mail, or wherever you need it.

This hint uses the lesser-known shortening service QGF.in. You can use other services too, as long as they have APIs. To use another service, replace http://qgf.in/api.php?url= in the script above; the syntax is usually http://shortener.name/api?url=.

Macworld
For more Macintosh computing news, visit Macworld. Story copyright © 2011 Mac Publishing LLC. All rights reserved.

Was this article useful? Yes 0 No 0

Comments

Follow us on:
Business News Daily

Get the latest technology news that's important to you and your business, fresh seven days a week.

Featured Webcasts

Free Whitepapers

Software and Services Whitepapers from PCWorld

More whitepapers »

Whitepaper Alerts

Get updates on white papers, case studies, and spotlights on tech products and solutions for your business.