I don’t really know AppleScript but found the script below to open URLs in some email messages (run by a Mail rule when certain text is found in the subject line).
using terms from application "Mail"
on perform mail action with messages theMessages for rule OpenURLs
repeat with eachMessage in theMessages
tell application "Mail" to set t to paragraphs of the content of eachMessage
repeat with i in t
if i starts with "http://" then tell application "Safari" to open location i
end repeat
end repeat
end perform mail action with messages
end using terms from
It works fine if the URLs are on a line of their own, but I found it won’t open URLs if there’s other text in front of it on the same line (e.g. Blah, blah, blah http://website.com ).
Is it possible to make the script open the URL on a line with other text in front of it?