• 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
Re: Running an Applescript in Mail
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Running an Applescript in Mail


  • Subject: Re: Running an Applescript in Mail
  • From: Christopher Stone <email@hidden>
  • Date: Mon, 6 Nov 2017 03:56:21 -0600

On 11/06/2017, at 01:30, John Mitchell <email@hidden
<mailto:email@hidden>> wrote:
> I would like a script as part of the Mail interface, by click on a Mailbox
> name  to run a script in Filemaker to create a folder of the same name.
>
> I assumed I could do it using Rules but I believe that isn’t possible.


Hey John,

Mail's AppleScript via rule function has been problematic for a long time.

Selecting one or more regular mailboxes is simple enough.

------------------------------------------------------------------------------
# Select Top Level Mailbox:
------------------------------------------------------------------------------

tell application "Mail"
    set mailboxReference to mailbox "ACTION" of application "Mail"

    tell (some message viewer whose index is 1)
        set selected mailboxes to {mailboxReference}
    end tell

end tell

------------------------------------------------------------------------------
# Select Second Level Mailbox:
------------------------------------------------------------------------------

tell application "Mail"
    set mailboxReference to mailbox "Pending/ccs_From" of application "Mail"

    tell (some message viewer whose index is 1)
        set selected mailboxes to {mailboxReference}
    end tell

end tell

------------------------------------------------------------------------------
# Get Selected Mailbox:
------------------------------------------------------------------------------

tell application "Mail"
    set mailboxReference to mailbox "Pending/ccs_From" of application "Mail"

    tell (some message viewer whose index is 1)
        set selected mailboxes to {mailboxReference}
    end tell

end tell

------------------------------------------------------------------------------

But — Mail won't let you select Smart-Mailboxes via AppleScript.

You have to stoop to using System Events.

--
Best Regards,
Chris

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Running an Applescript in Mail (From: John Mitchell <email@hidden>)

  • Prev by Date: Re: Show Emoji & Symbols GUI access
  • Next by Date: Re: What is Best Method To Determine Duplicate Items in a Large List?
  • Previous by thread: Running an Applescript in Mail
  • Next by thread: Running an Applescript in Mail
  • Index(es):
    • Date
    • Thread