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.

"" as URL
--> {class:URL, scheme:http URL, path:"", host:{class:Internet address, DNS form:"", port:80, dotted decimal form:""}}

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.

Be Sociable, Share!