and I want to do two things with it. Firstly I want to delete everything before and after the link so that I can just paste it into a web browser. Secondly I want to turn those =2E things into periods so it will look like http://www.google.com. Any help would be much appreciated. Thank you
Yeah, I was going to say that you can probably just get the url through applescirpt. But here’s a simple example of how you might do that from your string:
set t to “http://www=2Egoogle=2Ecom/
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>”
set o to offset of “http:” in t
set t to text o thru -1 of t
if (count paragraphs of t) > 1 then
set t to text 1 thru -2 of (first paragraph of t)
end if
set d to text item delimiters of AppleScript
set text item delimiters of AppleScript to {“=2E”}
try
set temp_list to text items of t
set text item delimiters of AppleScript to {“.”}
set t to temp_list as string
set text item delimiters of AppleScript to d
on error
set text item delimiters of AppleScript to d
beep 2
return
end try
open location t
Come to think of it, if there’s always a backslash at the end of the url, then you don’t need the conditional statement:
set t to “http://www=2Egoogle=2Ecom/
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>”
set o to offset of “http:” in t
set t to text o thru -1 of t
set t to text 1 thru -2 of (first paragraph of t)
set d to text item delimiters of AppleScript
set text item delimiters of AppleScript to {“=2E”}
try
set temp_list to text items of t
set text item delimiters of AppleScript to {“.”}
set t to temp_list as string
set text item delimiters of AppleScript to d
on error
set text item delimiters of AppleScript to d
beep 2
return
end try
open location t
Thanks guys! I finally got the script to work. It was actually pulling php links so I added something to remove everything from the ending for that as well so here’s the final product.
set o to offset of "http:" in (text item i of wordList)
set p to offset of "php3" in (text item i of wordList)
set t to text (o) thru (p + 3) of text item i of wordList
set d to text item delimiters of AppleScript
try
set text item delimiters of AppleScript to {"=2E"}
set temp_list to text items of t
set text item delimiters of AppleScript to {"."}
set text item delimiters of AppleScript to d
end try
Works perfectly. Thanks to everyone again for all the help!