Referencing this solution, I am trying to create an Automator script that will extract a URL from behind an HTML email button. However, getting the mail message source instead of content returns rich text that breaks the url links by "=" and linebreaks, leaving me with results like "http://www.=" and "http://www.w3=" instead of the full urls. How can I get the url from a mail message source HTML email?
The current Automator Workflow looks like this:
- Get Selected Mail Messages
Run Applescript:
on run {input, parameters}
set mailContentList to {} tell application "Mail" repeat with selectedMail in input set end of mailContentList to source of selectedMail end repeat end tell return mailContentListend run
- Extract URLs from Text
- Do more stuff with those URLs
I have tried inserting an Applescript step between 2 and 3 to process the text to remove the "=" & linebreak, but my code does not seem to change anything. Here is what I have tried:
on run {input, parameters}
set AppleScript's text item delimiters to {"=" & return & linefeed, "=" & return, "=" & linefeed, "=" & character id 8232}
set theTextItems to every text item of input
set AppleScript's text item delimiters to ""
set theText to theTextItems as string
set AppleScript's text item delimiters to ""
return theText
end run
Any ideas on how to either process the buggy rtf that inserts extra = and linebreaks, or get the input in a different format that returns the button hrefs as full URLs?