Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7724887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T04:48:05+00:00 2026-06-01T04:48:05+00:00

Apple Mail defines both a class account and a constant account for the rule

  • 0

Apple Mail defines both a class account and a constant account for the rule type property of a rule condition. The Applescript compiler always resolves this collision of the term “account” to the class, making it impossible to do anything with rule conditions that match accounts.

When there’s a conflict such as this, how can I specify a constant instead of a class name? Is there a double-angle syntax for enumerated constants? Is there a solution that works for collisions of any type of terms (not just classes & enumerations)?

Examples

Making an “Account” Rule Condition

The goal of the following non-working example is to create a rule condition that will match an account.

tell application "Mail"
    set rool to make new rule at end of rules with properties {name:"test", enabled:false}
    (* the following ends up creating an 'any recipient' condition, as 'account'
       is «class mact»
     *)
    make new rule condition at end of rule conditions of rool with properties {rule type:account, expression:"Some Account"}
    log rule type of last rule condition of rool
    -- result: any recipient

    (* inspecting the event for the following, «class tacc» produces the proper
       record, ({'rtype':'tacc'}), but the rule condition is still an 'any recipient'
     *)
    make new rule condition at end of rule conditions of rool with properties {rule:«class tacc», expression:"Some Account"}
    log rule type of last rule condition of rool
    -- result: any recipient
end tell

Comparing

The goal of the following is to test whether a rule condition has rule type account. For it, first create a rule in Mail.app’s preferences named “Account” with a single condition that matches some account.

tell application "Mail"
    set acctType to rule type of first rule condition of rule "Account"
    log acctType is account
    -- result: false
    log acctType is «class tacc»
    -- result: false
end tell

My earlier question “How can I access a property that has the same name as class but different event code?” is similar, but only covers conflicts between class and property names. Moreover, the solution for it (using «class …») works for properties, but not for other types of collisions.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T04:48:06+00:00Added an answer on June 1, 2026 at 4:48 am

    One work-around is to define an account type variable referring to the enumeration constant outside of the tell application "Mail" block:

    set theAccountType to «constant eruttacc»
    tell application "Mail"
        set rool to make new rule at end of rules with properties {name:"test", enabled:false}
        set theCond to make new rule condition at end of rule conditions of rool with properties {rule type:theAccountType, expression:"Some Account"}
        properties of theCond
    end tell
    

    See also the Raw code reference, which shows the «class …», «constant …» and «event …» raw code forms.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to draw a pill type ellipse, as in Apple's Mail application which
I've been able to hack my way through scripting bridge and apple mail and
I got a notification mail after submitting my iphone application to apple store.. During
Apple.h class Apple { public: Apple(int); static int typeID; private: int id_; }; Apple.cpp
Using Apple's Mail application as an example; pretend it uses Core Data. When you
I want to be able to search a mailbox in apple's mail.app for a
How to show Welcome to Mail view programmatically? http://km.support.apple.com/library/APPLE/APPLECARE_ALLGEOS/HT4810/HT4810_01--welcome-001-ru.png Thank you.
Does anyone know what Apple Mail is written in? I'm trying to determine what
In Apple's Mail app, in the outline view on the left, an inbox or
I was getting the users mail addresses from Libraray/Preferences/com.apple.mail.plist. They are not there any

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.