Question

OK. So, let's say :

  • I've got a class myCollection, a class myObject and a property objects in myCollection returning an NSArray of myObjects

Given that I have properly set up my .sdef file for the myCollection and the myObject classes, how should I go about defining my objects property there as well ?

I mean, so far I can do something like that :

tell application "myApplication"
     collection's activeObject's name
end tell

What I want is to be able to access the myObjects as elements of an array :

tell application "myApplication"
     set Obj to collection's object 0
end tell

This is my .sdef (almost...) so far:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dictionary SYSTEM "file://localhost/System/Library/DTDs/sdef.dtd">
<dictionary xmlns:xi="http://www.w3.org/2003/XInclude">
    <xi:include href="file:///System/Library/ScriptingDefinitions/CocoaStandard.sdef" xpointer="xpointer(/dictionary/suite)"/>
    <suite name="myApplication Suite" code="myRm" description="myApplication Suite">
        <class name="application" code="camy" description="myApplication&apos;s top-level scripting object." inherits="application">
            <cocoa class="myApplication"/>
            <property name="myname" code="PEnm" description="The name of the application" type="text" access="r">
                <cocoa key="myname"/>
            </property>
            <property name="currentContents" code="PEnc" description="The current contents" type="text" access="r">
                <cocoa name="currentContents" />
            </property>
            <property name="activeDocument" code="PEad" description="The active document" type="document" access="r">
                <cocoa name="activeDocument" />
            </property>
        </class>
        <class name="document" code="cDoc" description="myApplication document">
            <cocoa class="myDocument"/>
            <property name="alias" code="cDal" description="The document's alias" type="text" access="r">
                <cocoa key="alias" />
            </property>
            <property name="content" code="cDco" description="The document's content" type="text" access="rw">
                <cocoa key="content" />
            </property>
        </class>
    </suite>

</dictionary>

How should I go about that?

Was it helpful?

Solution

That's all I needed :

    <class name="editor" code="cDed" description="myEditor">
        <cocoa class="myEditor"/>
        <element type="document" access="r">
            <cocoa name="documents" />
        </element>
    </class>
    <class name="document" code="cDoc" description="myDocument">
        <cocoa class="myDocument"/>
        ....
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top