Macos Automator工作流-提取邮件消息源URL插入“=&引用+;URL内部换行符

Macos Automator工作流-提取邮件消息源URL插入“=&引用+;URL内部换行符,macos,email,applescript,rtf,automator,Macos,Email,Applescript,Rtf,Automator,引用,我试图创建一个自动脚本,它将从HTML电子邮件按钮后面提取URL。但是,获取邮件消息源而不是内容将返回富格文本,富格文本通过“=”和换行符断开url链接,这样我就得到了像“”和“”这样的结果,而不是完整的url。如何从邮件源HTML电子邮件获取url 当前Automator工作流如下所示: 获取选定的邮件消息 运行Applescript: 运行时{input,parameters} set mailContentList to {} tell application "Mail"

引用,我试图创建一个自动脚本,它将从HTML电子邮件按钮后面提取URL。但是,获取邮件消息源而不是内容将返回富格文本,富格文本通过“=”和换行符断开url链接,这样我就得到了像“”和“”这样的结果,而不是完整的url。如何从邮件源HTML电子邮件获取url

当前Automator工作流如下所示:

  • 获取选定的邮件消息
  • 运行Applescript:

    运行时{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 mailContentList
    
        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
    
    终点

  • 从文本中提取URL
  • 用这些URL做更多的事情
  • 我尝试在2和3之间插入Applescript步骤来处理文本以删除“=”&换行符,但我的代码似乎没有改变任何东西。以下是我尝试过的:

    运行时{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 mailContentList
    
        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
    

    关于如何处理插入额外=和换行符的错误rtf,或者以不同格式获取以完整URL返回按钮HREF的输入,有什么想法吗?

    我最终通过使用Run JavaScript块而不是Applescript块解决了这个问题:

    function run(input, parameters) {
        var text = input[0].replace(/=(?:\r\n|\r|\n)/g, '')
        return text;
    }
    

    它修复了错误行为。

    我最终通过使用RunJavaScript块而不是Applescript块解决了这个问题:

    function run(input, parameters) {
        var text = input[0].replace(/=(?:\r\n|\r|\n)/g, '')
        return text;
    }
    
    它修复了buggy行为