downloading links in an email

Hello,

I am trying to write a script for a rule in apple mail, that will automatically find a link in the message of the email, and then download that link to my desktop. I am new to scripting, so I may be way off. Thanks for any help.

using terms from application “Mail”
on perform mail action with messages theMessages for rule theRule
tell application “Mail”

		set numberOfMessages to count theMessages
		
		repeat with eachMessage in theMessages
			
			set theSubject to subject of eachMessage
			
			set theContent to content of eachMessage
			
			get theContent as string
			
			try
				if string contains "http://--" then set result to MyLink
				
				if MyLink ends with ".jpg" then
					
					set filename to "Macintosh HD:Users:chunky:Desktop:td_" & MyLink
					
					save MyLink of eachMessage in filename
					
					
				end if
				
			end try
			
		end repeat
		
	end tell
	
end perform mail action with messages

end using terms from

That particular user registered in 2006, posted their one and only question the same day, and hasn’t been back to the site since six hours after that. Your reply’s sixteen years too late — as I’ve pointed out to you on several similar occasions before.