• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Mail rules firing an applescript
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Mail rules firing an applescript


  • Subject: Mail rules firing an applescript
  • From: "John C. Welch" <email@hidden>
  • Date: Mon, 17 Jul 2006 16:12:07 -0500
  • Thread-topic: Mail rules firing an applescript

Title: Mail rules firing an applescript
Okay, so I'm working on a script that runs from a rule and collects the content of the message that fired the rule.

First, I try to set it up like with E'rage, where I just collect the content, then go do other stuff outside of Mail, like so:

using terms from application "Mail"
    
on perform mail action with messages theMessages for rule theRule
       tell application "Mail"
            
set theMessageBodies to {}
            
repeat with x in theMessages
               set the end of theMessageBodies to the content of x
           end repeat
       end tell
   end perform mail action with messages
end using terms from

<do a bunch of stuff outside of Mail’s context>

Nice idea, but as soon as it finished Mail’s bit, the script ends. Lines of code left to execute, all ignored.

<sigh>

okay, fine, I figure out that to run this stuff, it has to be inside of the “perform mail action” block. Ugh, but okay.

Part of this script is a “Display Alert” step. If I step through it in script debugger, it works great. As soon as I try to run it as a normal script, the “display alert” step just stalls, ignoring the time out. I either get a blank dialog window, with no controls, or it’s there, but non-functional. Either way, I have to force-quit Mail to get it to work.

I know I can probably work around this with saving to a text file and a folder action, but unless Mail’s applescript from a rule functionality is just really borked, (A distinct possiblility, seeing as I’ve just given up on scriptable sigs ever working in Mac OS X 10.4.anything), I’d REALLY rather not do that, as while it works, it’s far more complicated than I’d like.

ideas?

--
"Life is like an exploded clown. It's really funny until you figure out
what just happened."
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Mail rules firing an applescript
      • From: Michelle Steiner <email@hidden>
  • Prev by Date: Re: Replace word BUT with same pointsize/linespace
  • Next by Date: Re: Mail rules firing an applescript
  • Previous by thread: Re: Replace word BUT with same pointsize/linespace
  • Next by thread: Re: Mail rules firing an applescript
  • Index(es):
    • Date
    • Thread