Applescript to ObjC program communications?

  • Okay, here's what I'd like to do:

    1) Have a Mail.app rule fire an applescript when an email triggers the rule.
    2) Grab the "subject:" line and the "to:" line from the email, and send that to another program which I'll write

      What's the best way for an applescript to send the info to my ObjC program (for 10.6 or later)? The program will probably be a low-level service that waits on a specific port and runs in the background. It'll take the info, then file it into a table in an SQLite3 database. A different program will pull and collate the info in the DB.
      Secondly, how do I get an applescript to obtain the subject: line of an email, assuming Mail.app launched the applescript in question when the rule fired?
      Thirdly, are rules in Mail.app synchronous (w/regards to calling an Applescript)? i.e. will they wait for the script to finish?
  • On 19/06/2012, at 10:03 AM, William Squires wrote:

    > What's the best way for an applescript to send the info to my ObjC program (for 10.6 or later)?

    Make your application scriptable. If it's a one-off thing, methods in an application category exposed as an application property is the easiest way to go.

    > Secondly, how do I get an applescript to obtain the subject: line of an email, assuming Mail.app launched the applescript in question when the rule fired?

    That's more a question for another list, but the "perform mail action with messages" handler is passed a list of the messages; from there you can easily get the subject.

    > Thirdly, are rules in Mail.app synchronous (w/regards to calling an Applescript)? i.e. will they wait for the script to finish?

    I imagine they're as synchronous as any other rule action. But not all AppleScript commands are synchronous (most are, but some like "check for new mail" are not).

    --
    Shane Stanley <sstanley...>
    'AppleScriptObjC Explored' <www.macosxautomation.com/applescript/apps/>
previous month june 2012 next month
MTWTFSS
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30  
Go to today