Accessing Properties of URLs with AppleScript

I recently stumbled upon the fact that a string can be coerced to a URL in AppleScript. This is cool because it allows you to access various properties of the URL, including the dotted decimal form of the URL's host.

"http://www.apple.com" as URL
--> {class:URL, scheme:http URL, path:"http://www.apple.com", host:{class:Internet address, DNS form:"www.apple.com", port:80, dotted decimal form:"23.0.29.15"}}

It should be noted that this isn't actually core AppleScript terminology. The "URL" class is terminology from the StandardAdditions scripting addition, which is included with Mac OS X.

Peachpit Blog Post > Automator Services: Preview Selected URL

12.11.09 - Automator Services: Preview Selected URL.

If you're a user of Mac OS X Mail, then you may know that you can use Quick Look to preview image attachments in a message. To do so, just select an image attachment in a message and press the spacebar, press Command+Y, or click Quick Look at the top of the message. For today's Automator Service workflow tip, we'll take this concept a bit further, by creating a way for you to quickly preview URLs in Mail messages, TextEdit documents, and more, without the need to open Safari. [Read more at Peachpit.com...]