开发者

AppleScript Question (Copy email contents, run Automator App)

I have a Mail filter that will run an Autoscript that will copy the messages content and then run a Automator App. However it is not working. It doesn't launch the Automator App or copy the contents.

So I have an email that comes in, it tells this Applescript to run. If I go in and edit the Applescript (even 24 hours later with no shut down, only sleep) and remove everything but the last line and click save the AppleScript launches the app. I have a feeling that there is something wrong with the first block of code. When the email comes in I have Mail set to make a sound, run the script and delete the email, so I know that the script is told to run.

  • How can I delete the email file?
  • Why is there an error in which it only runs after I open the AppleScript in the AppleScript editor? This is really dumb.

This is the current Applescript below:

using terms from application "Mail"
    on perform mail action with messages matchmsgs for rule mailrule
        tell application "Mail"
            set msg to item 1 of matchmsgs
            set msgcontent to (content of msg) as Unicode text
        end tell
        set the clipboard to msgcontent
        tell application "/Users/me/Docs/Update App.app" to ac开发者_JS百科tivate
    end perform mail action with messages
end using terms from


I believe for a mail rule that all of your applescript code must be within the on perform mail action with messages matchmsgs for rule mailrule block of code. As such try moving the line tell application "Update App" to activate to just after the line set the clipboard to msgcontent.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜