Re: Running an Applescript in Mail
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