PDA

View Full Version : URL Extraction from String with Applescript




mooty
Mar 7, 2006, 05:20 AM
Hi All,

I want to extract an url, or number of urls from a string using applescript, and then set them to items in a list/array

Is this possible?

Thx for any help! :)



Eraserhead
Mar 7, 2006, 09:23 AM
yeah should be possible but it depends on how are you getting the url's?

are they saved in a text file?
if so how is the text formatted? (eg space's in between, a new line for each url?)
or are you getting them from safari or camino directly?

mooty
Mar 7, 2006, 10:01 AM
it would be from a URL probably - ie an html file most likely. Let say that the url is hard coded in the applescript - and the script reads the html from that...

Thanks.

Eraserhead
Mar 7, 2006, 10:35 AM
OK I have made a simple applescript, I have read in some URL's from a text file (with the script), they are seperated by spaces. I hope it's useful. 42643

This will work with any list of URL's (without spaces in them) seperated by spaces.

mooty
Mar 7, 2006, 10:43 AM
wow thanks for your efforts. i'll give it a whirl when i get home tonight and report back :) :)

Thank you!

Eraserhead
Mar 7, 2006, 11:22 AM
no problem...;)

mooty
Mar 7, 2006, 02:01 PM
Hi thanks for that - but is there a way to actually get urls from within HTML ? for example pick out all strings that start http:// etc ?

Eraserhead
Mar 7, 2006, 02:49 PM
I had a quick go but it isn't quick or clever...

I'm sure someone else could do better...
42660