Is it possible to download web addresses embedded in mail

G’day

We sometimes get emails with embedded addresses linking to artwork, which we need to automatically download and print.

the form might be…

http://68.146.xxx.xx/pickup/8884_HeritageHill.pdfhttp://68.146.xxx.xx/pickup/8884_HeritageHill.pdf

and we might get three or four embedded in the body of an email.

Is there any way to parse the information out of the mail content, and use something like Transmit to download each file?

Also, is it possible to tell the difference between these downloads and similar addresses that might be just site page addresses?

Thanks, & regards

Santa

Hi Santa,

if all links begin with <http:// and end with >
try this

set theSource to "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Proin eleifend ipsum eget nunc.
	<http://68.146.xxx.xx/pickup/8884_HeritageHill.pdf>http://68.146.xxx.xx/pickup/8884_HeritageHill.pdf
	Morbi mattis velit vel justo scelerisque ullamcorper. Nam tincidunt enim vel nisl. Aliquam nisl
	<http://68.146.xxx.xx/pickup/8885_ChaosCity.jpg>http://68.146.xxx.xx/pickup/8885_ChaosCity.jpg
	consectetuer faucibus, sem leo dignissim eros, at rhoncus lorem turpis in massa"

set links to {}
set {TID, text item delimiters} to {text item delimiters, "<http://"}
set theSource to text items of theSource
if (count theSource) > 1 then
	set text item delimiters to ">"
	repeat with i from 2 to count text items of theSource
		set end of links to "http://" & text item 1 of item i of theSource
	end repeat
	set text item delimiters to "/"
	repeat with i in links
		set fName to last text item of i
		if {text -3 thru -1 of fName} is in {"jpg", "pdf", "gif", "zip"} then
			do shell script "curl " & quoted form of i & " >" & quoted form of (POSIX path of (path to desktop) & fName)
		end if
	end repeat
end if
set text item delimiters to TID

Thanks stefan

Santa