Yeah - I wonder if a short explanation might help to demystify this a bit, Adam.
The problem is that the coercion to URL evidently requires plain text as the input - and, from AppleScript 1.9.2 (Mac OS X 10.3), the display dialog command outputs Unicode text.
(I’ve long felt that AppleScript should feature a built-in coercion to plain text, precisely to deal with this kind of situation. Although we’re often told that this brave new world of Unicode text is the way forward, I guess it’ll still be some time before everything works together seamlessly. Until then, it looks like we’re stuck with workarounds.)
On the face of it, one might assume that a straight coercion back to string would do the trick:
set a to "http://www.apple.com"
set b to a as Unicode text
set c to b as string
{a:a's class, b:b's class, c:c's class}
--> {a:string, b:Unicode text, c:string}
However, even though the variable c is classed as a string, this doesn’t necessarily mean it’s been reduced back to plain text. It is in fact styled text - as demonstrated by this little glimpse into the underlying structure of the values:
set a to ""
set b to a as Unicode text
set c to b as string
repeat with i in {a, b, c}
{a:{{text:a}} as string, b:{{text:b}} as string, c:{{text:c}} as string}
end repeat
--> result contains unpostable characters - so you'll just have to run the script for yourself! :P
Since neither Unicode nor styled text is any good for the coercion to URL, we have to find a way to strip out all the extraneous encoding before attempting it - hence the routine I suggested previously.
Another way to get close to what you were trying to do earlier might be:
set {text:theRef} to text returned of (display dialog "Enter the URL for the IP address you want" default answer ¬
"http://www.apple.com" buttons {"Get it"} default button 1) as string
set theURL to theRef as URL
set theIP to dotted decimal form of host of theURL