Looking for help with class URL

Tried to achieve something with the class URL (from Standard Additions), but stranded pretty soon.

I.e. tried the following script:

set x to "[url=http://www.test.com/html/default..html]http://www.test.com/html/default..html'[/url]" as URL
get path of  URL 

This throws an error, saying that it can’t get the path of x , although when I look at the coerced x it gives me:

{class:URL, scheme:http URL, path:"http://www.test.com/html/default.html", host:{class:Internet address, DNS form:"www.test.com",port:80}}

Anybody knows more about dealing with the URL class?

  • David.

Aside from the apparent typo in the URL, does this work?

set x to "[url=http://www.test.com/html/default..html]http://www.test.com/html/default..html'[/url]" as URL
get path of x 

Ok sorry, too many tipos on the first post :?
Again:

set x to "[url=http://www.test.com/html/default.html]http://www.test.com/html/default.html'[/url]" as URL
	x

Results in:

{class:URL, scheme:http URL, path:"http://www.test.com/html/default.html'", host:{class:Internet address, DNS form:"www.test.com", port:80, dotted decimal form:"208.48.34.132"}}

This:

set x to "[url=http://www.test.com/html/default.html]http://www.test.com/html/default.html'[/url]" as URL
	get path of x

Results in error (code -1728):

Can't get path of {class:URL, scheme:http URL, path:"http://www.test.com/html/default.html', host:{class:Internet address, DNS form:"www.test.com", port:80, dotted decimal form:"208.48.34.132"}}.

On my OS X 10.2.4 setup, if I run this in Script Debugger or Script Editor 1.9:

set x to "http://www.test.com/html/default.html" as URL
get path of x

I get this result: “http://www.test.com/html/default.html

If I run it in Script Editor 2, it fails with the error that you report. It looks like a bug in Script Editor 2.

Thanks a lot for the hint.
Didn’t think as far as changing the editor…

  • David.

Must be in Script Editor 2.0 only, I guess.

I’ve tried it in FileMaker Pro 6.0’s Perform Applescript command, and it works.

Works in Smile, too.