【问题标题】:Send email from clipboard without opening mail.app在不打开 mail.app 的情况下从剪贴板发送电子邮件
【发布时间】:2014-11-15 19:48:46
【问题描述】:

我搜索了如何在不打开apple mail的情况下发送电子邮件,发现问题AppleScript - How to send a email without the mail app opening up

但是,我正在使用 Keyboard maestro 执行此操作,这样我就可以在任何应用程序中使用热键发送特定的电子邮件。在谷歌搜索解决方案后,我发现这个脚本做得很好:

tell application "Mail"
set theNewMessage to make new outgoing message with properties {subject:"hello", content:"You got a new file in your Downloads folder, girl!", visible:true}
tell theNewMessage
    make new to recipient at end of to recipients with properties {address:"myemail@mail.com"}
    send
end tell

说完

一个问题:我想这样做,但是我想要剪贴板,而不是主题中的hello。谷歌搜索,我发现了两件事

keystroke "v" using {command down}

return (the clipboard)

我试着用那两个来代替“你好”。但它们都不起作用。

我不知道applescript,因此在谷歌搜索和我的问题在这里。

【问题讨论】:

    标签: applescript keyboard-maestro


    【解决方案1】:

    这对我有用:

    set a to "myemail@mail.com"
    tell application "Mail"
        tell (make new outgoing message)
            set subject to (the clipboard)
            set content to "content"
            make new to recipient at end of to recipients with properties {address:a}
            send
        end tell
    end tell
    

    【讨论】:

    • 你能不能制作一个新的脚本,使得主题是前 10 个单词,并且 iff 剪贴板超过 10 个单词,然后剪贴板被切断,例如像这样“你好宝贝,这是一条长消息发送... [见注释]”然后整个消息在电子邮件的内容中。
    【解决方案2】:

    这是一个恰好适合我的脚本。我只是将它作为示例发布。

    tell application "System Events"
        activate application "Mail"
        set the clipboard to "Subject Line"
        keystroke "v" using command down
        keystroke tab
        set the clipboard to "This is the contents.\nLine 2 of the contents."
        keystroke "v" using command down
    end tell
    

    我在浏览器中单击电子邮件地址后使用此脚本。在确保文本插入点位于电子邮件的主题行中后,我从 AppleScript 菜单中选择了相关的邮件脚本。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-07-04
      • 2021-05-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-04
      • 2021-10-08
      • 2012-12-25
      相关资源
      最近更新 更多