• 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
AppleScript and sdef
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AppleScript and sdef


  • Subject: AppleScript and sdef
  • From: Jason Swain <email@hidden>
  • Date: Fri, 17 Mar 2006 14:55:39 +0000

Hi, this should be a simple question, but it's had me stuck for quite a while now.

I have a CoreData app with AppleScript support. My sdef defines a document with group elements:

		<class name="document" code="docu">
            <cocoa class="SBDocument"/>
            <element type="group" access="r">
                <cocoa key="groups"/>
            </element>
        </class>

(I've deleted hopefully irrelevant detail here).

And a group class definition:

<class name="group" plural="groups" code="sgrp" description="A group.">
<cocoa class="SBGroup"/>
<property name="name" code="pnam" type="text" access="rw">
<cocoa key="name"/>
</property>
</class>


SBGroup is a managed object subclass if that makes any difference.

I'm trying to run the following AppleScript:

tell application "SecretBook"
	tell the first document
		count of groups
	end tell
end tell

I'm actually trying to get the name of a group, but this simpler example probably reveals more of the problem.

My code in SBDocument for getting the groups looks like this:

- (NSArray *)groups;
{
NSLog(@"Group called with %d groups", [[root valueForKey:@"groups"] count]);


	return [root valueForKey:@"groups"];
}

The first line is there for debugging. root is a managed object.

Now when I run the script I get a result of 1. There are 13 groups in the document, so this is incorrect. My debug output confirms this as follows:

2006-03-17 14:52:24.106 SecretBook[1224] Command: Standard Suite.count
	Direct Parameter: <NSIndexSpecifier: orderedDocuments 1>
	Receivers: <NSIndexSpecifier: orderedDocuments 1>
	Arguments: {ObjectClass = 1936159344; }
2006-03-17 14:52:24.118 SecretBook[1224] Group called with 13 groups
2006-03-17 14:52:24.118 SecretBook[1224] Result: 1

Which confirms that there are 13 groups, but the AppleScript only reports 1. Can anyone see what I am doing wrong here?


Jason





_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: playing swf file
  • Next by Date: Re: Launch Services (or whomever) does not let sleeping disks lie...
  • Previous by thread: Re: Bindings Faked Array Item Problem
  • Next by thread: Object allocation problem
  • Index(es):
    • Date
    • Thread