Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: scripting bridge Mail rule condition



On Nov 7, 2007, at 5:42 PM, Russ McBride wrote:

Anyone know how to get a MailRuleCondition object from a MailRule? I have no problem getting the rest of the parts of a rule but I can't get the rule conditions. I thought I could just do something like this:

SBElementArray *conditions = [someRule ruleConditions];

NSString *expression = [conditions objectWithName: @"expression"];

What I get is something like this:
<MailRuleCondition @0x1e25c0: MailRuleCondition "expression" of MailRule 22 of application "Mail" (8087)>

Hey, you asked for a specifier for a rule condition by name, and that's what you got. Remember, specifiers in Scripting Bridge are lazy -- -objectAtIndex: and -objectWithName: just build a new specifier, they don't actually get any data. You have to ask for a property to do that.


Seriously, though, the problem is that rule conditions are objects, not just an expression string, and they don't have names. Use - objectAtIndex:, and then get properties of the result. For example:

	SBElementArray *conditions = [someRule ruleConditions];
	MailRuleCondition *aCondition = [conditions objectAtIndex:0];
	NSString *expression = [aCondition expression];


--Chris Nebel AppleScript Engineering

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-implementors mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-implementors/email@hidden

This email sent to email@hidden
References: 
 >scripting bridge Mail rule condition (From: Russ McBride <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.